Audio playing method and device and electronic equipment
By dynamically adjusting the cached data length and synchronization delay of the audio playback device, the problem that audio playback devices in the prior art cannot balance smoothness and synchronization is solved, and a more stable audio playback experience is achieved.
Patent Information
- Application Number
- CN202411765721.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-28
AI Technical Summary
Existing audio playback devices fail to balance smoothness and synchronization when playing audio, resulting in high latency or playback stuttering.
By obtaining the reception time interval and environmental interference factors of multiple packets of audio data sent by the audio output device, the cached data length and synchronization delay in the audio playback device are dynamically adjusted to ensure that there is enough cached data to avoid playback interruptions when the data reception is unstable, and the synchronization delay is adjusted in different environments to ensure synchronous sound.
It realizes that while maintaining different audio playback devices synchronously, it minimizes the problem of playback lag and achieves a balance between fluency and synchronization.
Smart Images

Figure CN119729743A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of terminal technology, and specifically relates to an audio playback method, device and electronic equipment. Background Art
[0002] Nowadays, smart terminal devices such as mobile phones and computers can be connected to audio playback devices and play audio through audio playback devices such as headphones and speakers.
[0003] In this case, the audio playback device usually sets a fixed delay time in advance. No matter what the transmission environment is, the audio playback device will play the audio after receiving the audio signal and after the fixed delay time. If the fixed delay time is long, it will bring high latency, causing the audio and video to be out of sync; if the fixed delay time is short, it may cause playback jams. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an audio playback method, device and electronic device, which can solve the technical problem that the smoothness and synchronization of playback cannot be balanced when the audio playback device plays audio.
[0005] In a first aspect, an embodiment of the present application provides an audio playback method, the method comprising:
[0006] Acquire a receiving time interval of multiple data packets of audio data sent by an audio output device, and an environmental interference factor of an environment where the first audio playback device is located, wherein the receiving time interval is the length of an interval between the receiving moments of each two adjacent data packets;
[0007] Determining, according to at least one of the receiving time interval and the environmental interference factor, a buffered data length in the first audio playback device and a synchronization delay between the first audio playback device and a second audio playback device, wherein the second audio playback device is used to receive the audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device;
[0008] The audio data is sent to the second audio playback device according to the synchronization delay, and the audio data is played according to the buffered data length.
[0009] In a second aspect, an embodiment of the present application provides an audio playback device, the device comprising:
[0010] An acquisition module, used to acquire a receiving time interval of multiple data packets of audio data sent by an audio output device, and an environmental interference factor of an environment where the first audio playback device is located, wherein the receiving time interval is a duration of an interval between receiving moments of each two adjacent data packets;
[0011] a first determining module, configured to determine a buffered data length in the first audio playback device and a synchronization delay between the first audio playback device and a second audio playback device according to at least one of the receiving time interval and the environmental interference factor, wherein the second audio playback device is configured to receive audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device;
[0012] The playing module is used to send the audio data to the second audio playing device according to the synchronization delay, and play the audio data according to the buffered data length.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method provided in the first aspect are implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method provided in the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method provided in the first aspect.
[0016] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method provided in the first aspect.
[0017] In the audio playback method, device and electronic device of the present application, the length of cached data in the first audio playback device and the synchronization delay between the first audio playback device and the second audio playback device can be dynamically adjusted according to the reception time interval of multiple data packets and the environmental interference factors of the environment in which the first audio playback device is located, so as to ensure that there is enough cached data to avoid playback interruption when data reception is unstable; at the same time, the synchronization delay between different audio playback devices is adjusted according to the interference of environmental interference factors, so as to ensure that different audio playback devices can sound synchronously in different environments. In this way, while maintaining the synchronous playback of different audio playback devices, the problem of playback jamming can be minimized to achieve a balance between fluency and synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of an audio playback method provided by an embodiment of the present application;
[0019] Figure 2 is a flowchart of an audio playback method provided by another embodiment of the present application;
[0020] Figure 3 is a flowchart of an audio playback method provided by another embodiment of the present application;
[0021] Figure 4 is a flowchart of an audio playback method provided in yet another embodiment of the present application;
[0022] Figure 5 is a schematic diagram of a correspondence table provided by an embodiment of the present application;
[0023] Figure 6 is a structural schematic diagram of an audio playback device provided by another embodiment of the present application;
[0024] Figure 7 is a structural schematic diagram of an electronic device provided by another embodiment of the present application;
[0025] Figure 8 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0028] In order to solve the above technical problems, the present application provides an audio playback method. The audio playback method provided by the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0029] like Figure 1 As shown, Figure 1 : is a flowchart of an audio playback method provided by an embodiment of the present application. The embodiment of the present application provides an audio playback method, which is applied to a first audio playback device. The method may include:
[0030] S101, obtaining a receiving time interval of multiple data packets of audio data sent by an audio output device, and an environmental interference factor of an environment where the first audio playback device is located, wherein the receiving time interval is a duration of an interval between receiving moments of each two adjacent data packets;
[0031] In this embodiment, the audio output device is a device that sends audio data, and the audio output device may include a mobile phone, a tablet or a computer; the audio playback device refers to a device that receives and plays audio data, such as headphones or speakers. The audio data can be divided into multiple small blocks during the transmission process, and each small block is a data packet of audio data. In addition, the first audio playback device directly receives audio data from the audio output device and transmits it to the second audio playback device, while the second audio playback device receives audio data through the first audio playback device and plays it synchronously with the first audio playback device. For example, the first audio playback device can be a main headset, a main speaker, a main speaker or other audio playback device, and correspondingly, the second audio playback device can be a secondary headset, a secondary speaker, a secondary speaker or other audio playback device.
[0032] In this embodiment, the audio output device sends multiple data packets to the first audio playback device in time sequence. The first audio playback device receives multiple data packets in sequence and records the reception time difference between every two adjacent data packets as a reception time interval, that is, the reception time interval of multiple data packets can be obtained.
[0033] Environmental interference factors refer to external environmental conditions that affect the signal quality between audio playback devices, such as physical obstacles, radio interference, electromagnetic radiation, etc. They will weaken signal strength, increase transmission delay, and cause data loss, thereby affecting the signal quality between audio playback devices. The signal quality is used to characterize the communication status between the first audio playback device and the second audio playback device.
[0034] S102, determining a buffered data length in the first audio playback device and a synchronization delay between the first audio playback device and a second audio playback device according to at least one of the receiving time interval and the environmental interference factor, wherein the second audio playback device is used to receive the audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device;
[0035] In the present embodiment, the buffered data length refers to the number of audio data packets temporarily stored in the first audio playback device to ensure smooth audio playback. The audio data packets are temporarily stored in the first audio playback device, and a delay time, i.e., a buffered delay, is introduced when waiting for processing and playback. If the buffered data length is large, then the larger buffered data length can provide a larger time buffer for the playback of the audio data to cope with sudden signal instability or data loss. When encountering interference, the playback device can have sufficient time to wait for the arrival of new data packets to ensure the continuity of the audio stream, so the anti-interference ability is also strong. However, a larger buffered data length will also increase the total delay of the audio playback, which may cause phenomena such as audio and video asynchronism; on the contrary, if the buffered data length is small, then the total delay is also small, but the anti-interference ability is also weak.
[0036] Since the receiving time interval between adjacent data packets is large or fluctuates greatly, it indicates that the transmission is unstable, which may cause data packet loss or delay. Therefore, after obtaining the receiving time interval of multiple data packets of audio data sent by the audio output device, the buffered data length can be determined according to the receiving time interval, so that the buffered data length can take into account the continuity of the audio stream without causing excessive total delay to cause audio and video asynchrony.
[0037] In some embodiments, S102 includes:
[0038] determining an average time interval between reception time intervals of the plurality of data packets;
[0039] Determine the cache data length corresponding to the average time interval.
[0040] In this embodiment, the average time interval between the reception time intervals of multiple data packets can be calculated to evaluate the stability of the transmission of audio data from the audio output device to the first audio playback device through the average time interval. If the average time interval is long, it means that the stability of the transmission is poor, so a longer buffer data length needs to be set; if the average time interval is short, it means that the stability of the transmission is good, so a shorter buffer data length can be set.
[0041] like Figure 2In the embodiment shown, there are 7 data packets, so the receiving time interval is 6, the audio output device is a mobile phone, and the first audio playback device is a headset. After the headset receives the 7 audio data packets sent by the mobile phone, 6 receiving time intervals, namely T1, T2, T3, T4, T5 and T6, can be determined based on the receiving time of the 7 data packets. Then the average time interval t=(T1+T2+T3+T4+T5+T6) / 6 is calculated, and the corresponding cache data length can be determined based on the average time interval. The cache data length includes A file, B file and C file, among which the cache data length of A file is the longest TT1, the cache data length of B file is the middle TT2, and the cache data length of C file is the shortest TT3.
[0042] The required buffered data length can be determined based on the average time interval, ensuring that the buffered amount is increased when data reception is unstable to avoid playback interruptions, and reduced when reception is stable to reduce latency. This method can dynamically adjust the buffered data length to balance the smoothness and latency of audio playback.
[0043] In some embodiments, determining the cache data length corresponding to the average time interval includes:
[0044] When the average time interval is greater than a first duration threshold, determining the cache data length as a first cache data length;
[0045] When the average time interval is less than or equal to the first duration threshold and greater than the second duration threshold, determining the cache data length as the second cache data length;
[0046] When the average time interval is less than or equal to the second duration threshold and greater than the third duration threshold, determining the cache data length as the third cache data length;
[0047] Among them, the first duration threshold is greater than the second duration threshold, the second duration threshold is greater than the third duration threshold, the first cache data length is greater than the second cache data length, and the second cache data length is greater than the third cache data length.
[0048] In this embodiment, there is a set reference duration for each audio codec format, which is the ideal interval time for receiving data packets in the audio codec format. For example, the reference duration is 20.3ms in the sub-band codec (SBC) format, 11.6ms in the game mode SBC, and 23ms in the advanced audio codec (AAC) format.
[0049] For any audio codec format, the first duration threshold, the second duration threshold and the third duration threshold can be determined based on their corresponding benchmark duration. The stability interval of data packet reception is divided by the first duration threshold, the second duration threshold and the third duration threshold to judge the stability of data reception.
[0050] If the average time interval is greater than the maximum first duration threshold, it means that the reception of the data packet is very unstable, and the cache data length needs to be set to the longest first cache data length; if the average time interval is between the second duration threshold and the third duration threshold, it means that the reception of the data packet is relatively stable, and the cache data length can be set to the medium second cache data length. If the average time interval is less than the minimum third duration threshold, it means that the reception of the data packet is very stable, and the cache data length can be set to the shortest third cache data length.
[0051] As an optional embodiment, in the AAC codec format, the reference duration is 23ms, the first duration threshold can be set to 100ms, the second duration threshold can be set to 50ms, and the third duration threshold can be set to 30ms. The longer the cache data length is, the longer the cache delay is. The first cache data length is the longest, and its corresponding cache delay is 300ms. The second cache data length is moderate, and its corresponding cache delay is 150ms. The third cache data length is the shortest, and its corresponding cache delay is 50ms. If the average time interval is greater than 100ms, it means that the data packet reception is very unstable. At this time, a larger cache data length needs to be set for smooth playback. The cache data length can be set longer, and the cache delay is 300ms; if the average time interval is between 50ms and 100ms, it means that the data reception is relatively stable, and the cache data length can be set to moderate, and the cache delay is 150ms; if the average time interval is between 30ms and 50ms, it means that the data reception is very stable, and the cache data length can be set to be shorter, and the cache delay is a smaller 50ms.
[0052] Through the above method, the receiving interval of the audio data packet can be analyzed in real time, and the cache amount can be dynamically adjusted to balance the anti-interference ability and delay. According to different receiving environments, the cache data length can be increased in unstable environments to ensure playback stability, and the delay can be reduced in stable environments, thereby optimizing the user's auditory experience.
[0053] In some embodiments, after determining the cache data length corresponding to the average time interval, the method further includes:
[0054] Determine a first number of the data packets corresponding to the cache data length;
[0055] The number of data packets buffered in the first audio playback device is adjusted to the first number.
[0056] In this embodiment, the length of the cached data directly determines the number of cached data packets. The larger the length of the cached data, the more data packets are pre-stored in the device, thereby providing a longer playback buffer time. Therefore, after determining the length of the cached data based on the average time interval of multiple received data packets, it can be determined based on the cached data length how many data packets need to be cached to reach the cached data length. Specifically, after determining the length of the cached data, it is possible to further determine a first number of data packets that need to be cached, and then after the first audio playback device receives the data packets of the audio data sent by the audio output device, the first number of data packets are temporarily stored in the internal cache. When the number of data packets in the internal cache exceeds the first number, the first audio playback device starts to play the audio data.
[0057] For example, after the first audio playback device receives a data packet, it temporarily stores the data packet in the device's internal cache. The cache can be a first-in, first-out (FIFO) queue structure. When the number of data packets in the queue reaches a first number, the data packet starts to be played. Whenever a new data packet arrives, the old data packets will be read and played in sequence.
[0058] like Figure 3 As shown, the cache data length includes A gear, B gear and C gear, among which the cache data length of A gear is the first cache data length, and its corresponding cache delay is the longest TT1, corresponding to the cache of 7 data packets, that is, the audio data starts to be played after 7 data packets are cached in the earphone; the cache data length of B gear is the second cache data length, and its corresponding cache delay is the middle TT2, corresponding to the cache of 3 data packets, that is, the audio data starts to be played after 3 data packets are cached in the earphone; the cache data length of C gear is the third cache data length, and its corresponding cache delay is the shortest TT3, corresponding to the cache of 1 data packet, that is, the audio data starts to be played after 1 data packet is cached in the earphone.
[0059] In the above method, the cache data length can be optimized according to the actual situation by dynamically adjusting the number of data packet caches in the audio playback device. When the data transmission is unstable, the number of cached data packets can be increased to prevent playback interruption; when the data transmission is stable, the number of caches can be reduced to reduce latency. In this way, better audio playback fluency and lower latency can be achieved in different transmission environments, improving the user's listening experience.
[0060] In an embodiment of the present application, after the first audio playback device receives a data packet of audio data, the received audio data will be transmitted to the second audio playback device. The data transmission duration required in the synchronization process of the audio data can be determined. Since the first audio playback device needs to play the audio data synchronously with the second audio playback device, even if enough data packets are cached in the first audio playback device, the audio data cannot be played directly, but after the first audio playback device has experienced the length of the cached data, the first audio playback device and the second audio playback device need to negotiate to play the audio data after the synchronization delay. The synchronization delay needs to be greater than the data transmission duration.
[0061] Since the data transmission time required in the process of synchronizing audio data is affected by the environmental interference factors of the environment where the first audio playback device is located, wherein the environmental interference factors may include electromagnetic interference, wireless interference, and environmental noise, etc., if the synchronization delay is set too small, the audio playback between the first audio playback device and the second audio playback device may be out of sync; if the synchronization delay is set too large, the total delay will be increased, and the user will feel that the sound has a significant lag relative to the operation or display screen.
[0062] like Figure 4 As shown, the audio output device is a mobile phone, the first audio playback device is a main earphone, the second audio playback device is a secondary earphone, M1 is the synchronization delay, the main earphone and the secondary earphone can be agreed to play the audio data after M1, and M2 is the data transmission time, and M2 must be smaller than M1.
[0063] Therefore, in some embodiments, S102 includes:
[0064] determining the signal quality between the first audio playback device and the second audio playback device according to the environmental interference factor;
[0065] Determining a first quality interval to which the signal quality belongs;
[0066] The synchronization delay corresponding to the first quality interval is searched in a preset corresponding relationship table.
[0067] In this embodiment, the signal quality is used to characterize the communication status between the first audio playback device and the second audio playback device. The signal quality between the first audio playback device and the second audio playback device can be evaluated by analyzing the environmental interference factors in the environment. The more environmental interference factors and the stronger the interference, the worse the signal quality will usually be.
[0068] For example, during the communication between the first audio playback device and the second audio playback device, the reception status of each audio data packet can be obtained and recorded at regular intervals, and the packet reception success rate can be calculated to determine the signal quality. The first audio playback device can also periodically obtain the signal strength indication (RSSI) data returned by the second audio playback device through the Bluetooth protocol, and record its changes over time to determine the current signal quality. When environmental interference factors increase, the packet reception success rate will decrease, and the RSSI value may also fluctuate or weaken.
[0069] The signal quality can be divided into multiple quality intervals in advance, and based on the currently detected signal quality, the first quality interval to which the current signal quality belongs can be determined. Then, according to the pre-set corresponding relationship table, the value of the synchronization delay corresponding to the first quality interval is determined. Quality intervals of different signal qualities correspond to different synchronization delays. For example, a high-quality interval corresponds to a shorter synchronization delay, and a low-quality interval corresponds to a longer synchronization delay.
[0070] The corresponding relationship table is a relationship table that corresponds different signal qualities and synchronization delays. Figure 5 The corresponding relationship table in the figure can be shown, according to the signal quality (Link Quality) between the first audio playback device and the second audio playback device, the synchronization delay K1 is graded, and different synchronization delay durations are allocated to each connection quality level. The signal quality ranges from level 1 to level 5, corresponding to different K1 durations.
[0071] When the signal quality is the best level 1 (LinkQuality_L1), it means that the signal transmission between the first audio playback device and the second audio playback device is very stable, and the synchronization delay can be set to the shortest 40ms; when the signal quality is level 2 (LinkQuality_L2), the signal transmission is good, but there may be slight fluctuations, so the synchronization delay is set to 70ms; when the signal quality is level 3 (LinkQuality_L3), the signal transmission is somewhat unstable, and the synchronization delay needs to be increased to 100ms. When the signal quality drops to level 4 (LinkQuality_L4), the transmission environment is poor, and the synchronization delay needs to be set to 150ms. When the connection quality is the worst (LinkQuality_L5), the transmission interference is serious. In order to ensure the synchronization of binaural playback, the longest synchronization delay of 250ms needs to be set.
[0072] For example, when the first audio playback device is a main headset and the second audio playback device is a secondary headset, when it is detected that both the main headset and the secondary headset are in a wearing state, the main headset and the secondary headset can periodically collect the connection quality information between the main headset and the secondary headset, and then determine the signal quality. After obtaining 5 signal qualities, the average signal quality of the 5 signal qualities can be calculated to determine the first quality interval to which the average signal quality belongs; and the synchronization delay corresponding to the first quality interval is queried in the preset corresponding relationship table.
[0073] In this way, the synchronization time can be increased when the signal quality is poor to ensure the playback synchronization of multiple audio playback devices; and the synchronization time can be reduced when the signal quality is good to reduce the delay.
[0074] In some embodiments, before querying the synchronization delay corresponding to the first quality interval in the preset correspondence table, the method further includes:
[0075] determining a plurality of quality intervals of signal quality, the plurality of quality intervals including the first quality interval;
[0076] Determine the data transmission duration in each quality interval;
[0077] The correspondence table is constructed according to the signal transmission duration in each quality interval, and the correspondence table includes the correspondence between each quality interval and the synchronization delay, wherein the data transmission duration in each quality interval is less than the synchronization delay corresponding to the quality interval.
[0078] In this embodiment, the signal quality between the first audio playback device and the second audio playback device can be divided into multiple intervals, each interval representing a different signal quality level, such as "excellent", "good", "average", "poor", "extremely poor" and other different grades. In each signal quality interval, the average time required for the data packet of the audio data to be transmitted from the first audio playback device to the second audio playback device, that is, the data transmission time, is determined by measurement or estimation. The better the signal quality, the shorter the data transmission time; the worse the signal quality, the longer the data transmission time.
[0079] Then, a corresponding relationship table can be established according to the data transmission duration in each quality interval, and each quality interval can be matched with the synchronization delay. In order to ensure synchronous playback, in each quality interval, the set synchronization delay must be greater than the data transmission duration to ensure that the second audio playback device can receive data in time and play the sound synchronously with the first audio playback device. For example, if the data transmission duration of the first quality interval is 70ms, the corresponding synchronization delay may be set to 100ms.
[0080] In this embodiment, by ensuring that the data transmission time in each quality interval is less than the corresponding synchronization delay, the problem of asynchronous audio playback of different playback devices caused by data transmission fluctuations can be effectively avoided. Even when the signal quality is poor, sufficient time buffer can be reserved for data transmission to ensure that the second audio playback device can receive data within the synchronization delay, thereby improving the stability and synchronization of playback.
[0081] S103: Send the audio data to the second audio playback device according to the synchronization delay, and play the audio data according to the buffered data length.
[0082] In the embodiment of the present application, after determining the synchronization delay and the length of the cached data, when the first audio playback device sends audio data to the second audio playback device, after a preset synchronization delay, the first audio playback device and the second audio playback device play the audio together to ensure that the two headphones can play the audio at the same time, thereby avoiding the problem of asynchronous audio playback. At the same time, the first audio playback device will determine the amount of audio data to be stored based on the length of the cached data, and only when the amount of audio data stored in the first audio playback device reaches the length of the cached data, will the audio data be played to ensure that the audio can still be played smoothly when the signal is unstable, avoiding freezes or interruptions.
[0083] In the embodiment of the present application, the length of cached data in the first audio playback device and the synchronization delay between the first audio playback device and the second audio playback device can be dynamically adjusted according to the reception time interval of multiple data packets and the environmental interference factors of the environment in which the first audio playback device is located, so as to ensure that there is enough cached data to avoid playback interruption when data reception is unstable; at the same time, the synchronization delay between different audio playback devices is adjusted according to the interference of environmental interference factors, so as to ensure that different audio playback devices can sound synchronously in different environments. In this way, while maintaining the synchronous playback of different audio playback devices, the problem of playback jamming can be minimized to achieve a balance between fluency and synchronization.
[0084] Figure 6 is a structural diagram of an audio playback device provided by another embodiment of the present application, such as Figure 6 As shown, the audio playback device may include:
[0085] The acquisition module 601 is used to acquire a receiving time interval of multiple data packets of audio data sent by the audio output device, and an environmental interference factor of the environment where the first audio playback device is located, wherein the receiving time interval is the length of the interval between the receiving moments of each two adjacent data packets;
[0086] A first determining module 602 is used to determine the length of buffered data in the first audio playback device and the synchronization delay between the first audio playback device and a second audio playback device according to at least one of the receiving time interval and the environmental interference factor, wherein the second audio playback device is used to receive the audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device;
[0087] The playing module 603 is used to send the audio data to the second audio playing device according to the synchronization delay, and play the audio data according to the buffered data length.
[0088] In this application, the length of cached data in the first audio playback device and the synchronization delay between the first audio playback device and the second audio playback device can be dynamically adjusted according to the reception time interval of multiple data packets and the environmental interference factors of the environment where the first audio playback device is located, ensuring that there is enough cached data to avoid playback interruption when data reception is unstable; at the same time, the synchronization delay between different audio playback devices is adjusted according to the interference of environmental interference factors, ensuring that different audio playback devices can sound synchronously in different environments. In this way, while maintaining the synchronous playback of different audio playback devices, the problem of playback jamming can be minimized to achieve a balance between fluency and synchronization.
[0089] In another optional example, the first determining module 602 includes:
[0090] A first determining unit, configured to determine an average time interval between reception time intervals of the plurality of data packets;
[0091] The second determining unit is used to determine the cache data length corresponding to the average time interval.
[0092] In another optional example, the second determining unit includes:
[0093] A first determining subunit, configured to determine the cache data length as a first cache data length when the average time interval is greater than a first duration threshold;
[0094] A second determining subunit, configured to determine the cache data length as a second cache data length when the average time interval is less than or equal to the first duration threshold and greater than the second duration threshold;
[0095] A third determining subunit, configured to determine the cache data length as a third cache data length when the average time interval is less than or equal to the second duration threshold and greater than a third duration threshold;
[0096] Among them, the first duration threshold is greater than the second duration threshold, the first cache data length is greater than the second cache data length, the second duration threshold is greater than the third duration threshold, and the second cache data length is greater than the third cache data length.
[0097] In another optional example, the audio playback device includes:
[0098] A second determining module, configured to determine a first number of the data packets corresponding to the cache data length;
[0099] The adjustment module is used to adjust the number of data packets buffered in the first audio playback device to the first number.
[0100] In another optional example, the first determining module 602 includes:
[0101] a third determining unit, configured to determine the signal quality between the first audio playback device and the second audio playback device according to the environmental interference factor;
[0102] A fourth determining unit, configured to determine a first quality interval to which the signal quality belongs;
[0103] The query unit is used to query the synchronization delay corresponding to the first quality interval in a preset corresponding relationship table.
[0104] In another optional example, the audio playback device includes:
[0105] A third determination module, configured to determine a plurality of quality intervals of signal quality, wherein the plurality of quality intervals include the first quality interval;
[0106] A fourth determination module is used to determine the data transmission duration in each quality interval;
[0107] A construction module is used to construct the correspondence table according to the signal transmission duration in each quality interval, and the correspondence table includes the correspondence between each quality interval and the synchronization delay, wherein the data transmission duration in each quality interval is less than the synchronization delay corresponding to the quality interval.
[0108] The audio playback device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.
[0109] The audio playback device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0110] The audio playback device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0111] Alternatively, if Figure 7 As shown, an embodiment of the present application also provides an electronic device 100, including a processor 110, a memory 119, and a program or instruction stored in the memory 119 and executable on the processor 110. When the program or instruction is executed by the processor 110, each process of the above-mentioned audio playback method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0112] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0113] Please refer to Figure 8 , Figure 8 The hardware structure diagram of an electronic device for implementing an embodiment of the present application is shown in FIG. The electronic device 100 includes, but is not limited to, a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, and a processor 120.
[0114] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 120 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0115] The processor 120 is used to obtain a receiving time interval of multiple data packets of audio data sent by the audio output device, and an environmental interference factor of the environment where the first audio playback device is located, wherein the receiving time interval is the length of the interval between the receiving moments of each two adjacent data packets;
[0116] The processor 120 is used to determine the length of cached data in the first audio playback device and the synchronization delay between the first audio playback device and the second audio playback device according to at least one of the receiving time interval and the environmental interference factor, wherein the second audio playback device is used to receive the audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device;
[0117] The processor 120 is configured to send the audio data to the second audio playback device according to the synchronization delay, and play the audio data according to the buffered data length.
[0118] In this application, the length of cached data in the first audio playback device and the synchronization delay between the first audio playback device and the second audio playback device can be dynamically adjusted according to the reception time interval of multiple data packets and the environmental interference factors of the environment where the first audio playback device is located, ensuring that there is enough cached data to avoid playback interruption when data reception is unstable; at the same time, the synchronization delay between different audio playback devices is adjusted according to the interference of environmental interference factors, ensuring that different audio playback devices can sound synchronously in different environments. In this way, while maintaining the synchronous playback of different audio playback devices, the problem of playback jamming can be minimized to achieve a balance between fluency and synchronization.
[0119] In another optional example, the processor 120 is further configured to:
[0120] determining an average time interval between reception time intervals of the plurality of data packets;
[0121] Determine the cache data length corresponding to the average time interval.
[0122] In another optional example, the processor 120 is further configured to:
[0123] When the average time interval is greater than a first duration threshold, determining the cache data length as a first cache data length;
[0124] When the average time interval is less than or equal to the first duration threshold and greater than the second duration threshold, determining the cache data length as the second cache data length;
[0125] When the average time interval is less than or equal to the second duration threshold and greater than the third duration threshold, determining the cache data length as the third cache data length;
[0126] Among them, the first duration threshold is greater than the second duration threshold, the second duration threshold is greater than the third duration threshold, the first cache data length is greater than the second cache data length, and the second cache data length is greater than the third cache data length.
[0127] In another optional example, the processor 120 is further configured to:
[0128] Determine a first number of the data packets corresponding to the cache data length;
[0129] The number of data packets buffered in the first audio playback device is adjusted to the first number.
[0130] In another optional example, the processor 120 is further configured to:
[0131] determining the signal quality between the first audio playback device and the second audio playback device according to the environmental interference factor;
[0132] Determining a first quality interval to which the signal quality belongs;
[0133] The synchronization delay corresponding to the first quality interval is searched in a preset corresponding relationship table.
[0134] In another optional example, the processor 120 is further configured to:
[0135] determining a plurality of quality intervals of signal quality, the plurality of quality intervals including the first quality interval;
[0136] Determine the data transmission duration in each quality interval;
[0137] The correspondence table is constructed according to the signal transmission duration in each quality interval, and the correspondence table includes the correspondence between each quality interval and the synchronization delay, wherein the data transmission duration in each quality interval is less than the synchronization delay corresponding to the quality interval.
[0138] It should be understood that in the embodiment of the present application, the input unit 124 may include a graphics processor (Graphics Processing Unit, GPU) 1241 and a microphone 1242, and the graphics processor 1241 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 126 may include a display panel 1261, and the display panel 1261 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 127 includes a touch panel 1271 and at least one of other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include two parts: a touch detection device and a touch controller. Other input devices 1272 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0139] The memory 129 can be used to store software programs and various data. The memory 129 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 129 may include a volatile memory or a non-volatile memory, or the memory 129 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 129 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0140] The processor 120 may include one or more processing units; optionally, the processor 120 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 120.
[0141] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned audio playback method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0142] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0143] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned audio playback method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0144] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0145] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned audio playback method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0146] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0147] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0148] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An audio playback method, characterized in that: The method is applied to a first audio playback device, comprising: Acquire a receiving time interval of multiple data packets of audio data sent by an audio output device, and an environmental interference factor of an environment where the first audio playback device is located, wherein the receiving time interval is the length of an interval between the receiving moments of each two adjacent data packets; Determining, according to at least one of the receiving time interval and the environmental interference factor, a buffered data length in the first audio playback device and a synchronization delay between the first audio playback device and a second audio playback device, wherein the second audio playback device is used to receive the audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device; The audio data is sent to the second audio playback device according to the synchronization delay, and the audio data is played according to the buffered data length.
2. The method according to claim 1, characterized in that The determining the buffered data length in the first audio playback device according to the receiving time interval includes: determining an average time interval between reception time intervals of the plurality of data packets; Determine the cache data length corresponding to the average time interval.
3. The method according to claim 2, characterized in that The determining the cache data length corresponding to the average time interval includes: When the average time interval is greater than a first duration threshold, determining the cache data length as a first cache data length; When the average time interval is less than or equal to the first duration threshold and greater than the second duration threshold, determining the cache data length as the second cache data length; When the average time interval is less than or equal to the second duration threshold and greater than the third duration threshold, determining the cache data length as the third cache data length; Among them, the first duration threshold is greater than the second duration threshold, the second duration threshold is greater than the third duration threshold, the first cache data length is greater than the second cache data length, and the second cache data length is greater than the third cache data length.
4. The method according to claim 2, characterized in that: After determining the cache data length corresponding to the average time interval, the method further includes: Determine a first number of the data packets corresponding to the cache data length; The number of data packets buffered in the first audio playback device is adjusted to the first number.
5. The method according to claim 1, characterized in that The determining of the synchronization delay according to the environmental interference factor comprises: determining the signal quality between the first audio playback device and the second audio playback device according to the environmental interference factor; Determining a first quality interval to which the signal quality belongs; The synchronization delay corresponding to the first quality interval is searched in a preset corresponding relationship table.
6. The method according to claim 5, characterized in that Before querying the synchronization delay corresponding to the first quality interval in the preset corresponding relationship table, the method further includes: determining a plurality of quality intervals of signal quality, the plurality of quality intervals including the first quality interval; Determine the data transmission duration in each quality interval; The correspondence table is constructed according to the signal transmission duration in each quality interval, and the correspondence table includes the correspondence between each quality interval and the synchronization delay, wherein the data transmission duration in each quality interval is less than the synchronization delay corresponding to the quality interval.
7. An audio playback device, characterized in that: The device comprises: An acquisition module, used to acquire a receiving time interval of multiple data packets of audio data sent by an audio output device, and an environmental interference factor of an environment where the first audio playback device is located, wherein the receiving time interval is a duration of an interval between receiving moments of each two adjacent data packets; a first determining module, configured to determine a buffered data length in the first audio playback device and a synchronization delay between the first audio playback device and a second audio playback device according to at least one of the receiving time interval and the environmental interference factor, wherein the second audio playback device is configured to receive audio data transmitted by the first audio playback device and play audio synchronously with the first audio playback device; The playing module is used to send the audio data to the second audio playing device according to the synchronization delay, and play the audio data according to the buffered data length.
8. The device according to claim 7, characterized in that The first determining module comprises: A first determining unit, configured to determine an average time interval between reception time intervals of the plurality of data packets; The second determining unit is used to determine the cache data length corresponding to the average time interval.
9. The device according to claim 8, characterized in that The second determining unit includes: A first determining subunit, configured to determine the cache data length as a first cache data length when the average time interval is greater than a first duration threshold; A second determining subunit, configured to determine the cache data length as a second cache data length when the average time interval is less than or equal to the first duration threshold and greater than the second duration threshold; A third determining subunit, configured to determine the cache data length as a third cache data length when the average time interval is less than or equal to the second duration threshold and greater than a third duration threshold; Among them, the first duration threshold is greater than the second duration threshold, the first cache data length is greater than the second cache data length, the second duration threshold is greater than the third duration threshold, and the second cache data length is greater than the third cache data length.
10. The device according to claim 8, characterized in that The audio playback device comprises: A second determining module, configured to determine a first number of the data packets corresponding to the cache data length; The adjustment module is used to adjust the number of data packets buffered in the first audio playback device to the first number.
11. The device according to claim 7, characterized in that The first determining module comprises: a third determining unit, configured to determine the signal quality between the first audio playback device and the second audio playback device according to the environmental interference factor; A fourth determining unit, configured to determine a first quality interval to which the signal quality belongs; The query unit is used to query the synchronization delay corresponding to the first quality interval in a preset corresponding relationship table.
12. The device according to claim 11, characterized in that The audio playback device comprises: A third determination module, configured to determine a plurality of quality intervals of signal quality, wherein the plurality of quality intervals include the first quality interval; A fourth determination module is used to determine the data transmission duration in each quality interval; A construction module is used to construct the correspondence table according to the signal transmission duration in each quality interval, and the correspondence table includes the correspondence between each quality interval and the synchronization delay, wherein the data transmission duration in each quality interval is less than the synchronization delay corresponding to the quality interval.
13. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the audio playing method as described in any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Thermal imaging and visible light data synchronization method based on dynamic queue management
CN120812191A