Method, apparatus and terminal device for transmitting audio stream
Patent Information
- Application Number
- CN202211731440.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2042-12-30
AI Technical Summary
[0024]第四方面,本申请实施例提供一种计算机可读存储介质,上述计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行第一方面提供的方法。
Smart Images

Figure CN118283016B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart terminal technology, and in particular to a method, apparatus and terminal device for transmitting audio streams. Background Technology
[0002] When a Bluetooth audio system (taking a mobile phone as the central device and a Bluetooth headset as the terminal device) transmits audio streams, due to the limited bandwidth of Bluetooth, Bluetooth devices need to encode the audio streams. For example, Bluetooth devices can use encoding methods such as subband coding (SBC) or advanced audio coding (AAC) to encode the audio streams, and can select a specific bitrate to encode the audio streams as needed.
[0003] In existing related technologies, the bitrate used to encode audio streams is determined by the central device (e.g., mobile phone). Although the mobile phone can adjust the bitrate based on channel changes perceived by the mobile phone (e.g., received signal strength indicator (RSSI), packet error rate (PER), and / or transmission queue congestion), the mobile phone is not aware of the environment (e.g., interference) or the state of the Bluetooth headset itself (e.g., software running state). Therefore, the timeliness and / or rationality of the bitrate adjustment by the mobile phone are somewhat lacking. Summary of the Invention
[0004] This application provides an audio stream transmission method, apparatus, and terminal device. This application also provides a computer-readable storage medium to enable timely identification of the terminal device's status, timely adjustment of the audio stream encoding bitrate between the terminal device and the central device, reduce or avoid playback choppy phenomena, and improve user experience.
[0005] In a first aspect, embodiments of this application provide an audio stream transmission method applied to a terminal device, wherein the terminal device establishes a connection with a central device, and the terminal device transmits an audio stream to the central device through the connection. The method includes: acquiring the state of the terminal device; wherein the state of the terminal device includes: antenna reception state, the number of playback buffer packets in the terminal device, and / or the CPU load of the central processing unit of the terminal device; determining an adjustment method for the audio stream encoding bitrate based on the state of the terminal device; sending the adjustment method to the central device so that the central device adjusts the encoding bitrate of the audio stream according to the adjustment method; and receiving the audio stream transmitted by the central device using the adjusted encoding bitrate.
[0006] In the above-described audio stream transmission method, after the terminal device obtains its status, it determines the adjustment method for the audio stream encoding bitrate based on the status of the terminal device, and then sends the adjustment method to the central device. The central device adjusts the encoding bitrate of the audio stream according to the adjustment method, and then sends the audio stream using the adjusted encoding bitrate. The terminal device receives the audio stream sent by the central device using the adjusted encoding bitrate. This allows for timely identification of the terminal device's status and timely adjustment of the encoding bitrate of the audio stream between the terminal device and the central device, reducing or avoiding playback choppyness and improving the user experience.
[0007] In one possible implementation, sending the adjustment method to the central device includes sending the adjustment method to the central device via a predefined private message.
[0008] In one possible implementation, obtaining the state of the terminal device includes: obtaining the received signal strength indication and packet error rate of the terminal device; and determining the antenna reception state of the terminal device based on the received signal strength indication and packet error rate.
[0009] In one possible implementation, the method for adjusting the audio stream encoding bitrate based on the state of the terminal device includes: increasing the encoding bitrate of the audio stream when the duration of the terminal device's antenna reception being in a good reception state is greater than or equal to a first predetermined duration; and decreasing the encoding bitrate of the audio stream when the duration of the terminal device's antenna reception not being in a good reception state is greater than or equal to a second predetermined duration. The state of the terminal device's antenna reception being in a good reception state includes: the received signal strength indication of the terminal device being greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device being less than or equal to a predetermined packet error rate threshold.
[0010] In one possible implementation, the state of the terminal device includes the number of playback buffer packets in the terminal device; the method for adjusting the audio stream encoding bitrate based on the state of the terminal device includes: reducing the encoding bitrate of the audio stream when the number of playback buffer packets in the terminal device is less than or equal to a predetermined first buffer packet threshold; and increasing the encoding bitrate of the audio stream when the number of playback buffer packets in the terminal device is greater than a predetermined second buffer packet threshold; wherein the second buffer packet threshold is greater than or equal to the first buffer packet threshold.
[0011] In one possible implementation, the state of the terminal device includes: the CPU load of the terminal device; the method for adjusting the audio stream encoding bitrate based on the state of the terminal device includes: reducing the encoding bitrate of the audio stream when the CPU load of the terminal device is greater than or equal to a predetermined first load threshold for a duration greater than or equal to a third predetermined duration; and increasing the encoding bitrate of the audio stream when the CPU load of the terminal device is less than a predetermined second load threshold for a duration greater than or equal to a fourth predetermined duration.
[0012] In one possible implementation, the state of the terminal device includes at least two of the following: antenna reception state, the number of playback buffer packets in the terminal device, and the CPU load of the terminal device; the method of determining the adjustment of the audio stream encoding bitrate based on the state of the terminal device includes: when there is a state in the terminal device that requires a reduction in the encoding bitrate of the audio stream, the encoding bitrate of the audio stream is reduced according to the state that requires a reduction in the encoding bitrate of the audio stream.
[0013] In one possible implementation, reducing the encoding bitrate of the audio stream according to the state where the encoding bitrate of the audio stream needs to be reduced includes: if there are at least two states where the encoding bitrate of the audio stream needs to be reduced, then prioritizing the at least two states; and reducing the encoding bitrate of the audio stream according to the state with the highest priority.
[0014] Secondly, embodiments of this application provide a terminal device that establishes a connection with a central device. The terminal device transmits an audio stream to the central device through the connection. The terminal device includes: one or more processors; a memory; multiple application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory. The one or more computer programs include instructions that, when executed by the terminal device, cause the terminal device to perform the following steps: obtaining the state of the terminal device; wherein the state of the terminal device includes: antenna reception state, the number of playback buffer packets in the terminal device, and / or the CPU load of the central processing unit of the terminal device; determining an adjustment method for the audio stream encoding bitrate based on the state of the terminal device; sending the adjustment method to the central device so that the central device can adjust the encoding bitrate of the audio stream according to the adjustment method; and receiving the audio stream sent by the central device using the adjusted encoding bitrate.
[0015] In one possible implementation, when the instruction is executed by the terminal device, causing the terminal device to perform the step of sending the adjustment method to the central device includes: sending the adjustment method to the central device through a predefined private message.
[0016] In one possible implementation, when the instruction is executed by the terminal device, the step of obtaining the state of the terminal device includes: obtaining the received signal strength indication and packet error rate of the terminal device; and determining the antenna reception state of the terminal device based on the received signal strength indication and packet error rate.
[0017] In one possible implementation, when the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream encoding bitrate based on the state of the terminal device includes: increasing the encoding bitrate of the audio stream when the duration of the antenna reception state of the terminal device being in a good reception state is greater than or equal to a first predetermined duration; and decreasing the encoding bitrate of the audio stream when the duration of the antenna reception state of the terminal device being in a bad reception state is greater than or equal to a second predetermined duration; wherein, the antenna reception state of the terminal device being in a good reception state includes: the received signal strength indication of the terminal device being greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device being less than or equal to a predetermined packet error rate threshold.
[0018] In one possible implementation, the state of the terminal device includes: the number of playback buffer packets in the terminal device; when the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream encoding bitrate based on the state of the terminal device includes: when the number of playback buffer packets in the terminal device is less than or equal to a predetermined first buffer packet threshold, reducing the encoding bitrate of the audio stream; when the number of playback buffer packets in the terminal device is greater than a predetermined second buffer packet threshold, increasing the encoding bitrate of the audio stream; wherein, the second buffer packet threshold is greater than or equal to the first buffer packet threshold.
[0019] In one possible implementation, the state of the terminal device includes: the CPU load of the terminal device; when the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream encoding bitrate based on the state of the terminal device includes: when the CPU load of the terminal device is greater than or equal to a predetermined first load threshold for a duration greater than or equal to a third predetermined duration, reducing the encoding bitrate of the audio stream; when the CPU load of the terminal device is less than a predetermined second load threshold for a duration greater than or equal to a fourth predetermined duration, increasing the encoding bitrate of the audio stream.
[0020] In one possible implementation, the state of the terminal device includes at least two of the following: antenna reception state, the number of playback buffer packets in the terminal device, and the CPU load of the terminal device; when the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream encoding bitrate based on the state of the terminal device includes: when there is a state in the terminal device that requires a reduction in the encoding bitrate of the audio stream, reducing the encoding bitrate of the audio stream according to the state that requires a reduction in the encoding bitrate of the audio stream.
[0021] In one possible implementation, when the instruction is executed by the terminal device, the terminal device executes the state of reducing the encoding bitrate of the audio stream as needed. The step of reducing the encoding bitrate of the audio stream includes: if there are at least two states that require reducing the encoding bitrate of the audio stream, then prioritizing the at least two states; and reducing the encoding bitrate of the audio stream according to the state with the highest priority.
[0022] Thirdly, embodiments of this application provide an audio stream transmission apparatus, which is included in a terminal device. This apparatus has the function of implementing the terminal device behaviors described in the first aspect and its possible implementations. The function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, an acquisition module, a determination module, a transmission module, and a receiving module.
[0023] It should be understood that the second and third aspects of the embodiments of this application are consistent with the technical solutions of the first aspect of the embodiments of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be described again.
[0024] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method provided in the first aspect.
[0025] Fifthly, embodiments of this application provide a computer program that, when executed by a computer, performs the method provided in the first aspect.
[0026] In one possible design, the programs in the fourth and fifth aspects can be stored, in whole or in part, on a storage medium packaged with the processor, or in part or in whole on a memory not packaged with the processor. Attached Figure Description
[0027] Figure 1 An architecture diagram of a Bluetooth audio system provided in existing related technologies;
[0028] Figure 2 A flowchart illustrating the transmission of audio streams from a central device to an end device, as provided in existing related technologies;
[0029] Figure 3 This is a schematic diagram of the structure of a terminal device provided in one embodiment of this application;
[0030] Figure 4 A system architecture diagram of an audio stream transmission method provided in one embodiment of this application;
[0031] Figure 5 A flowchart of an audio stream transmission method provided in another embodiment of this application;
[0032] Figure 6 A structural diagram of a private message packet based on the L2CAP protocol provided in one embodiment of this application;
[0033] Figure 7 A flowchart of an audio stream transmission method provided in another embodiment of this application;
[0034] Figure 8 A flowchart of an audio stream transmission method provided in another embodiment of this application;
[0035] Figure 9 A flowchart of an audio stream transmission method provided in another embodiment of this application;
[0036] Figure 10 This is a schematic diagram of the structure of a terminal device provided in another embodiment of this application. Detailed Implementation
[0037] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0038] Figure 1 This is an architecture diagram of a Bluetooth audio system provided in existing related technologies. Figure 1 In Bluetooth audio systems, a central device and peripherals (i.e., terminal devices) are included. For example... Figure 1 As shown, in existing related technologies, the bitrate used to encode the audio stream is determined by the central device (e.g., a mobile phone). The central device is equipped with a variable encoder; currently, the main variable encoders used include AAC or SBC. The central device adjusts the encoder rate based on the currently detected local status (e.g., transmission queue length and / or signal strength) to encode and transmit the audio stream at a more suitable bitrate. Figure 2 As shown, Figure 2This is a flowchart of the transmission of audio stream from a central device to an end device provided in the prior art. It should be noted that, in the description of the embodiments of this application, the end device is a terminal device, such as a Bluetooth headset.
[0039] However, in the above scheme, since the state of the terminal device is unknown, the encoding rate adjusted by the central device may not be optimal for the terminal device. Furthermore, since the central device is unaware of the state of the terminal device, the adjustment of the encoding rate by the central device is lagging and cannot solve the user experience problem in a timely manner.
[0040] Based on the above problems, this application provides an audio stream transmission method that enables terminal devices to accurately identify end-side anomalies and determine the necessity for central devices to adjust the encoding bitrate. In addition, through the status monitoring of terminal devices, the central devices can be notified in a timely manner to adjust the encoding bitrate of the audio stream, thereby improving the user experience.
[0041] The audio stream transmission method provided in this application can be applied to terminal devices, wherein the terminal devices can be devices such as smart headphones and / or smart speakers; this application does not impose any restrictions on the specific type of terminal device.
[0042] For example, Figure 3 This is a schematic diagram of the structure of a terminal device provided in one embodiment of this application, as shown below. Figure 3 As shown, the terminal device 100 may include a processor 110 and a communication interface 120. Optionally, the terminal device 100 may also include a memory 130. The processor 110, the communication interface 120, and the memory 130 can communicate with each other through internal connection paths to transmit control and / or data signals. The memory 130 is used to store computer programs, and the processor 110 is used to call and run the computer programs from the memory 130.
[0043] The processor 110 and memory 130 can be combined into a single processing device, but more commonly they are independent components. The processor 110 is used to execute the program code stored in the memory 130. In specific implementations, the memory 130 can be integrated into the processor 110, or it can be independent of the processor 110.
[0044] In addition, to further enhance the functionality of the terminal device 100, the terminal device 100 may also include one or more of an input unit 160 and a display unit 170.
[0045] Optionally, the terminal device 100 may also include a power supply 150 for providing power to various devices or circuits in the terminal device 100.
[0046] It should be understood that Figure 1The processor 110 in the terminal device 100 shown can be a system-on-a-chip (SoC). The processor 110 may include a central processing unit (CPU) and may further include other types of processors, such as a graphics processing unit (GPU).
[0047] For ease of understanding, the following embodiments of this application will be described using the following methods: Figure 3 Taking the terminal device with the structure shown as an example, and in conjunction with the accompanying drawings and application scenarios, the audio stream transmission method provided in this application will be specifically described. In the following description of the embodiments of this application, the terminal device 100 is used as an example of a Bluetooth end-side device (such as a Bluetooth headset).
[0048] Figure 4 A system architecture diagram of an audio stream transmission method provided in one embodiment of this application is shown below. Figure 4 As shown, the system architecture includes a central device and a terminal device 100. The central device includes a bitrate control module, an encoder, and a Bluetooth chip. The bitrate control module determines the encoding bitrate of the audio stream transmitted from the central device to the terminal device 100. The encoder encodes the audio stream according to the bitrate determined by the bitrate control module. The Bluetooth chip transmits the encoded audio stream to the terminal device 100.
[0049] The terminal device 100 includes a decoder and a Bluetooth chip. The Bluetooth chip is used to receive the audio stream transmitted by the central device; the decoder is used to decode the audio stream received by the Bluetooth chip. In this embodiment, there is a status feedback between the terminal device 100 and the central device. During Bluetooth audio playback, the terminal device 100 can obtain its own status, then determine the adjustment method of the audio stream encoding bitrate based on its status, and then send the adjustment method to the central device through its own Bluetooth chip. The status of the terminal device may include: antenna reception status, the number of playback buffer packets in the terminal device 100, and / or the load of the central processing unit (CPU) of the terminal device 100.
[0050] After the Bluetooth chip in the central device receives the adjustment method sent by the terminal device 100, the bit rate control module adjusts the encoding bit rate according to the adjustment method.
[0051] The following is combined Figure 4 The system architecture shown describes the audio stream transmission method provided in the embodiments of this application. Figure 5 A flowchart of an audio stream transmission method provided in another embodiment of this application is shown below. Figure 5 As shown, the above-mentioned audio stream transmission method may include:
[0052] Step 501: Terminal device 100 obtains the status of terminal device 100.
[0053] The status of the aforementioned terminal device may include: antenna reception status, the number of playback buffer packets in the terminal device 100, and / or the CPU load of the terminal device 100.
[0054] Step 502: The terminal device 100 determines the adjustment method of the audio stream encoding bitrate based on the status of the terminal device 100.
[0055] The aforementioned audio stream includes the audio stream transmitted between the terminal device 100 and the central device connected to the terminal device 100.
[0056] Step 503: The terminal device 100 sends the above adjustment method to the central device so that the central device can adjust the encoding bitrate of the audio stream according to the above adjustment method.
[0057] In specific implementations, the method for adjusting the audio stream encoding bitrate can include: a level indicator or an increase / decrease indicator. For example, the level indicator can be used to increase or decrease the audio stream encoding bitrate to the first level; the increase / decrease indicator can be used to increase or decrease the audio stream encoding bitrate. For example, the increase / decrease indicator can be used to increase or decrease the audio stream encoding bitrate by N steps, where N is a positive integer and N≥1; the size of each step can be set by the implementation itself, and this embodiment does not limit this.
[0058] In this embodiment, after the terminal device 100 determines the adjustment method of the audio stream encoding bitrate based on its own state, it sends the determined adjustment method to the central device. The central device can then adjust the audio stream encoding bitrate according to the adjustment method fed back by the terminal device 100. This can compensate for the deficiency that the central device is not aware of the state of the terminal device 100 and that the central device has a lag in adjusting the encoding bitrate.
[0059] Specifically, in this embodiment, the terminal device 100 sends the above adjustment method to the central device by sending the adjustment method to the central device through a predefined private message. One implementation method is that the terminal device 100 encapsulates the adjustment method at the application layer and sends the encapsulated data packet to the central device based on the Space Packet Protocol (SPP). Another implementation method is to define a private message packet based on the Logical Link Control and Adaptation Protocol (L2CAP) and send the adjustment method to the central device through the private message packet. In this implementation method, the structure of the private message packet can be as follows: Figure 6 As shown, Figure 6 This is a structural diagram of a private message packet based on the L2CAP protocol provided in one embodiment of this application. Specifically, the terminal device 100 can encapsulate the above-described adjustment method in... Figure 6 The "Private Parameter Information" section is shown.
[0060] Step 504: Terminal device 100 receives the audio stream sent by the central device using the adjusted encoding bitrate.
[0061] In the above-described audio stream transmission method, after the terminal device 100 obtains its own status, it determines the adjustment method for the audio stream encoding bitrate based on the status of the terminal device 100, and then sends the adjustment method to the central device. The central device adjusts the encoding bitrate of the audio stream according to the adjustment method, and then sends the audio stream using the adjusted encoding bitrate. The terminal device 100 receives the audio stream sent by the central device using the adjusted encoding bitrate. This allows for timely identification of the status of the terminal device 100 and timely adjustment of the encoding bitrate of the audio stream between the terminal device 100 and the central device, reducing or avoiding playback choppyness and improving the user experience.
[0062] Figure 7 A flowchart of an audio stream transmission method provided in another embodiment of this application is shown below. Figure 7 As shown, this application Figure 5 In the illustrated embodiment, step 501 may include:
[0063] Step 701: Terminal device 100 acquires the received signal strength indicator (RSSI) and packet error rate (PER) of terminal device 100.
[0064] Step 702: The terminal device 100 determines the antenna reception status of the terminal device 100 based on the RSSI and PER mentioned above.
[0065] Thus, step 502 may include:
[0066] Step 703: When the duration of the antenna reception state of the terminal device 100 being in a good reception state is greater than or equal to a first predetermined duration, the encoding bit rate of the audio stream is increased; when the duration of the antenna reception state of the terminal device 100 being in a bad reception state is greater than or equal to a second predetermined duration, the encoding bit rate of the audio stream is decreased.
[0067] The antenna reception state of the terminal device 100 being in a good reception state can be defined as follows: the received signal strength indication of the terminal device 100 is greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device 100 is less than or equal to a predetermined packet error rate threshold. The magnitudes of the predetermined received signal strength threshold and the predetermined packet error rate threshold can be set by the user according to actual needs and / or system performance during implementation. This embodiment does not limit the magnitudes of the predetermined received signal strength threshold and the predetermined packet error rate threshold. The lengths of the first predetermined duration and the second predetermined duration can also be set by the user according to actual needs and / or system performance during implementation. This embodiment does not limit the lengths of the first predetermined duration and the second predetermined duration.
[0068] In other words, when the antenna reception of terminal device 100 is in a good reception state for a long period of time (e.g., greater than or equal to a first predetermined duration), terminal device 100 can generate an adjustment method to increase the encoding bitrate. After receiving this adjustment method, the central device will increase the encoding bitrate of the encoder, thereby improving the Bluetooth audio effect. Conversely, when the antenna reception of terminal device 100 is not in a good reception state for a period of time greater than or equal to a second predetermined duration, terminal device 100 can generate an adjustment method to decrease the encoding bitrate. After receiving this adjustment method, the central device will decrease the encoding bitrate of the encoder. This allows for timely adjustment of the encoding bitrate between terminal device 100 and the central device, mitigating or avoiding playback choppyness and improving the user experience.
[0069] Figure 8 This is a flowchart of an audio stream transmission method provided in another embodiment of this application. In this embodiment, the state of the terminal device 100 may include: the number of playback buffer packets in the terminal device 100; such as Figure 8 As shown, this application Figure 5 In the illustrated embodiment, step 502 may include:
[0070] Step 801: When the number of playback buffer packets in the terminal device 100 is less than or equal to a predetermined first buffer packet threshold, the encoding bitrate of the audio stream is reduced; when the number of playback buffer packets in the terminal device 100 is greater than a predetermined second buffer packet threshold, the encoding bitrate of the audio stream is increased.
[0071] Wherein, the second buffer threshold is greater than or equal to the first buffer threshold. The size of the first and second buffer thresholds can be set by the system based on performance and / or implementation requirements during specific implementation. In this embodiment, the size of the first and second buffer thresholds is not limited, as long as the second buffer threshold is greater than or equal to the first buffer threshold.
[0072] In this embodiment, if the number of playback buffer packets in the terminal device 100 is less than or equal to a predetermined first buffer packet threshold, it indicates that the data to be played in the terminal device 100 is about to run out. Therefore, the terminal device 100 can generate an adjustment method to reduce the encoding bitrate. After receiving this adjustment method, the central device will lower the encoder's encoding bitrate to reduce the transmission load, thereby mitigating or preventing audio stuttering before the terminal device 100 experiences any "stuttering". Conversely, if the number of playback buffer packets in the terminal device 100 is greater than a predetermined second buffer packet threshold, it indicates that the data to be played in the terminal device 100 is sufficient. Therefore, the terminal device 100 can generate an adjustment method to increase the encoding bitrate. After receiving this adjustment method, the central device will increase the encoder's encoding bitrate, thereby improving the Bluetooth audio effect.
[0073] Figure 9 This is a flowchart of an audio stream transmission method provided in another embodiment of this application. In this embodiment, the state of the terminal device 100 may include: the CPU load of the terminal device 100; such as Figure 9 As shown, this application Figure 5 In the illustrated embodiment, step 502 may include:
[0074] Step 901: When the CPU load of the terminal device 100 is greater than or equal to the duration of a predetermined first load threshold and is greater than or equal to a third predetermined duration, the encoding bitrate of the audio stream is reduced; when the CPU load of the terminal device 100 is less than the duration of a predetermined second load threshold and is greater than or equal to a fourth predetermined duration, the encoding bitrate of the audio stream is increased.
[0075] The first load threshold and the second load threshold can be set according to actual needs and / or system performance during implementation. In this embodiment, the size of the first load threshold and the second load threshold is not limited, as long as the first load threshold is greater than the second load threshold. The length of the third predetermined duration and the fourth predetermined duration can be set according to actual needs and / or system performance during implementation. In this embodiment, the length of the third predetermined duration and the fourth predetermined duration is not limited.
[0076] In other words, in this embodiment, when the CPU load of the terminal device 100 is in a high-load state (e.g., greater than or equal to a predetermined first load threshold) for a long period of time (e.g., greater than or equal to a third predetermined duration), the terminal device 100 can generate an adjustment method to reduce the encoding bitrate of the audio stream. After receiving this adjustment method, the central device will lower the encoding bitrate of the encoder to reduce the transmission load, thereby alleviating the CPU load of the terminal device 100 and reducing or avoiding the occurrence of sound inconsistencies. When the CPU load of the terminal device 100 is in a low-load state (e.g., less than a predetermined second load threshold) for a long period of time (e.g., greater than or equal to a fourth predetermined duration), the terminal device 100 can generate an adjustment method to increase the encoding bitrate of the audio stream. After receiving this adjustment method, the central device will increase the encoding bitrate of the encoder to improve the Bluetooth audio sound effect.
[0077] Additionally, it should be noted that this application Figure 7 , Figure 8 and Figure 9 The illustrated embodiments can be combined with each other. That is, the state of the terminal device 100 can include at least two of the following: antenna reception state, the number of playback buffer packets in the terminal device 100, and the CPU load of the terminal device 100. Thus, step 502 can be: when there is a state in the terminal device 100 that requires a reduction in the encoding bitrate of the audio stream, reduce the encoding bitrate of the audio stream according to the state that requires a reduction in the encoding bitrate of the audio stream. If there are at least two states that require a reduction in the encoding bitrate of the audio stream, the terminal device 100 can prioritize these at least two states and reduce the encoding bitrate of the audio stream according to the state with the highest priority.
[0078] For example, in one implementation, suppose the duration of the antenna reception state of the terminal device 100 being in a good reception state is greater than or equal to a first predetermined duration, and the duration of the CPU load of the terminal device 100 being greater than or equal to a predetermined first load threshold is greater than or equal to a third predetermined duration. In this case, the encoding bitrate of the audio stream needs to be increased according to the antenna reception state of the terminal device 100, while the encoding bitrate of the audio stream needs to be decreased according to the CPU load. At this time, the terminal device 100 will decrease the encoding bitrate of the audio stream as needed, that is, the terminal device 100 will decrease the encoding bitrate of the audio stream based on the condition that the duration of the CPU load being greater than or equal to the predetermined first load threshold is greater than or equal to the third predetermined duration.
[0079] In another implementation, assuming the duration of the antenna reception state of terminal device 100 not being in a good reception state is greater than or equal to a second predetermined duration, the number of playback buffer packets in terminal device 100 is less than or equal to a predetermined first buffer packet threshold, and the duration of the CPU load of terminal device 100 being greater than or equal to a predetermined first load threshold is greater than or equal to a third predetermined duration, the encoding bitrate of the audio stream needs to be reduced in all three states. In this case, terminal device 100 can prioritize these three states—antenna reception state, number of playback buffer packets, and CPU load—and then reduce the encoding bitrate of the audio stream based on the state with the highest priority. For example, the priority ranking could be: number of playback buffer packets > antenna reception state > CPU load. Therefore, terminal device 100 can reduce the encoding bitrate of the audio stream based on the condition that the number of playback buffer packets is less than or equal to the predetermined first buffer packet threshold.
[0080] It is understood that some or all of the steps or operations in the above embodiments are merely examples, and other operations or variations thereof can be performed in the embodiments of this application. Furthermore, the steps may be performed in different orders as presented in the above embodiments, and it is not necessary to perform all the operations in the above embodiments.
[0081] It is understood that, in order to achieve the above-mentioned functions, the terminal device includes hardware and / or software modules corresponding to the execution of each function. Based on the algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.
[0082] This embodiment can divide the terminal device into functional modules according to the above method embodiment. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0083] Figure 10 This is a schematic diagram of the structure of a terminal device provided in another embodiment of this application. The terminal device establishes a connection with a central device, and transmits audio streams to the central device through the aforementioned connection. This is achieved by dividing the device into functional modules corresponding to various functions. Figure 10 This diagram illustrates a possible configuration of the terminal device 1000 involved in the above embodiments, as shown below. Figure 10 As shown, the terminal device 1000 may include: an acquisition module 1001, a determination module 1002, a sending module 1003, and a receiving module 1004;
[0084] The acquisition module 1001 is used to acquire the status of the terminal device; wherein the status of the terminal device includes: antenna reception status, the number of playback buffer packets in the terminal device and / or the CPU load of the terminal device.
[0085] The determination module 1002 is used to determine the adjustment method of the audio stream encoding bitrate based on the status of the terminal device;
[0086] The sending module 1003 is used to send the above adjustment method to the central device so that the central device can adjust the encoding bitrate of the audio stream according to the above adjustment method;
[0087] The receiving module 1004 is used to receive the audio stream sent by the central device using an adjusted encoding bitrate.
[0088] In this embodiment, the sending module 1003 is specifically used to send the above adjustment method to the central device through a predefined private message.
[0089] In one implementation, the acquisition module 1001 is specifically used to acquire the received signal strength indication and packet error rate of the terminal device, and to determine the antenna reception status of the terminal device based on the received signal strength indication and packet error rate.
[0090] The determining module 1002 is specifically used to increase the encoding bit rate of the audio stream when the duration of the antenna reception state of the terminal device being in a good reception state is greater than or equal to a first predetermined duration; and to decrease the encoding bit rate of the audio stream when the duration of the antenna reception state of the terminal device being in a bad reception state is greater than or equal to a second predetermined duration; wherein, the antenna reception state of the terminal device being in a good reception state includes: the received signal strength indication of the terminal device being greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device being less than or equal to a predetermined packet error rate threshold.
[0091] In another implementation, the state of the terminal device includes the number of playback buffer packets in the terminal device. Thus, the determining module 1002 is specifically used to reduce the encoding bitrate of the audio stream when the number of playback buffer packets in the terminal device is less than or equal to a predetermined first buffer packet threshold; and to increase the encoding bitrate of the audio stream when the number of playback buffer packets in the terminal device is greater than a predetermined second buffer packet threshold; wherein the second buffer packet threshold is greater than or equal to the first buffer packet threshold.
[0092] In another implementation, the state of the terminal device includes: the CPU load of the terminal device; thus, the determining module 1002 is specifically used to reduce the encoding bitrate of the audio stream when the CPU load of the terminal device is greater than or equal to a predetermined first load threshold for a duration greater than or equal to a third predetermined duration; and to increase the encoding bitrate of the audio stream when the CPU load of the terminal device is less than a predetermined second load threshold for a duration greater than or equal to a fourth predetermined duration.
[0093] In another implementation, the state of the terminal device may include at least two of the following: antenna reception state, the number of playback buffer packets in the terminal device, and the CPU load of the terminal device. The determining module 1002 is specifically used to reduce the encoding bitrate of the audio stream according to the state that requires a reduction in the encoding bitrate of the audio stream when the terminal device's state includes such a state. The determining module 1002 is also specifically used to prioritize at least two states that require a reduction in the encoding bitrate of the audio stream when there are at least two states, and reduce the encoding bitrate of the audio stream according to the state with the highest priority.
[0094] It should be noted that this application Figures 5-9 All relevant content of each step involved in the method embodiment shown can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0095] The terminal device 1000 provided in this embodiment is used to execute this application. Figures 5-9 The audio stream transmission method provided in the illustrated embodiment can achieve the same effect as the method described above.
[0096] It should be understood that terminal device 1000 can correspond to Figure 3 The terminal device 100 shown. The functions of the acquisition module 1001 and the determination module 1002 can be derived by... Figure 3 The communication interface 120 in the terminal device 100 shown implements the functionality; the functions of the sending module 1003 and the receiving module 1004 can be implemented by... Figure 3 The processor 110 in the terminal device 100 shown is implemented.
[0097] When using integrated units, the terminal device 1000 may include a processing module, a storage module, and a communication module.
[0098] The processing module can be used to control and manage the actions of the terminal device 1000. For example, it can support the terminal device 1000 in executing the steps performed by the acquisition module 1001, the determination module 1002, the sending module 1003, and the receiving module 1004. The storage module can be used to support the terminal device 1000 in storing program code and data. The communication module can be used to support communication between the terminal device 1000 and other devices.
[0099] The processing module can be a processor or controller, which can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as radio frequency circuitry, a Bluetooth chip, and / or a Wi-Fi chip.
[0100] In one embodiment, when the processing module is a processor and the storage module is a memory, the terminal device 1000 involved in this embodiment can be a device having... Figure 3 The device with the structure shown.
[0101] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute this application. Figures 5-9 The method provided in the illustrated embodiment.
[0102] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to execute this application. Figures 5-9 The method provided in the illustrated embodiment.
[0103] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0104] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0105] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0106] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0107] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A method for transmitting audio streams, applied to a terminal device, characterized in that, The terminal device establishes a connection with the central device, and the terminal device transmits an audio stream to the central device through the connection. The method includes: Obtain the status of the terminal device; wherein, the status of the terminal device includes at least one of: antenna reception status, the number of playback buffer packets in the terminal device, and the CPU load of the central processing unit of the terminal device; The method for adjusting the audio stream encoding bitrate is determined based on the status of the terminal device; The adjustment method is sent to the central device so that the central device can adjust the encoding bitrate of the audio stream according to the adjustment method; Receive the audio stream transmitted by the central device using an adjusted encoding bitrate; The method for determining the adjustment of the audio stream encoding bitrate based on the state of the terminal device includes: When the terminal device is in a state that requires a reduction in the encoding bitrate of the audio stream, the encoding bitrate of the audio stream is reduced according to the state that requires a reduction in the encoding bitrate of the audio stream; and if there are at least two states that require a reduction in the encoding bitrate of the audio stream, the at least two states are prioritized; and the encoding bitrate of the audio stream is reduced according to the state with the highest priority. Wherein, when the state of the terminal device includes the antenna reception state, the method for determining the adjustment of the audio stream coding bitrate based on the state of the terminal device includes: When the duration of the antenna reception state of the terminal device being in a good reception state is greater than or equal to a first predetermined duration, the encoding bitrate of the audio stream is increased; when the duration of the antenna reception state of the terminal device being in a bad reception state is greater than or equal to a second predetermined duration, the encoding bitrate of the audio stream is decreased; wherein, the antenna reception state of the terminal device being in a good reception state includes: the received signal strength indication of the terminal device being greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device being less than or equal to a predetermined packet error rate threshold.
2. The method according to claim 1, characterized in that, Sending the adjustment method to the central device includes: The adjustment method is sent to the central device via a predefined private message.
3. The method according to claim 1, characterized in that, The acquisition of the terminal device status includes: Obtain the received signal strength indication and packet error rate of the terminal device; The antenna reception status of the terminal device is determined based on the received signal strength indication and packet error rate.
4. The method according to claim 1, characterized in that, When the state of the terminal device includes: the number of playback buffer packets in the terminal device. The method for determining the adjustment of the audio stream encoding bitrate based on the state of the terminal device includes: When the number of playback buffer packets in the terminal device is less than or equal to a predetermined first buffer packet threshold, the encoding bitrate of the audio stream is reduced; when the number of playback buffer packets in the terminal device is greater than a predetermined second buffer packet threshold, the encoding bitrate of the audio stream is increased; wherein, the second buffer packet threshold is greater than or equal to the first buffer packet threshold.
5. The method according to claim 1, characterized in that, When the state of the terminal device includes: the CPU load of the terminal device. The method for determining the adjustment of the audio stream encoding bitrate based on the state of the terminal device includes: When the CPU load of the terminal device is greater than or equal to a predetermined first load threshold for a duration greater than or equal to a third predetermined duration, the encoding bitrate of the audio stream is reduced; when the CPU load of the terminal device is less than a predetermined second load threshold for a duration greater than or equal to a fourth predetermined duration, the encoding bitrate of the audio stream is increased.
6. A terminal device, characterized in that, The terminal device establishes a connection with the central device, and the terminal device transmits an audio stream to the central device through the connection. The terminal device includes: One or more processors; memory; multiple applications; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the terminal device, cause the terminal device to perform the following steps: Obtain the status of the terminal device; wherein, the status of the terminal device includes at least one of: antenna reception status, the number of playback buffer packets in the terminal device, and the CPU load of the central processing unit of the terminal device; The method for adjusting the audio stream encoding bitrate is determined based on the status of the terminal device; The adjustment method is sent to the central device so that the central device can adjust the encoding bitrate of the audio stream according to the adjustment method; Receive the audio stream transmitted by the central device using an adjusted encoding bitrate; When the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream encoding bitrate based on the state of the terminal device includes: when there is a state in the terminal device that requires a reduction in the encoding bitrate of the audio stream, reducing the encoding bitrate of the audio stream according to the state that requires a reduction in the encoding bitrate of the audio stream; and if there are at least two states that require a reduction in the encoding bitrate of the audio stream, prioritizing the at least two states; and reducing the encoding bitrate of the audio stream according to the state with the highest priority. Wherein, when the state of the terminal device includes the antenna receiving state, when the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream coding bitrate based on the state of the terminal device includes: When the duration of the antenna reception state of the terminal device being in a good reception state is greater than or equal to a first predetermined duration, the encoding bitrate of the audio stream is increased; when the duration of the antenna reception state of the terminal device being in a bad reception state is greater than or equal to a second predetermined duration, the encoding bitrate of the audio stream is decreased; wherein, the antenna reception state of the terminal device being in a good reception state includes: the received signal strength indication of the terminal device being greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device being less than or equal to a predetermined packet error rate threshold.
7. The terminal device according to claim 6, characterized in that, When the instruction is executed by the terminal device, causing the terminal device to perform the step of sending the adjustment method to the central device includes: The adjustment method is sent to the central device via a predefined private message.
8. The terminal device according to claim 6, characterized in that, When the instruction is executed by the terminal device, causing the terminal device to perform the step of obtaining the state of the terminal device includes: Obtain the received signal strength indication and packet error rate of the terminal device; The antenna reception status of the terminal device is determined based on the received signal strength indication and packet error rate.
9. The terminal device according to claim 6, characterized in that, When the state of the terminal device includes the number of playback buffer packets in the terminal device, and the instruction is executed by the terminal device, the step of causing the terminal device to perform the adjustment method of determining the audio stream encoding bitrate based on the state of the terminal device includes: When the number of playback buffer packets in the terminal device is less than or equal to a predetermined first buffer packet threshold, the encoding bitrate of the audio stream is reduced; when the number of playback buffer packets in the terminal device is greater than a predetermined second buffer packet threshold, the encoding bitrate of the audio stream is increased; wherein, the second buffer packet threshold is greater than or equal to the first buffer packet threshold.
10. The terminal device according to claim 6, characterized in that, The state of the terminal device includes: the CPU load of the terminal device; when the instruction is executed by the terminal device, causing the terminal device to perform the step of determining the adjustment method of the audio stream encoding bitrate based on the state of the terminal device includes: When the CPU load of the terminal device is greater than or equal to a predetermined first load threshold for a duration greater than or equal to a third predetermined duration, the encoding bitrate of the audio stream is reduced; when the CPU load of the terminal device is less than a predetermined second load threshold for a duration greater than or equal to a fourth predetermined duration, the encoding bitrate of the audio stream is increased.
11. An audio stream transmission device, disposed in a terminal device, characterized in that, The terminal device establishes a connection with the central device, and the terminal device transmits an audio stream to the central device through the connection. The transmission device includes: An acquisition module is used to acquire the status of the terminal device; wherein, the status of the terminal device includes at least one of: antenna reception status, the number of playback buffer packets in the terminal device, and the CPU load of the central processing unit of the terminal device; The determining module is used to determine the adjustment method of the audio stream encoding bitrate based on the status of the terminal device; A sending module is used to send the adjustment method to the central device, so that the central device can adjust the encoding bitrate of the audio stream according to the adjustment method; The receiving module is used to receive the audio stream sent by the central device using an adjusted encoding bitrate; Specifically, the determining module is used to reduce the encoding bitrate of the audio stream according to the state that requires reducing the encoding bitrate of the audio stream when the state of the terminal device includes a state that requires reducing the encoding bitrate of the audio stream. The determining module is specifically used to prioritize at least two states when there are at least two states that require a reduction in the encoding bitrate of the audio stream, and reduce the encoding bitrate of the audio stream according to the state with the highest priority. Wherein, when the state of the terminal device includes the antenna reception state, the determining module is specifically used to increase the encoding bitrate of the audio stream when the duration of the antenna reception state of the terminal device being in a good reception state is greater than or equal to a first predetermined duration; and to decrease the encoding bitrate of the audio stream when the duration of the antenna reception state of the terminal device not being in a good reception state is greater than or equal to a second predetermined duration; wherein, the antenna reception state of the terminal device being in a good reception state includes: the received signal strength indication of the terminal device being greater than or equal to a predetermined received signal strength threshold, and the packet error rate of the terminal device being less than or equal to a predetermined packet error rate threshold.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method for transmitting audio data, system, storage medium and Bluetooth earphone
CN109461450A
Data transmission method, terminal, system and computer readable storage medium
CN114501645A