Bluetooth audio transmission adjusting method and deviceTechnical Field
The invention relates to the technical field of communication, in particular to a Bluetooth audio transmission adjusting method and device.
Background
As a short-distance communication mode, bluetooth is widely applied to communication of various terminal devices (such as smart televisions, smart phones, bluetooth headsets, bluetooth speakers, etc.). The bluetooth audio transmission is based on an A2DP protocol (Advanced audio distribution Profile, bluetooth audio transmission model protocol), and bluetooth earphones, speakers, and the like transmit audio data streams through the protocol.
In the bluetooth communication process, the packet loss rate indicates the ratio of the number of lost data packets to the number of sent data packets during data transmission, and generally, the data transmission is very smooth only if the empirical packet loss rate is lower than one ten thousandth. However, the A2DP protocol has a strict requirement on the real-time performance of audio data transmission, and when two terminals perform bluetooth communication, due to the influence of environmental factors (thick walls, metal isolation strips, electronic interference, etc.) or the distance between the two terminals becomes long, the packet loss rate of bluetooth audio transmission increases, which causes the audio to be jammed, and seriously affects the user experience.
Disclosure of Invention
The invention mainly aims to provide a Bluetooth audio transmission adjusting method and a Bluetooth audio transmission adjusting device, and aims to solve the technical problem of audio blockage caused by packet loss in the process of Bluetooth audio data transmission.
In order to achieve the above object, the present invention provides a bluetooth audio transmission adjusting method, which comprises the following steps:
acquiring the packet loss rate of the current Bluetooth audio transmission of the terminal;
judging whether the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold value or not;
if so, calculating the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission according to a preset algorithm;
and adjusting the current Bluetooth transmitting power of the terminal according to the calculation result.
Optionally, the step of adjusting the current bluetooth transmission power of the terminal according to the calculation result includes:
acquiring the current Bluetooth transmitting power of the terminal;
judging whether the current Bluetooth transmitting power of the terminal is smaller than the calculated Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission;
and if so, adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission.
Optionally, after the step of determining whether the current bluetooth transmission power of the terminal is less than the calculated bluetooth transmission power corresponding to the packet loss ratio of the current bluetooth audio transmission, the method further includes:
if not, calculating the Bluetooth transmitting power corresponding to the packet loss rate threshold according to the preset algorithm, and adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate threshold.
Optionally, the step of calculating the bluetooth transmission power corresponding to the packet loss rate of the current bluetooth audio transmission according to a preset algorithm includes:
by passing
Calculating to obtain Bluetooth transmitting power P corresponding to the packet loss rate of the current Bluetooth audio transmission
c;
Wherein L iscIndicating the packet loss rate, L, of the current Bluetooth Audio TransmissionmaxRepresents the maximum packet loss rate and Lmax100%, e is a constant.
Optionally, the method further comprises:
and adjusting the current Bluetooth audio transmission rate of the terminal according to a curve relation between a preset Bluetooth audio transmission rate and the packet loss rate of the current Bluetooth audio transmission of the terminal.
In addition, to achieve the above object, the present invention further provides a bluetooth audio transmission adjusting apparatus, including:
the acquisition module is used for acquiring the packet loss rate of the current Bluetooth audio transmission of the terminal;
the judging module is used for judging whether the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold value;
the calculating module is used for calculating the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission according to a preset algorithm if the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold;
and the first adjusting module is used for adjusting the current Bluetooth transmitting power of the terminal according to the calculation result.
Optionally, the first adjusting module is further configured to:
acquiring the current Bluetooth transmitting power of the terminal;
judging whether the current Bluetooth transmitting power of the terminal is smaller than the calculated Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission;
and if so, adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission.
Optionally, the first adjusting module is further configured to:
if the current Bluetooth transmitting power of the terminal is larger than or equal to the calculated Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission, calculating the Bluetooth transmitting power corresponding to the packet loss rate threshold according to the preset algorithm, and adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate threshold.
Optionally, the computing module is further configured to:
by passing
Calculating to obtain Bluetooth transmitting power P corresponding to the packet loss rate of the current Bluetooth audio transmission
c;
Wherein L iscIndicating the packet loss rate, L, of the current Bluetooth Audio TransmissionmaxRepresents the maximum packet loss rate and Lmax100%, e is a constant.
Optionally, the apparatus further comprises:
and the second adjusting module is used for adjusting the current Bluetooth audio transmission rate of the terminal according to a curve relation between the preset Bluetooth audio transmission rate and the packet loss rate of the current Bluetooth audio transmission of the terminal.
The method comprises the steps of obtaining the packet loss rate of the current Bluetooth audio transmission of a terminal; judging whether the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold value or not; if so, calculating the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission according to a preset algorithm; and adjusting the current Bluetooth transmitting power of the terminal according to the calculation result. Through the mode, when the Bluetooth audio transmission environment is poor, compared with the Bluetooth transmitting power fixed by the terminal in the prior art, the Bluetooth transmitting power of the terminal can be adaptively adjusted according to the packet loss rate of the current Bluetooth audio transmission, so that the packet loss rate of the Bluetooth audio transmission is reduced, the pause phenomenon is reduced, and the technical problem of audio pause caused by packet loss in the Bluetooth audio data transmission process can be solved.
Drawings
Fig. 1 is a flowchart illustrating a bluetooth audio transmission adjustment method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of a detailed step of step S40 in FIG. 1;
fig. 3 is a diagram illustrating a mapping curve between bluetooth transmission power and packet loss rate in formula i;
FIG. 4 is a flowchart illustrating a Bluetooth audio transmission adjustment method according to a second embodiment of the present invention;
fig. 5 is a schematic diagram illustrating a curve relationship between a preset bluetooth audio transmission rate and a packet loss rate of the current bluetooth audio transmission of the terminal according to the present invention;
FIG. 6 is a functional block diagram of a Bluetooth audio transmission adjustment apparatus according to a first embodiment of the present invention;
fig. 7 is a functional block diagram of a bluetooth audio transmission adjustment apparatus according to a second embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a Bluetooth audio transmission adjusting method.
Referring to fig. 1, fig. 1 is a flowchart illustrating a bluetooth audio transmission adjustment method according to a first embodiment of the present invention. The method comprises the following steps:
step S10, obtaining the packet loss rate of the current Bluetooth audio transmission of the terminal;
in this embodiment, the terminal may be an electronic device having a bluetooth communication function, such as a smart television, a smart phone, a bluetooth headset, and a bluetooth speaker.
When two terminal devices perform bluetooth audio transmission, a terminal first obtains a packet loss rate of current bluetooth audio transmission, wherein the packet loss rate represents a ratio of the number of lost data packets to a sent data group during data transmission, and generally, the data transmission is very smooth only if an empirical packet loss rate value is lower than one ten thousandth. The terminal in this embodiment refers to the host end in two bluetooth communication terminal devices, that is, the master device, for example, when the smart television uses the bluetooth to listen separately to the function and the bluetooth speaker to pair and connect, the smart television can be used as the master device, and the bluetooth speaker can be used as the slave device.
Specifically, when performing bluetooth audio transmission, the terminal device uses an A2DP protocol (bluetooth audio transmission model protocol), and an A2dp Service process of the terminal can detect that A2dp is in a play state, at this time, the terminal can call a bluetooth bottom layer read Packet Loss Rate (Packet Loss Rate) interface ReadLossRate (), so as to read the Packet Loss Rate of the current bluetooth audio transmission of the terminal. The terminal can read the packet loss rate of the current Bluetooth audio transmission in real time, can also read the packet loss rate of the current Bluetooth audio transmission according to the preset frequency, and can be flexibly set during specific implementation.
Step S20, judging whether the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold value;
after the terminal acquires the packet loss rate of the current bluetooth audio transmission, whether the acquired packet loss rate is greater than or equal to a preset packet loss rate threshold is judged, and the packet loss rate threshold can be flexibly set according to actual needs, for example, can be set to one ten thousandth. If the obtained packet loss rate is smaller than the preset packet loss rate threshold, it can be determined that the current bluetooth audio transmission interference is small, and no audio jamming phenomenon occurs, so that no processing is required.
Step S30, if the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold, calculating the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission according to a preset algorithm;
if the obtained packet loss rate is greater than or equal to the preset packet loss rate threshold, it can be determined that the current bluetooth audio transmission interference is large, and at this time, the bluetooth transmission power of the terminal needs to be adjusted.
In the prior art, the bluetooth transmission power of the terminal equipment is generally a fixed value, and according to the bluetooth communication protocol formulated by the official, the maximum bluetooth transmission power of the terminal cannot exceed the specified maximum transmission power, otherwise, the related bluetooth standard cannot be tested to pass. Meanwhile, under the same other conditions, the larger the terminal bluetooth transmission power is, the longer the transmission distance is, and the larger the effective distance of bluetooth audio transmission is, so that the terminal bluetooth transmission power is improved to a certain extent, the packet loss rate of bluetooth audio transmission can be reduced, and the generation of audio jamming phenomenon is reduced.
The terminal of this embodiment may calculate the bluetooth transmission power corresponding to the packet loss rate of the current bluetooth audio transmission according to a preset algorithm, where the calculated bluetooth transmission power needs to be within a reasonable range, for example, between 0 and a maximum transmission power specified by a protocol, and the preset algorithm may be flexibly set according to the maximum transmission power specified by the protocol or an empirical value of the maximum transmission power.
And step S40, adjusting the current Bluetooth transmitting power of the terminal according to the calculation result.
And after the terminal obtains the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission through calculation, the current Bluetooth transmitting power of the terminal is adjusted according to the calculation result. For example, the calculated bluetooth transmitting power may be compared with the current bluetooth transmitting power of the terminal, and if the calculated bluetooth transmitting power is greater than the current bluetooth transmitting power of the terminal, the calculated bluetooth transmitting power may be used as the current bluetooth transmitting power of the terminal, so as to increase the current bluetooth transmitting power of the terminal and improve the stuck phenomenon in the audio transmission process.
In the embodiment, the packet loss rate of the current Bluetooth audio transmission of the terminal is obtained; judging whether the packet loss rate of the current Bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold value or not; if so, calculating the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission according to a preset algorithm; and adjusting the current Bluetooth transmitting power of the terminal according to the calculation result. Through the mode, when the Bluetooth audio transmission environment is poor, compared with the Bluetooth transmitting power fixed by the terminal in the prior art, the Bluetooth transmitting power of the terminal can be adaptively adjusted according to the packet loss rate of the current Bluetooth audio transmission, so that the packet loss rate of the Bluetooth audio transmission is reduced, the pause phenomenon is reduced, and the technical problem of audio pause caused by packet loss in the Bluetooth audio data transmission process can be solved.
Further, referring to fig. 2, fig. 2 is a schematic diagram of a refinement step of step S40 in fig. 1. Based on the above-mentioned embodiment shown in fig. 1, the step S40 may include:
step S41, obtaining the current Bluetooth transmitting power of the terminal;
step S42, judging whether the current Bluetooth transmitting power of the terminal is smaller than the calculated Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission;
step S43, if yes, adjusting the current bluetooth transmission power of the terminal to the bluetooth transmission power corresponding to the packet loss rate of the current bluetooth audio transmission.
The terminal reads the current Bluetooth transmitting power of the terminal, and compares the current Bluetooth transmitting power of the terminal with the Bluetooth transmitting power calculated according to a preset algorithm. Because the calculated Bluetooth transmitting power does not exceed the maximum transmitting power specified by the protocol, if the current Bluetooth transmitting power is smaller than the calculated Bluetooth transmitting power, the terminal can adjust the current Bluetooth transmitting power to the calculated Bluetooth transmitting power, so that the Bluetooth transmitting power is increased, and audio frequency blockage is reduced.
Further, after the step S42, the method may further include:
step S44, if not, calculating the Bluetooth transmitting power corresponding to the packet loss rate threshold according to the preset algorithm, and adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate threshold.
If the current bluetooth transmission power is greater than or equal to the calculated bluetooth transmission power, in order to reduce audio jamming, the terminal may adjust the current bluetooth transmission power to a maximum bluetooth transmission power allowed by a protocol, where the maximum bluetooth transmission power allowed by the protocol corresponds to a previously set packet loss rate threshold, so that the set packet loss rate threshold may be converted into the bluetooth transmission power by the same algorithm as before, and then the current bluetooth transmission power of the terminal is adjusted to the bluetooth transmission power corresponding to the packet loss rate threshold. Therefore, the current Bluetooth transmitting power of the terminal can be increased, and the audio jamming is reduced.
In this embodiment, the terminal performs reasonable adaptive adjustment (mainly referred to as increase) on the bluetooth transmitting power of the terminal according to the calculated bluetooth transmitting power corresponding to the packet loss rate of the current bluetooth audio transmission in combination with the current bluetooth transmitting power of the terminal, so that the packet loss rate of the bluetooth audio transmission is reduced, and the occurrence of an audio stuck phenomenon is reduced.
Further, based on the above embodiment, the step S30 may include:
step S31, by
Calculating to obtain Bluetooth transmitting power P corresponding to the packet loss rate of the current Bluetooth audio transmission
c(ii) a Wherein L is
cIndicating the packet loss rate, L, of the current Bluetooth Audio Transmission
maxRepresents the maximum packet loss rate and L
max100%, e is a constant.
In this embodiment, if the maximum bluetooth transmission power specified by the bluetooth communication protocol is 10dbm (decibel milliwatt), the algorithm for the terminal to calculate the bluetooth transmission power may be set as:
obtaining the packet loss rate L of the current Bluetooth audio transmission of the terminalcThe Bluetooth transmitting power P corresponding to the packet loss rate of the current Bluetooth audio transmission can be calculated by substituting the formulac. Referring to fig. 3, fig. 3 is a schematic diagram of a mapping curve between bluetooth transmission power and packet loss rate in formula i, when the current packet loss rate is 0, the corresponding maximum bluetooth transmission power is 10dbm, when the current packet loss rate is 100%, the corresponding bluetooth transmission power is 0, and the calculated bluetooth transmission power is between 0 and 10dbm, so that the formula design conforms to the bluetooth communication protocol and is more reasonable and reliable.
Further, referring to fig. 4, fig. 4 is a flowchart illustrating a bluetooth audio transmission adjustment method according to a second embodiment of the present invention. Based on the first embodiment of the bluetooth audio transmission adjustment method of the present invention, after step S40, the method may further include:
step S50, adjusting the current bluetooth audio transmission rate of the terminal according to a curve relationship between a preset bluetooth audio transmission rate and the packet loss rate of the current bluetooth audio transmission of the terminal.
When carrying out bluetooth audio transmission, except bluetooth transmitting power, bluetooth transmission rate also can exert an influence to the effective transmission distance of bluetooth transmission, and when other conditions are the same, bluetooth transmission rate is faster, and transmission course occupies the channel just more, and natural anti-interference can be worse, and effective audio transmission distance can shorten promptly.
In order to further enhance the anti-interference capability of Bluetooth transmission, the Bluetooth transmission rate can be adjusted while the Bluetooth transmitting power is adjusted in a self-adaptive manner. When the A2DP protocol is used to transmit audio data, the Link layer all uses an ACL (asynchronous connection Link) asynchronous Link, and uses an ACL-U (ACL-User) bearer to transmit a packet (data packet), and at this time, if an EBR (Enhanced Basic Rate) modulation mode is used for transmission, the audio transmission Rate is 2Mbps-3 Mbps.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a curve relationship between a preset bluetooth audio transmission rate and a packet loss rate of the current bluetooth audio transmission of the terminal according to the present invention. As an embodiment, for example, the packet loss rate of the current bluetooth audio transmission does not exceed the preset packet loss rate threshold LoDuring the process, the Bluetooth audio transmission rate is set to be 3Mbps, and the packet loss rate of the current Bluetooth audio transmission exceeds a preset packet loss rate threshold value LoDuring the time, adjust bluetooth audio transmission rate to 2Mbps, reduce bluetooth audio transmission rate promptly to reduce the interference, improve the calorie of pause phenomenon among the audio transmission process. Therefore, the terminal realizes the adaptive adjustment of the Bluetooth audio transmission rate.
This embodiment terminal also carries out self-adaptation adjustment to audio transmission rate in the time of self-adaptation adjustment bluetooth emission power to can further increase bluetooth audio transmission's effective transmission distance, reduce the packet loss rate, reduce audio transmission's the card pause phenomenon, promote user experience.
The invention also provides a Bluetooth audio transmission adjusting device.
Referring to fig. 6, fig. 6 is a functional block diagram of a bluetooth audio transmission adjustment apparatus according to a first embodiment of the present invention. The device comprises:
the obtainingmodule 10 is configured to obtain a packet loss rate of current bluetooth audio transmission of the terminal;
in this embodiment, the terminal may be an electronic device having a bluetooth communication function, such as a smart television, a smart phone, a bluetooth headset, and a bluetooth speaker.
When two terminal devices perform bluetooth audio transmission, a terminal first obtains a packet loss rate of current bluetooth audio transmission, wherein the packet loss rate represents a ratio of the number of lost data packets to a sent data group during data transmission, and generally, the data transmission is very smooth only if an empirical packet loss rate value is lower than one ten thousandth. The terminal in this embodiment refers to the host end in two bluetooth communication terminal devices, that is, the master device, for example, when the smart television uses the bluetooth to listen separately to the function and the bluetooth speaker to pair and connect, the smart television can be used as the master device, and the bluetooth speaker can be used as the slave device.
Specifically, when performing bluetooth audio transmission, the terminal device uses an A2DP protocol (bluetooth audio transmission model protocol), and an A2dp Service process of the terminal can detect that A2dp is in a play state, at this time, the obtainingmodule 10 may call a bluetooth bottom layer read Packet Loss Rate (Packet Loss Rate) interface ReadLossRate (), so as to read the Packet Loss Rate of the current bluetooth audio transmission of the terminal. The obtainingmodule 10 may read the packet loss rate of the current bluetooth audio transmission in real time, and may also read the packet loss rate of the current bluetooth audio transmission according to a preset frequency, which may be flexibly set during specific implementation.
A determiningmodule 20, configured to determine whether a packet loss rate of the current bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold;
after the obtainingmodule 10 obtains the packet loss rate of the current bluetooth audio transmission, the determiningmodule 20 determines whether the obtained packet loss rate is greater than or equal to a preset packet loss rate threshold, where the packet loss rate threshold may be flexibly set according to actual needs, for example, may be set to one ten thousandth. If the obtained packet loss rate is smaller than the preset packet loss rate threshold, the determiningmodule 20 may determine that the current bluetooth audio transmission interference is small, and no audio jamming phenomenon occurs, so that no processing is required.
A calculatingmodule 30, configured to calculate, according to a preset algorithm, a bluetooth transmission power corresponding to the packet loss rate of the current bluetooth audio transmission if the packet loss rate of the current bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold;
if the obtained packet loss rate is greater than or equal to the preset packet loss rate threshold, it can be determined that the current bluetooth audio transmission interference is large, and at this time, the bluetooth transmission power of the terminal needs to be adjusted.
In the prior art, the bluetooth transmission power of the terminal equipment is generally a fixed value, and according to the bluetooth communication protocol formulated by the official, the maximum bluetooth transmission power of the terminal cannot exceed the specified maximum transmission power, otherwise, the related bluetooth standard cannot be tested to pass. Meanwhile, under the same other conditions, the larger the terminal bluetooth transmission power is, the longer the transmission distance is, and the larger the effective distance of bluetooth audio transmission is, so that the terminal bluetooth transmission power is improved to a certain extent, the packet loss rate of bluetooth audio transmission can be reduced, and the generation of audio jamming phenomenon is reduced.
The calculatingmodule 30 of this embodiment may calculate the bluetooth transmission power corresponding to the packet loss rate of the current bluetooth audio transmission according to a preset algorithm, where the calculated bluetooth transmission power needs to be within a reasonable range, for example, between 0 and the maximum transmission power specified by the protocol, and the preset algorithm may be flexibly set according to the maximum transmission power specified by the protocol or an empirical value of the maximum transmission power.
And thefirst adjusting module 40 is configured to adjust the current bluetooth transmission power of the terminal according to the calculation result.
After the calculatingmodule 30 calculates the bluetooth transmitting power corresponding to the packet loss rate of the current bluetooth audio transmission, thefirst adjusting module 40 adjusts the current bluetooth transmitting power of the terminal according to the calculation result. For example, thefirst adjusting module 40 may compare the calculated bluetooth transmission power with the current bluetooth transmission power of the terminal, and if the calculated bluetooth transmission power is greater than the current bluetooth transmission power of the terminal, the calculated bluetooth transmission power may be used as the current bluetooth transmission power of the terminal, so as to increase the current bluetooth transmission power of the terminal and improve a stuck phenomenon in an audio transmission process.
In this embodiment, the obtainingmodule 10 obtains a packet loss rate of the current bluetooth audio transmission of the terminal; the judgingmodule 20 judges whether the packet loss rate of the current bluetooth audio transmission is greater than or equal to a preset packet loss rate threshold; if yes, the calculatingmodule 30 calculates the bluetooth transmitting power corresponding to the packet loss rate of the current bluetooth audio transmission according to a preset algorithm; thefirst adjusting module 40 adjusts the current bluetooth transmitting power of the terminal according to the calculation result. Through the mode, when the Bluetooth audio transmission environment is poor, compared with the Bluetooth transmitting power fixed by the terminal in the prior art, the Bluetooth transmitting power of the terminal can be adaptively adjusted according to the packet loss rate of the current Bluetooth audio transmission, so that the packet loss rate of the Bluetooth audio transmission is reduced, the pause phenomenon is reduced, and the technical problem of audio pause caused by packet loss in the Bluetooth audio data transmission process can be solved.
Further, with continued reference to fig. 6, thefirst adjusting module 40 is further configured to: acquiring the current Bluetooth transmitting power of the terminal; judging whether the current Bluetooth transmitting power of the terminal is smaller than the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission; and if so, adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission.
Thefirst adjusting module 40 reads the current bluetooth transmitting power of the terminal, and compares the current bluetooth transmitting power with the bluetooth transmitting power calculated according to the preset algorithm. Because the calculated bluetooth transmitting power does not exceed the maximum transmitting power specified by the protocol, if the current bluetooth transmitting power is smaller than the calculated bluetooth transmitting power, thefirst adjusting module 40 can adjust the current bluetooth transmitting power to the calculated bluetooth transmitting power, so that the bluetooth transmitting power is increased, and the audio frequency jamming is reduced.
Further, thefirst adjusting module 40 is further configured to: if the current Bluetooth transmitting power of the terminal is larger than or equal to the calculated Bluetooth transmitting power corresponding to the packet loss rate of the current Bluetooth audio transmission, calculating the Bluetooth transmitting power corresponding to the packet loss rate threshold according to the preset algorithm, and adjusting the current Bluetooth transmitting power of the terminal to the Bluetooth transmitting power corresponding to the packet loss rate threshold.
If the current bluetooth transmission power is greater than or equal to the calculated bluetooth transmission power, in order to reduce audio jamming, thefirst adjusting module 40 may adjust the current bluetooth transmission power to a maximum bluetooth transmission power allowed by a protocol, where the maximum bluetooth transmission power allowed by the protocol corresponds to a packet loss rate threshold previously set, and therefore thefirst adjusting module 40 may convert the set packet loss rate threshold into the bluetooth transmission power through the same algorithm as previously set, and then adjust the current bluetooth transmission power of the terminal to the bluetooth transmission power corresponding to the packet loss rate threshold. Therefore, the current Bluetooth transmitting power of the terminal can be increased, and the audio jamming is reduced.
In this embodiment, the terminal performs reasonable adaptive adjustment (mainly referred to as increase) on the bluetooth transmitting power of the terminal according to the calculated bluetooth transmitting power corresponding to the packet loss rate of the current bluetooth audio transmission in combination with the current bluetooth transmitting power of the terminal, so that the packet loss rate of the bluetooth audio transmission is reduced, and the occurrence of an audio stuck phenomenon is reduced.
Further, with continued reference to fig. 6, based on the above-mentioned embodiment, the calculating
module 30 is further configured to: by passing
Calculating to obtain Bluetooth transmitting power P corresponding to the packet loss rate of the current Bluetooth audio transmission
c(ii) a Wherein L is
cIndicating the packet loss rate, L, of the current Bluetooth Audio Transmission
maxRepresents the maximum packet loss rate and L
max100%, e is a constant.
In this embodiment, if the maximum bluetooth transmission power specified by the bluetooth communication protocol is 10dbm (decibel milliwatt), the algorithm for calculating the bluetooth transmission power by the calculatingmodule 30 may be set as:
obtaining the packet loss rate L of the current Bluetooth audio transmission of the terminalcSubstituting the above formula, the calculatingmodule 30 can calculate the bluetooth transmitting power P corresponding to the packet loss rate of the current bluetooth audio transmissionc. Referring to fig. 3, fig. 3 is a schematic diagram of a mapping curve between bluetooth transmission power and packet loss rate in formula i, when the current packet loss rate is 0, the corresponding maximum bluetooth transmission power is 10dbm, when the current packet loss rate is 100%, the corresponding bluetooth transmission power is 0, and the calculated bluetooth transmission power is between 0 and 10dbm, so that the formula design conforms to the bluetooth communication protocol and is more reasonable and reliable.
Further, referring to fig. 7, fig. 7 is a functional module diagram of a bluetooth audio transmission adjusting apparatus according to a second embodiment of the present invention. Based on the first embodiment of the bluetooth audio transmission adjustment apparatus of the present invention, the apparatus may further include:
and thesecond adjusting module 50 is configured to adjust the current bluetooth audio transmission rate of the terminal according to a curve relationship between a preset bluetooth audio transmission rate and a packet loss rate of the current bluetooth audio transmission of the terminal.
When carrying out bluetooth audio transmission, except bluetooth transmitting power, bluetooth transmission rate also can exert an influence to the effective transmission distance of bluetooth transmission, and when other conditions are the same, bluetooth transmission rate is faster, and transmission course occupies the channel just more, and natural anti-interference can be worse, and effective audio transmission distance can shorten promptly.
In order to further enhance the anti-interference capability of Bluetooth transmission, the Bluetooth transmission rate can be adjusted while the Bluetooth transmitting power is adjusted in a self-adaptive manner. When the A2DP protocol is used to transmit audio data, the Link layer all uses an ACL (asynchronous connection Link) asynchronous Link, and uses an ACL-U (ACL-User) bearer to transmit a packet (data packet), and at this time, if an EBR (Enhanced Basic Rate) modulation mode is used for transmission, the audio transmission Rate is 2Mbps-3 Mbps.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a curve relationship between a preset bluetooth audio transmission rate and a packet loss rate of the current bluetooth audio transmission of the terminal according to the present invention. As an embodiment, for example, the packet loss rate of the current bluetooth audio transmission does not exceed the preset packet loss rate threshold LoDuring the process, the Bluetooth audio transmission rate is set to be 3Mbps, and the packet loss rate of the current Bluetooth audio transmission exceeds a preset packet loss rate threshold value LoIn the meantime, thesecond adjusting module 50 adjusts the bluetooth audio transmission rate to 2Mbps, i.e., reduces the bluetooth audio transmission rate, thereby reducing interference and improving the pause phenomenon in the audio transmission process. Therefore, the terminal realizes the adaptive adjustment of the Bluetooth audio transmission rate.
This embodiment terminal also carries out self-adaptation adjustment to audio transmission rate in the time of self-adaptation adjustment bluetooth emission power to can further increase bluetooth audio transmission's effective transmission distance, reduce the packet loss rate, reduce audio transmission's the card pause phenomenon, promote user experience.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.