CN112788494A - Earphone control method, device, equipment and medium - Google Patents

Earphone control method, device, equipment and medium Download PDF

Info

Publication number
CN112788494A
CN112788494A CN202110176992.3A CN202110176992A CN112788494A CN 112788494 A CN112788494 A CN 112788494A CN 202110176992 A CN202110176992 A CN 202110176992A CN 112788494 A CN112788494 A CN 112788494A
Authority
CN
China
Prior art keywords
earphone
condition
data
master
slave
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110176992.3A
Other languages
Chinese (zh)
Inventor
尚岸奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202110176992.3A priority Critical patent/CN112788494A/en
Publication of CN112788494A publication Critical patent/CN112788494A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R5/00Stereophonic arrangements
    • H04R5/04Circuit arrangements, e.g. for selective connection of amplifier inputs/outputs to loudspeakers, for loudspeaker detection, or for adaptation of settings to personal preferences or hearing impairments
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R5/00Stereophonic arrangements
    • H04R5/033Headphones for stereophonic communication

Abstract

The application discloses an earphone control method, an earphone control device, equipment and a medium, and belongs to the technical field of electronic equipment. The earphone control method is applied to a wireless earphone, the wireless earphone comprises a first earphone and a second earphone, and the method comprises the following steps: under the condition that the first earphone is a master earphone and the second earphone is a slave earphone, acquiring a first data change characteristic of the first earphone in a first time period, wherein the master earphone is used for being connected with the slave earphone and terminal equipment respectively, and the first data change characteristic is a change characteristic of first data in an audio cache of the first earphone; and under the condition that the first data change characteristic meets a first target condition, switching the second earphone to the master earphone and switching the first earphone to the slave earphone. The embodiment of the application can effectively ensure the reasonability of the switching time of the master earphone and the slave earphone and improve the stability of audio data transmission.

Description

Earphone control method, device, equipment and medium
Technical Field
The application belongs to the technical field of terminal equipment, and particularly relates to an earphone control method, device, equipment and medium.
Background
As is well known, True Wireless bluetooth headsets (TWS) generally include a plurality of headsets, which may provide users with a good Wireless Stereo experience, and thus are increasingly popular with users. When a TWS communicates with a terminal device such as a mobile phone, it is generally necessary to determine a master earphone and a slave earphone and use the master earphone and the terminal device to transmit audio data.
In the prior art, in order to ensure the transmission of audio data, the switching between the master earphone and the slave earphone may be performed based on the relative signal strength of each earphone. However, in practical applications, there may be a situation that the signal strength of the earphone is good but the actual communication quality is poor, and it is difficult for the conventional master-slave earphone switching manner to ensure the stability of audio data transmission.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, a device, and a medium for controlling an earphone, which can solve the problem that the stability of audio data transmission is difficult to be ensured in the conventional master-slave earphone switching manner.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides an earphone control method, which is applied to a wireless earphone, where the wireless earphone includes a first earphone and a second earphone, and the method includes:
under the condition that the first earphone is a master earphone and the second earphone is a slave earphone, acquiring a first data change characteristic of the first earphone in a first time period, wherein the master earphone is used for being connected with the slave earphone and terminal equipment respectively, and the first data change characteristic is a change characteristic of first data in an audio cache of the first earphone;
and under the condition that the first data change characteristic meets a first target condition, switching the second earphone to the master earphone and switching the first earphone to the slave earphone.
In a second aspect, an embodiment of the present application provides an earphone control device, which is applied to a wireless earphone, where the wireless earphone includes a first earphone and a second earphone, and the device includes:
the first obtaining module is used for obtaining a first data change characteristic of the first earphone in a first time length under the condition that the first earphone is a master earphone and the second earphone is a slave earphone, the master earphone is used for being connected with the slave earphone and the terminal equipment respectively, and the first data change characteristic is a change characteristic of first data in an audio cache of the first earphone;
and the switching module is used for switching the second earphone into the master earphone and switching the first earphone into the slave earphone under the condition that the first data change characteristic meets the first target condition.
In a third aspect, embodiments of the present application provide a terminal device, where the terminal device includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium on which a program or instructions are stored, which when executed by a processor, implement the steps of the method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the steps of the method according to the first aspect.
The earphone control method provided by the embodiment of the application can be applied to a wireless earphone comprising a first earphone and a second earphone, under the condition that the first earphone is a main earphone and the second earphone is not a slave earphone, the change characteristic of first data in an audio cache of the first earphone within a first time span is obtained, and under the condition that the change characteristic of the first data meets a first target condition, the second earphone is switched to the main earphone, and the first earphone is switched to the slave earphone. In the embodiment of the application, the change characteristic of the first data can reflect the actual communication quality between the first earphone and the terminal device, and the switching between the master earphone and the slave earphone is performed under the condition that the change characteristic of the first data meets the first target condition, so that the reasonability of the switching time can be effectively ensured, and the stability of audio data transmission is improved.
Drawings
Fig. 1 is an exemplary diagram of a framework that can implement a headset control method provided by an embodiment of the present application;
fig. 2 is a schematic diagram of a master-slave headset switching based on RSSI in the prior art;
FIG. 3 is a graph comparing the RSSI of the master earphone to the RSSI of the slave earphone;
FIG. 4 is a schematic diagram of an interference source causing interference to a primary earpiece;
FIG. 5 is another graph of the RSSI of the master earphone compared to the RSSI of the slave earphone;
FIG. 6 is a schematic diagram of an interference source causing interference to both the master and slave earpieces;
fig. 7 is a flowchart of an earphone control method provided in an embodiment of the present application;
FIG. 8 is an exemplary diagram of a communication framework for a terminal device and a TWS;
FIG. 9 is a schematic diagram of the variation of the number of packets in the audio buffer of the wireless headset;
figure 10 is a table of SBC setting parameters recommended in the sampling frequency converter;
fig. 11 is a flowchart of an application example of determining a master-slave earphone switching occasion based on a first data change characteristic in an embodiment of the present application;
fig. 12 is a flowchart of a headphone control method provided by an embodiment of the present application in an application example;
fig. 13 is a schematic structural diagram of an earphone control device provided in an embodiment of the present application;
fig. 14 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
fig. 15 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The earphone control method provided by the embodiment of the application can be applied to a framework shown in fig. 1, and as shown in fig. 1, the framework comprises a wireless earphone 10 and a terminal device 20; the Wireless headset may be, for example, a True Wireless bluetooth headset (TWS), Kleer headset, or WiFi headset, which may be wirelessly connected to the terminal device 20, and the terminal device may be a mobile phone, a tablet computer, or a wearable device, which is not limited herein.
The wireless headset 10 may include a first headset 11 and a second headset 12, and for convenience of description, the wireless headset 10 will be mainly described as the TWS. It is assumed that at the initial time, the first earphone 11 and the second earphone 12 can be a master earphone (Primary) and a slave earphone (Secondary), respectively.
Referring to fig. 1, the terminal device 20 generally communicates with the main headset mainly, for example, performs transmission of audio data, and the transmission Link can be referred to as a Link connection channel. In the communication process between the terminal device 20 and the main headset, if the main headset has the condition that the audio data is lost and needs to be retransmitted, the audio data that the main headset needs to retransmit may notify the terminal device 20 to retransmit according to the bluetooth protocol. The specific retransmission process is similar to that of a common monaural bluetooth headset, for example, and is not described herein.
The audio data of the slave earphone is mainly obtained by listening to the transmission link between the terminal device 20 and the master earphone. There is usually no direct communication procedure for the terminal device 20 with the slave headset, in other words, the terminal device 20 generally does not receive feedback from the headset. And a listening channel used by the slave earphone to implement the above listening may be denoted as Sniff.
Similar to the master earpiece, there may also be audio data from the slave earpiece that needs to be retransmitted, which typically needs to be forward patched by the master earpiece. That is, although the master earphone plays only one channel of audio data, it is usually necessary to ensure that all audio data required by two earphones (i.e., the master earphone and the slave earphone) can be received through the Link connection channel. The master earphone may also be referred to as a relay earphone at this time, since the master earphone may forward the audio data to the slave earphone.
Typically, the priority of the link communication quality from the terminal device 20 to the master earphone will be higher than the link communication quality from the terminal device 20 to the slave earphone. The audio data loss of the slave earphone can be compensated by the master earphone, and the distance between the master earphone and the slave earphone is not too far, so that the communication link is stable. In addition, the communication link between the master and slave headsets can be referred to as a Synchronization and drop packet compensation link (Synchronization & locating Package Relay).
Of course, in some cases, for example, when the communication condition of the master earphone is relatively poor, the master earphone may be switched to the slave earphone, and the slave earphone may be switched to the master earphone, in other words, the master earphone and the slave earphone may be switched. After the switching between the master earphone and the slave earphone is completed, the original slave earphone can be switched to the master earphone, and a Link connection channel is established between the master earphone and the terminal device 20.
The conventional main scheme for switching between the master and the slave earphones is to switch between the master earphone and the slave earphone according to the magnitude relationship between the Received Signal Strength Indication (RSSI) between the master earphone and the terminal device 20 and the RSSI between the slave earphone and the terminal device 20. In other words, the earphone having the best communication condition among the first earphone 11 and the second earphone 12 may be determined as the master earphone. In the use process of the TWS, the switching between the master and the slave earphones can be dynamically realized by monitoring the variation of the RSSI values between the two earphones and the terminal device 20. Of course, this switching process of the master and slave earphones is often difficult for the user to perceive.
Referring to fig. 2, fig. 2 shows a schematic diagram of master-slave headset switching by monitoring RSSI. It is easy to understand that, in the TWS, the definition of the master earphone and the slave earphone may be opposite, in other words, the earphone having the Link connection channel established with the terminal device 20 may be always defined as the master earphone, and the above-mentioned switching procedure of the master earphone and the slave earphone may be considered as an exchange procedure of the master earphone and the slave earphone (Role Swap & Handover).
The process of interchanging the master and slave earpieces is described below in connection with an example. Assume that at the initial time, the left earphone (denoted as L) of the TWS earphones is the slave earphone with poor rssi (bad rssi) and the right earphone (denoted as R) is the master earphone with better rssi (good rssi). At another moment, the RSSI of the right earphone becomes worse, while the RSSI of the left earphone is relatively better, so that the left earphone can be switched to the master earphone and the right earphone to the slave earphone.
However, in practical applications, a better RSSI does not necessarily mean a better communication quality. In some application environments, the distance between the master earphone and the terminal device 20 is shorter or the attenuation generated in transmission is less, so it can be seen from the comparison of RSSI that the signal strength of the master earphone (corresponding to thissist) is better than that of the slave earphone (corresponding to otherRSSI).
In general, the RSSI of the master and slave earphones in fig. 3 indicates that the earphones are at a better communication level. As shown in fig. 4, if the master earphone is closer to the Interference Source (Interference Source) at this time, even if the master earphone is used, the combination is likely to be poor in communication quality between the master earphone and the terminal device 20, resulting in continuous noise. However, the conventional RSSI-based master-slave headset switching method has difficulty in making a reasonable switching procedure for such a situation.
With reference to fig. 5, in other common applications, the master and slave earphones are at similar RSSI levels, which is difficult to reflect the communication quality between each earphone and the terminal device 20; meanwhile, the RSSI is used as a standard for switching between the master and slave earphones, which easily causes the repeated switching between the master and slave earphones. In addition, as shown in fig. 6, in the case of a strong interference source, the switching between the master and slave earphones cannot solve the problem of stability of communication quality well.
In view of the above problems, the following describes in detail a headphone control method, apparatus, device, and medium according to embodiments of the present application with reference to the accompanying drawings.
Fig. 7 is a flowchart illustrating a headphone control method according to an embodiment of the present application. The earphone control method can be applied to a wireless earphone which comprises a first earphone and a second earphone, and the method can comprise the following steps:
step 701, under the condition that the first earphone is a master earphone and the second earphone is a slave earphone, acquiring a first data change characteristic of the first earphone within a first time length, wherein the master earphone is used for being connected with the slave earphone and a terminal device respectively, and the first data change characteristic is a change characteristic of first data in an audio cache of the first earphone;
step 702, under the condition that the first data change characteristic meets the first target condition, switching the second earphone to the master earphone, and switching the first earphone to the slave earphone.
As described above, the master earphone may be considered as an earphone that performs audio data transmission with the terminal device, or an earphone that establishes a Link connection channel with the terminal device.
An audio buffer (audio buffer) is typically used in the primary earpiece to buffer the received audio data. In the embodiment of the application, the data size of the audio data in the audio buffer, for example, the size of an audio data packet or the number of frames of the audio data, may be obtained, and the change trend of the audio data of the audio buffer in a certain time may be further obtained. To a certain extent, the audio data can be regarded as the first data, and the change trend of the audio data can be used for representing the change characteristics of the first data.
For convenience of description, the following description mainly takes the first data as audio data.
To facilitate understanding of the role of the audio buffer in the communication between the terminal device and the wireless headset, the following description is made with reference to the communication framework shown in fig. 8.
The wireless headset may be a TWS that may communicate with a terminal device, such as a cell phone; a TWS typically includes two headsets, denoted as a first headset and a second headset. And at a certain moment, audio data is transmitted between the terminal equipment and the first earphone, namely the first earphone is used as a main earphone, and a Link connection channel is established between the first earphone and the terminal equipment.
On one side of the terminal equipment, a Sound source (Sound) enters an Audio output Buffer (Audio process Buffer) after being encoded (Encode), enters a Bluetooth module (Bluetooth) on one side of the terminal equipment, and is transmitted to a Bluetooth module of a first earphone of the TWS in the air through the Bluetooth module;
on the TWS side, after receiving audio data (denoted as raw data), the bluetooth module of the first headset buffers the raw data in an audio input Buffer (Buffer), and an audio decoding module (e.g., codec-DSP) obtains the data from the audio input Buffer, decodes the data, and sends the decoded data to a playback system (e.g., DAC + PA play formed by a DAC and a PA play).
As for the synchronization and packet drop compensation of the audio data between the first earphone and the second earphone, the monitoring of the transmission link between the first earphone and the terminal device by the second earphone, etc., which has been described above, no further description is given here.
The audio buffer mainly plays a role in maintaining stable transmission and playing in the whole processing link of audio data. If the rate of over-the-air transmission, that is, the transmission process between the bluetooth modules is very stable, that is, how much audio data the audio decoding module needs to decode, and how much data the bluetooth module can transmit, then the audio buffer effect is not great at this time.
However, in the actual using process, the air transmission is affected by various environments, so that the stable speed is difficult to maintain in the transmission process, and is always affected by various factors, such as communication distance change, strong and weak interference sources, air multipath interference influence, shielding materials existing in the environment where the TWS and the terminal device are located, and the like, any factor changes, the transmission speed between the bluetooth modules may change according to the environment, and if the environment changes more severely, the problem of data packet loss may occur. In this case, the audio buffer may play an important role in stabilizing audio playback. Therefore, in general, the transmission rate between the bluetooth is greater than the decoding rate of the audio data to maintain stable audio playing; accordingly, the audio buffer stores audio data, such as audio data packets or audio data frames, for a period of time.
Generally, the more the audio data in the audio buffer is, the more time the bluetooth module can be used for adjustment and retransmission, and the more time the bluetooth module can be used for communication adjustment and retransmission before the audio data in the audio buffer is played. Generally, as long as the retransmitted audio data can be supplemented, there is no influence on the audio playing, but if the retransmitted audio data is not connected, the resulting result may be the problems of tone jamming and tone interruption. Particularly, in the listening experience of the user, intermittent or silent problems may occur.
The foregoing has described the principle and application of buffering audio data in the audio buffer, and the data amount of the audio data in the audio buffer of the first headphone is generally available.
For convenience of description, the data amount of the audio data in the audio buffer of the first headphone may be simply referred to as a first data amount. The first data volume can be directly read, and the first data volume at different times can be iteratively calculated based on factors influencing the first data volume.
For example, the audio data may be decoded on a frame-by-frame basis, with each frame corresponding to a decoding time. Referring to fig. 9, assuming that the first data amount in the audio buffer, for example, the number of packets is Xn-1 at the decoding time point of the previous frame, the number of packets that need to be consumed in the time interval from the previous frame to the current frame is M, and the number of packets transmitted through the bluetooth module is N, the first data amount Xn in the audio buffer at the current time point may be represented as Xn-1-M + N.
It will be readily appreciated that the value of M is generally related to the coding format and coding rate of the audio data. For example, common encoding methods for Audio data include Sub-band Coding (SBC) and Advanced Audio Coding (ACC). Wherein, under the general setting, there is a large difference in the number of samples (sample) in each frame (frame) of the SBC and ACC effects: for SBC, typically 1frame 128 sample; for ACC, typically 1frame 1024 sample.
For another example, also SBC, the coding rate is different under different setting parameters. Referring to fig. 10, fig. 10 shows SBC setting parameters (Recommended sections of SBC parameters in the SRC device) Recommended in the sampling frequency converter, and based on different setting parameters, the obtained coding rate, or the number of consumed packets in each frame, is also different.
Typically, the encoding format and encoding rate of the audio data are relatively constant, and accordingly, the value of M is also generally relatively constant.
The value of N is typically related to the size of the bluetooth module's communication packets, e.g., for DH3 communication packets, up to 3 slots (slots) may be covered and contain 185 bytes of information. While DH5 communication packets may cover up to five time slots and contain up to 341 bytes of information. However, there may be a case where a communication packet is lost between the bluetooth modules due to factors such as communication quality. Thus, N is generally an unstable value, that is: in the time interval from the previous frame to the current frame, the value of N can be obtained; while the value of N is usually difficult to predict in the time interval from the current frame to the next frame.
In combination with the above description, in the current decoding time point and the time point before the current decoding time point, the first data amount in the audio buffer is acquirable; accordingly, a first data change characteristic may also be obtained, and in general, the first data change characteristic may be represented by a trend of the first data amount over time.
In this embodiment, the first data change characteristic may be a change trend of the first data amount over time in the first time period. As for the first period of time, it may be set in advance. For example, the first duration may include a decoding time point of Q audio data frames before a current decoding time point, and Q may be an integer greater than 1. Of course, the first time period may be selected as needed.
It is readily understood that the first data variation characteristic may actually be used to characterize a variation trend of the communication quality between the first headset and the terminal device. For example, when the first data volume is kept unchanged in the first time period as a whole, or the first data volume has a roughly ascending trend in the first time period, it may be said that the communication quality between the first earphone and the terminal device is better at present; conversely, if the first data amount continuously decreases for the first time period or shows a tendency of overall decrease and indicates that it is about to fall below a certain set value, the communication quality between the first earphone and the terminal device may be considered to be poor.
In other words, in this embodiment, the first data amount, that is, the data amount of the audio data in the first headphone audio buffer, may be monitored. Whether the data transmitted by the current Bluetooth module is stable or not can be reflected from the side surface by the dynamic change of the first data quantity; if the first data volume has the characteristics of descending trend and the like, which indicates that the communication quality between the first earphone and the terminal equipment is poor at present, the bluetooth communication may have a data packet dropping process, and the retransmission audio data is difficult to compensate for the dropped packet quantity.
It is easy to understand that when the communication quality between the first earphone and the terminal device is poor, it may be necessary to further determine whether to switch between the master earphone and the slave earphone. Whether the master earphone and the slave earphone are switched or not can be judged by combining a first target condition, and the first target condition can be regarded as a master earphone and slave earphone switching condition to a certain extent.
The first target condition may be preset, and for example, the first target condition may be that the first data amount decreases sequentially within a certain period of time, or that the first data change characteristic is considered to satisfy the first target condition when a decrease value of the first data amount within a certain period of time is greater than a certain threshold.
Of course, in practical applications, the first data change characteristic may also be only used as a factor for determining whether to switch between master and slave earphones. That is, the first target condition described above may be only a component of the master-slave headset switching condition. For example, when the first data change characteristic indicates that the first data amount decreases in sequence, the RSSI of the second earphone, the holding time for the first earphone to be held as the master earphone, or the like may be further considered. In other words, the master-slave earphone switching condition may be set according to actual needs, and is not specifically limited herein.
Based on the above description, in the present embodiment, when the first data change characteristic satisfies the first target condition, the second earphone may be directly switched to the master earphone, and the first earphone may be switched to the slave earphone; or further combining other judgment results to switch the master earphone and the slave earphone.
The switching of the second earphone to the master earphone and the switching of the first earphone to the slave earphone may be to establish a Link connection channel between the second earphone and the terminal device, and the first earphone may establish a Sniff listening channel.
The earphone control method provided by the embodiment of the application can be applied to a wireless earphone comprising a first earphone and a second earphone, under the condition that the first earphone is a main earphone and the second earphone is not a slave earphone, the change characteristic of first data in an audio cache of the first earphone within a first time span is obtained, and under the condition that the change characteristic of the first data meets a first target condition, the second earphone is switched to the main earphone, and the first earphone is switched to the slave earphone. In the embodiment of the application, the change characteristic of the first data can reflect the actual communication quality between the first earphone and the terminal device, and the switching between the master earphone and the slave earphone is performed under the condition that the change characteristic of the first data meets the first target condition, so that the reasonability of the switching time can be effectively ensured, and the stability of audio data transmission is improved.
In one example, the determination of whether the master earphone and the slave earphone need to be switched may be further performed in a case where the first data change characteristic satisfies the first target condition. The first target condition described above may include: the P first data volumes are reduced in sequence;
correspondingly, in step 701, acquiring a first data change characteristic of the first earphone in the first time period may include:
acquiring a first data volume in an audio buffer of a first earphone according to a first period;
and determining a first data change characteristic according to P first data quantities sequentially collected in time sequence in a first time length, wherein P is an integer larger than 1.
As indicated above, there may be a decoding time for the audio data in the audio buffer, and in one example, the first period may be determined based on the decoding time, e.g., the first period may be equal to the decoding time. Of course, in practical applications, there may be no direct connection between the first period and the decoding time, and the first period may be any preset value.
In general, the first duration may be a historical period of time that includes a current time and backtracking with respect to the current time. In a first time period, acquiring a plurality of first data volumes based on a first period; as indicated above, the first amount of data may refer to an amount of data of audio data in the audio buffer. Each time the first data volume is collected, the application collection time or the serial number for representing the collection time sequence can be used, so that the first data volumes can be sequenced according to the time sequence, and the change characteristics of the first data can be further determined.
In this example, the first target condition may mean that the P first data amounts decrease in sequence. In other words, the first target condition may be regarded as the data amount of the audio data in the audio buffer gradually decreasing. When the first data change characteristic meets the first target condition, it can be shown that the current bluetooth communication has a packet dropping process all the time, and the retransmission cannot compensate the number of dropped packets. In this case, it is possible to further determine whether or not to switch between the master and slave earphones.
Since the P first data volumes are sequentially reduced, the current situation of poor communication quality can be directly represented; therefore, the example can further judge whether to switch the master earphone and the slave earphone under the condition that the communication quality between the first earphone and the terminal equipment is poor, and is beneficial to ensuring the reasonability of the switching time; meanwhile, the situation that switching is too frequent due to the fact that the RSSI is used as the basis for switching the master earphone and the slave earphone is avoided.
Of course, as indicated above, the first target condition may also be set according to actual needs, for example: the overall first data volume in a certain time period is in a descending trend through numerical value filtering or curve fitting judgment; or, in the first time period, the decrement of the first data volume is larger than a certain threshold; alternatively, the average value of the first data amount of the first half of the first period of time is larger than the average value of the first data amount of the second half of the first period of time, and so on.
Referring to fig. 11, a process for determining a master-slave headset switching timing based on a first data change characteristic is described below with reference to a specific application. The application example may specifically include:
in step 1101, the encoding format and encoding parameters of the Audio data under the current link of the bluetooth Audio Distribution Profile (A2 DP) are determined.
The encoding format is usually fixed, and different encoding formats can be respectively denoted as encoding format a, encoding format B, … …, and encoding format X;
1102, calculating the data volume M of the audio data packet consumed by each frame during decoding according to the encoding parameters;
step 1103, reading the data amount Xn of the audio data packet in the current audio buffer;
for simplicity of description, the data amount of the audio data packets in the audio buffer may be referred to as buffer size;
step 1104, comparing the size (Xn-Xn-1) of the buffer size at the previous frame time point;
step 1105, determining whether (Xn-1) in the continuous a frame period is a negative value, if yes, executing step 1106, if no, returning to execute step 1103 until the audio data playing is completed or terminated;
wherein a is a preset numerical value which can be an integer greater than 1;
step 1106, determine whether to switch between master and slave earphones.
Optionally, when the determination result in step 1105 is yes, step 1107 of calculating the maximum coding rate for maintaining the current communication condition may be further executed;
it is readily understood that the coding rate may be one of the coding parameters, and that a change in the coding parameter may affect the value of M. In general, in order to ensure normal playing of audio data, the following relationship needs to be satisfied: N-M is not less than 0 and not less than Xn-Xn-1; where historical and real-time values of N are available, while future values are generally difficult to predict. Based on the historical value and the real-time value, a reference N value can be obtained, based on that N-M is more than or equal to 0, the maximum M value which can ensure the normal playing of the audio data can be obtained, and then the maximum coding rate which can maintain the current communication condition can be calculated.
Thus, based on the step 1107, the normal play of the audio data can be further realized by adjusting the coding rate of the audio data under the condition that the communication condition that the normal play of the audio data cannot be guaranteed by switching the master earphone and the slave earphone; details will be further described below.
In an example, after the data amount Xn of the audio data packet in the audio buffer is obtained, the Xn may be normalized according to a certain mode to obtain a corresponding coefficient, and the obtaining of the first data change characteristic may be performed based on the coefficient.
Optionally, in step 702, when the first data variation characteristic satisfies the first target condition, switching the second earphone to the master earphone and switching the first earphone to the slave earphone may further include:
under the condition that the first data change characteristic meets a first target condition, acquiring first communication signal strength between the second earphone and the terminal equipment within a second time length;
and under the condition that the first communication signal strength meets the first signal strength condition, switching the second earphone to the master earphone and switching the first earphone to the slave earphone.
In this embodiment, in the process of determining that the switching between the master earphone and the slave earphone needs to be performed, in addition to the factor of the first data change characteristic, the first communication signal strength between the second earphone and the terminal device in the second time period may be considered. For example, when the first data change characteristic indicates that the first data amount decreases sequentially within the first time period, it may be further determined whether a master-slave earphone switching condition is satisfied according to the first communication signal strength, that is, whether switching between the master and the slave earphones is currently required.
Specifically, the first communication signal strength may be embodied by the RSSI between the second earphone and the terminal device, and the second time period may be set according to actual needs, for example, the first communication signal strength of the second earphone in the second time period may be only the RSSI of the second earphone at the current time; or RSSI over a certain period of time in history, etc.
In one example, a first signal strength condition may be set for a first communication signal strength, and when the first communication signal strength satisfies the first signal strength condition, the master-slave headset switching condition may be considered satisfied.
The first signal strength condition may correspond to a predetermined signal strength value. Accordingly, the first communication signal strength satisfies the first signal strength condition, which may be that the minimum value of the first communication signal strength of the second headset is greater than the signal strength value at the current time point; it may also be that the minimum or average value of the first communication signal strength of the second headset is greater than the signal strength value over a historical period of time. Of course, in some possible embodiments, the first communication signal strength satisfies the first signal strength condition, which may also mean that the communication signal strength between the second headset and the terminal device is greater than the communication signal strength between the first headset and the terminal device at the current time point.
In other words, the first signal strength condition may be set according to actual needs, and may generally be used to embody that the second headset may establish a higher-quality communication connection with the terminal device, or may establish a relatively higher-quality communication connection with respect to the first headset.
When the first communication signal strength meets the first signal strength condition, in some application examples, it may be considered that a master-slave earphone switching condition is met, and at this time, the first earphone may be switched to a slave earphone, and the second earphone may be switched to a master earphone. The detailed switching principle is not described herein.
It can be seen that, in this embodiment, the first communication signal strength of the second earphone is considered, and when the first communication signal strength meets the first signal strength condition, the switching between the master earphone and the slave earphone is performed, so that it can be ensured to a certain extent that when the second earphone is switched to the master earphone, better communication quality can be provided between the second earphone and the terminal device, and a process of meaningless switching between the master earphone and the slave earphone (for example, when the second earphone is switched to the master earphone, because the RSSI between the second earphone and the terminal device is weaker, it is still difficult to ensure the communication quality with the terminal device) can be effectively avoided, and the rationality of the switching time between the master earphone and the slave earphone is improved.
In order to further improve the rationality of the switching time between the master earphone and the slave earphone, in an optional embodiment, the switching the second earphone to the master earphone and the first earphone to the slave earphone when the first communication signal strength satisfies the first signal strength condition may further include:
under the condition that the first communication signal strength meets a first signal strength condition, acquiring first maintenance time, wherein the first maintenance time is the time for maintaining the first earphone as a main earphone;
and under the condition that the first maintenance time is greater than or equal to the first time threshold value, switching the second earphone to the master earphone and switching the first earphone to the slave earphone.
The first signal strength condition has been exemplified above, and is not described herein again.
It will be readily appreciated that, in general, the first earpiece may maintain a communication connection with the terminal device, i.e. the first earpiece remains the primary earpiece for a period of time. For example, the first headset may always maintain a Link connection channel with the terminal device from the initial connection between the wireless headset and the terminal device; or, at a certain time, after the main earphone is switched from the second earphone to the first earphone, the first earphone always maintains a Link connection channel with the terminal device.
The time for maintaining the first earphone as the primary earphone may be defined as a first maintenance time, and generally, the primary earphone is not switched in a time period corresponding to the first maintenance time. It is easy to understand that, assuming that only RSSI is used as the switching basis of the master and slave earphones, when the switching frequency of the master and slave earphones is fast, the switching mechanism of the master and slave earphones is continuously triggered probably because the communication quality between the first earphone and the second earphone and the terminal device is poor, and at this time, the switching of the master and slave earphones may not solve the problem of communication stability well; on the contrary, when the switching frequency of the master earphone and the slave earphone is relatively slow, it indicates that high-quality communication for a relatively long time can be ensured by switching the master earphone and the slave earphone, and the problem can be solved well by switching the master earphone and the slave earphone, possibly because a certain earphone is influenced by factors such as an interference source and the like, and the communication quality is relatively poor.
Based on the above situation, in this embodiment, the first maintaining time corresponding to the first earphone may be obtained when the first communication signal strength satisfies the first signal strength condition, and the main earphone may be switched to the second earphone when the first maintaining time is greater than or equal to the first time threshold. Therefore, the rationality of the switching time of the master earphone and the slave earphone is effectively improved.
It is to be understood that the first time threshold may be set according to actual needs, and is not limited specifically herein.
Optionally, after obtaining the first communication signal strength of the second headset within the second time period, the headset control method further includes:
generating a first control signal if a second target condition is met; the second target condition includes: the first communication signal strength does not satisfy a first signal strength condition, or the first maintenance time is less than a first time threshold;
sending the first control signal to the terminal equipment;
the first control signal is used for adjusting the coding parameter of the first data.
Based on the comparison of the first data change characteristic and the first target condition, after the judgment process of switching between the master earphone and the slave earphone is triggered, some situations which are not suitable for switching between the master earphone and the slave earphone may occur. For example, the distance between the whole wireless headset and the terminal device may be relatively long, and at this time, the RSSI of the first headset and the RSSI of the second headset may be relatively low, and the communication quality cannot be improved well by switching the master headset and the slave headset; for another example, referring to fig. 6, when the whole wireless headset is in a strong interference source, the communication quality between the first headset and the terminal device and the communication quality between the second headset and the terminal device are both poor, but the switching between the master and slave headsets may be frequently performed based on the buffer size variation trend and the RSSI determination manner, but the switching between the master and slave headsets may not well solve the problem of the sound blocking during audio playing.
To solve the above problem, in the present embodiment, the first communication signal strength may not satisfy the first signal strength condition; or, in the case that the first communication signal strength satisfies the first signal strength condition and the first maintenance time is less than the first time threshold, adjusting the encoding parameter of the audio data.
It will be readily appreciated that the value of M described above may actually be varied by adjustment of the encoding parameters of the audio data. For example, the coding rate of the audio data may be decreased, or the compression ratio of the audio data may be increased, etc., so that the value of M is decreased. At this time, although a certain tone quality is lost, the fluency of audio data playing can be ensured under the condition of keeping the existing communication quality, and the stable communication experience is ensured as much as possible.
Generally, the adjustment of the encoding parameters of the audio data may be performed in the terminal device. Thus, the wireless headset may generate a first control signal that may be used to instruct the terminal device to adjust an encoding parameter of the audio data if it is determined that the first communication signal strength does not satisfy the first signal strength condition, or if it is determined that the first communication signal strength satisfies the first signal strength condition but the first hold time is less than the first time threshold. After the wireless headset sends the first control signal to the terminal device, the terminal device can adjust the encoding parameters of the audio data according to the first control signal.
In order to enable the adjusted coding parameters to better adapt to the current communication quality, in an example, the first control signal may carry adjustment data of the coding parameters, and the adjustment data may be generated according to a first data change characteristic.
For example, the first data change characteristic is characterized by a buffer size decrease at a rate of-2 kb/s, and M may correspond to 6 kb/s; at this time, N is obtained and is kept at about 4 kb/s. In other words, the communication quality at this time may only be able to maintain normal playback of audio data of which the data amount of the consumed data packet is 4kb per second. Accordingly, the adjustment data may correspond to 4kb/s, and the terminal device may determine the adjusted encoding parameters directly according to the adjustment data. Of course, the adjustment data may correspond to-2 kb/s to provide a reference for the terminal device to adjust the encoding parameters. It is easy to understand that, assuming that M and N are data amounts determined according to the decoding period, the value corresponding to kb/s may be a ratio of M to the decoding period or a ratio of N to the decoding period.
Similarly, with the above example, it is easy to understand that, when the first control signal carries the adjustment data, the terminal device may directly reduce the data consumption rate corresponding to M to less than 4kb/s by adjusting the encoding parameter, and does not need to adjust the encoding parameter again after reducing to 5kb/s and still failing to meet the requirement of stable playing of the audio data under the communication quality; and then can improve earphone control efficiency.
Optionally, in step 701, when the first earphone is a master earphone and the second earphone is a slave earphone, after the first data change characteristic of the first earphone in the first time period is obtained, the earphone control method further includes:
under the condition that the first data change characteristic does not meet the first target condition, acquiring the strength of a second communication signal between the first earphone and the terminal equipment within a third time length;
and under the condition that the second communication signal strength meets the second signal strength condition, the transmission rate of the first data between the first earphone and the terminal equipment is improved.
It is assumed that the first data variation characteristic matches a first target condition, and the first target condition is that the P first data amounts are sequentially decreased. When the first data variation characteristic does not satisfy the first target condition, the P first data amounts are not sequentially decreased, and may fluctuate around a certain value, or increase in the whole, for example. In these cases, it may generally be indicated that the first earphone is in a better communication state with the terminal device, or in a communication state that may still ensure normal playing of the audio data. At this time, it can be considered that the master-slave earphone switching condition is not satisfied
In this embodiment, the second communication signal strength between the first earphone and the terminal device at each time point, for example, the RSSI between the first earphone and the terminal device, may be monitored; in the case that the first data change characteristic does not satisfy the first target condition, the second communication signal strength in the third time period may be called, or the change trend of the second communication signal strength may be further obtained according to the change of the second communication signal strength with time. The selection manner of the third duration may be the same as or similar to the selection manner of the first duration, and is not described herein again.
Based on the trend of the second communication signal strength, for example, based on the trend of the RSSI between the first earphone and the terminal device, it can be determined that the RSSI specifically decreases, increases or remains stable as a whole in a certain period of time. When the RSSI continuously decreases in the period of time, it indicates that there is a high probability that the communication quality between the first earphone and the terminal device is deteriorated; when the communication quality is lower than a good communication threshold, there may be a need to perform a master-slave headset switching judgment.
In one example, the second signal strength condition may mean that the strength of the second communication signal decreases sequentially within a third time period; of course, in practical applications, the second signal strength condition may also be that the corresponding second communication signal strength is smaller than the second signal strength threshold, and so on.
In order to have sufficient buffer size to ensure the continuity of audio data playing when performing the switching determination of the master and slave earphones, in this embodiment, the transmission rate of audio data between the terminal equipment and the first earphone may be increased when the RSSI between the first earphone and the terminal equipment has a downward trend or is lower than the second signal strength threshold, and the buffer size may be supplemented before the communication quality is lower than the good communication threshold, so as to provide sufficient time for subsequent processes such as the determination of the buffer size change trend.
In an example, the above implementation of increasing the transmission rate of the audio data between the terminal device and the first earphone in the case that the communication signal strength variation trend is characterized in that the second communication signal strength of the first earphone decreases may be that the wireless earphone generates a control signal and transmits the control signal to the terminal device in the case that the second communication signal strength of the first earphone is determined to decrease, and the terminal device increases the transmission rate of the audio data according to the first control signal. Of course, it is also possible to relieve the limitation of the transmission rate of the audio data in the first headphone, and the like.
Referring to fig. 12, fig. 12 is a flowchart illustrating a practical application example of the earphone control method provided by the embodiment of the present application. In this application example, the terminal device may be a mobile phone, and accordingly, the earphone control method may specifically include:
step 1201, monitoring the current buffer data;
monitoring the data volume of the audio data packet in the current audio buffer;
step 1202, judging whether the size of the buffer data in the continuous a frame period is reduced, if not, executing step 1203; if yes, go to step 1205;
step 1203, judging whether the signal strength RSSI of the current main earphone and the mobile phone has a descending trend, if so, executing step 1204; if not, returning to the step 1201;
step 1204, accelerate the transmission rate in order to obtain greater buffer space, reserve more judgment time for the follow-up judgement whether to carry on the switching of the master earphone and slave earphone and course of switching over;
step 1205, judging whether the signal strength RSSI of the current slave earphone and the mobile phone is stable within a good threshold value, if so, executing step 1206; if not, go to step 1208;
step 1206, determining whether a master-slave earphone switching event has occurred within a period of time t, if yes, executing step 1208; if not, go to step 1207;
step 1207, switching between a master earphone and a slave earphone;
namely, switching the slave earphone to be the master earphone and switching the master earphone to be the slave earphone;
step 1208, calculating the highest coding rate capable of maintaining stable playing according to the variation rate of the buffer size; then, a target coding rate is set, and a stable communication experience is obtained by losing the sound quality.
Based on the practical application example, the embodiment of the application can realize effective detection of the TWS communication environment, can synthesize the signal strength (such as RSSI) and buffer data size (buffer size) to perform early warning, and performs communication main body, namely switching of the master earphone and the slave earphone or readjustment of coding parameters in time before the user can perceive defects such as jamming, so that stable communication and audio playing processes are obtained, and the listening experience of the user is improved.
In an optional embodiment, in order to reduce the audio playback delay and enable the user to obtain a better listening experience, after acquiring the first data variation characteristic of the first earphone within the first time period in the case that the first earphone is the master earphone and the second earphone is the slave earphone, the earphone control method may further include:
under the condition that the first data change characteristic does not meet a first target condition, acquiring a current coding parameter of the first data and a retention amount of the first data in an audio cache of the first earphone;
determining a target coding parameter according to the current coding parameter, the retention amount and the first data change characteristic;
and sending a second control signal carrying the target coding parameter to the terminal equipment, wherein the second control signal is used for adjusting the coding parameter of the first data to the target coding parameter.
For example, based on the current encoding parameters, the amount of data (which may correspond in value to the ratio of M to decoding time) of a packet in the audio buffer consumed per second is 6 kb; according to the first data change characteristic, the remaining amount (which may be referred to as buffer size, corresponding to the first data amount in the foregoing) of the data packets in the current audio buffer is small, and remains stable within the first time duration, which indicates that the playing delay of the audio may be maintained in a low state at this time. If the value of M is increased by changing the encoding parameter value of the audio data, the number of data packets consumed per second is correspondingly increased, and the value of N is approximately unchanged due to the limitation of the communication quality between the terminal equipment and the main earphone, then a subsequent tone jamming phenomenon may occur, or a judgment process for triggering the switching time of the main earphone and the auxiliary earphone is triggered; conversely, if the value of M is decreased, the buffer size will be increased accordingly, the delay will be increased, and the audio quality will be lost, and the current communication conditions will be wasted.
Therefore, in the normal transmission process of audio data between the main earphone and the terminal equipment, a reasonable M value can be determined by adjusting the coding parameters, so that the balance among the playing delay, the playing tone quality and the communication quality can be achieved.
It is easy to understand that if the retention amount is consistently kept at 0 on the basis of normal playing of the audio data, the playing delay of the audio data can be minimized; however, in practical applications, the influence of factors such as a communication environment may require a certain amount of remaining in the audio buffer, and may be determined according to factors such as the first data change characteristic.
In this embodiment, a reasonable target encoding parameter may be determined based on the current encoding parameter, the retention amount, and the first data change characteristic, so that the retention amount of the audio data in the audio buffer is in a relatively stable state in the audio playing process.
The target encoding parameter may be sent to the terminal device by the wireless headset, and specifically, the wireless headset may send the second control signal carrying the target encoding parameter to the terminal device, so that the terminal device adjusts the encoding parameter of the audio data to the target encoding parameter. The specific types and adjustment manners of the encoding parameters have been described in the above embodiments, and are not described herein again.
The embodiment can effectively reduce the playing delay of the audio data and improve the listening experience of the user on the basis of ensuring the normal playing of the audio data in the current communication environment.
It should be noted that, in the earphone control method provided in the embodiment of the present application, the execution main body may be an earphone control device, or a control module in the earphone control device for executing the earphone control method. In the embodiment of the present application, an example in which an earphone control device executes an earphone control method is taken as an example, and the earphone control device provided in the embodiment of the present application is described.
Fig. 13 is a schematic structural diagram of an earphone control device according to an embodiment of the present application. The headphone control apparatus 1300 may include:
a first obtaining module 1301, configured to obtain a first data change characteristic of the first earphone within a first time duration when the first earphone is a master earphone and the second earphone is a slave earphone, where the master earphone is used to connect with the slave earphone and a terminal device, and the first data change characteristic is a change characteristic of first data in an audio buffer of the first earphone;
a switching module 1302, configured to switch the second earphone to the master earphone and switch the first earphone to the slave earphone when the first data change characteristic satisfies the first target condition.
Optionally, the earphone control device 1300 may further include:
the acquiring unit is used for acquiring the first communication signal strength between the second earphone and the terminal equipment within a second time length under the condition that the first data change characteristic meets a first target condition;
and the switching unit is used for switching the second earphone into the master earphone and switching the first earphone into the slave earphone under the condition that the first communication signal strength meets the first signal strength condition.
Optionally, the earphone control device 1300 may further include:
the acquisition subunit is configured to acquire a first holding time when the first communication signal strength meets a first signal strength condition, where the first holding time is a time for the first earphone to remain as a primary earphone;
and the switching subunit is used for switching the second earphone into the master earphone and switching the first earphone into the slave earphone when the first maintenance time is greater than or equal to the first time threshold.
Optionally, the headphone control apparatus 1300 may further include:
a generation module that generates the first control signal when either: the first communication signal strength does not satisfy a first signal strength condition; the first communication signal strength meets a first signal strength condition, and the first maintenance time is less than a first time threshold;
the first sending module is used for sending the first control signal to the terminal equipment;
wherein the first control signal is used for adjusting the encoding parameters of the audio data.
Optionally, the headphone control apparatus 1300 may further include:
the second obtaining module is used for obtaining the second communication signal intensity between the first earphone and the terminal equipment within a third time length under the condition that the first data change characteristic does not meet the first target condition;
and the adjusting module is used for improving the transmission rate of the audio data between the first earphone and the terminal equipment under the condition that the second communication signal strength meets the second signal strength condition.
Optionally, the headphone control apparatus 1300 may further include:
the third obtaining module is used for obtaining the current coding parameters of the audio data and the retention amount of the first data in the audio cache of the first earphone under the condition that the first data change characteristic does not meet the first target condition;
the determining module is used for determining a target coding parameter according to the current coding parameter, the retention amount and the first data change characteristic;
and the second sending module is used for sending a second control signal carrying the target coding parameter to the terminal equipment, and the second control signal is used for adjusting the coding parameter of the audio data to the target coding parameter.
The earphone control device 1300 provided in the embodiment of the present application, can be when the first earphone of the wireless earphone is the master earphone, the second earphone is determined as the slave earphone, the data size change trend of the audio data in the audio buffer of the first earphone is obtained, so as to indirectly obtain the communication quality between the first earphone and the terminal device, and under the condition of poor communication quality, the communication signal strength of the second earphone of the wireless earphone can be combined, or the time of the master earphone and the slave earphone is further combined with the first earphone to maintain, to judge whether to perform the earphone of the master earphone and the slave earphone, thereby being helpful to promote the rationality of the switching time of the master earphone and the slave earphone, ensuring the communication stability between the wireless earphone and the terminal device, and improving the audio playing effect of the wireless earphone. In addition, under the condition that the problem of communication quality is difficult to overcome by switching the master earphone and the slave earphone, the encoding parameters of the audio data can be controlled and adjusted, and the stability of audio playing is favorably ensured.
The earphone control device in the embodiment of the present application may be a device, and may also be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The earphone control device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The earphone control device provided in the embodiment of the present application can implement each process implemented by the earphone control device in the above-mentioned earphone control method embodiment, and is not described here again in order to avoid repetition.
Optionally, as shown in fig. 14, an electronic device 1400 is further provided in this embodiment of the present application, and includes a processor 1401, a memory 1402, and a program or an instruction stored in the memory 1402 and executable on the processor 1401, where the program or the instruction is executed by the processor 1401 to implement each process of the above-mentioned embodiment of the earphone control method, and can achieve the same technical effect, and no further description is provided here to avoid repetition.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and the non-mobile electronic devices described above.
Fig. 15 is a hardware configuration diagram of an electronic device implementing an embodiment of the present application.
The electronic device 1500 includes, but is not limited to: a radio frequency unit 1501, a network module 1502, an audio output unit 1503, an input unit 1504, a sensor 1505, a display unit 1506, a user input unit 1507, an interface unit 1508, a memory 1509, and a processor 1510.
Those skilled in the art will appreciate that the electronic device 1500 may also include a power supply (e.g., a battery) for powering the various components, which may be logically coupled to the processor 1510 via a power management system to perform functions such as managing charging, discharging, and power consumption via the power management system. The electronic device structure shown in fig. 15 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 1510 is configured to, when the first earphone is a master earphone and the second earphone is a slave earphone, obtain a first data change characteristic of the first earphone within a first time duration, where the master earphone is used to connect with the slave earphone and a terminal device, respectively, and the first data change characteristic is a change characteristic of first data in an audio buffer of the first earphone;
and under the condition that the first data change characteristic meets a first target condition, switching the second earphone to the master earphone and switching the first earphone to the slave earphone.
The electronic device 1500 provided by the embodiment of the application can obtain the communication quality between the first earphone and the terminal device based on the first data change characteristic, and performs the switching between the master earphone and the slave earphone under the condition that the first data change characteristic meets the first target condition, so that the rationality of the switching time of the master earphone and the slave earphone can be effectively ensured, and the stability of audio data transmission is improved.
Optionally, the processor 1510 may be further configured to:
under the condition that the first data change characteristic meets a first target condition, acquiring first communication signal strength between the second earphone and the terminal equipment within a second time length;
and under the condition that the first communication signal strength meets the first signal strength condition, switching the second earphone to the master earphone and switching the first earphone to the slave earphone.
Optionally, the processor 1510 may be further configured to:
under the condition that the first communication signal strength meets a first signal strength condition, acquiring first maintenance time, wherein the first maintenance time is the time for maintaining the first earphone as a main earphone;
and under the condition that the first maintenance time is greater than or equal to the first time threshold value, switching the second earphone to the master earphone and switching the first earphone to the slave earphone.
Optionally, the processor 1510 may be further configured to:
after obtaining the first communication signal strength of the second headset within the second time period, generating a first control signal in any of: the first communication signal strength does not satisfy a first signal strength condition; the first communication signal strength meets a first signal strength condition, and the first maintenance time is less than a first time threshold;
accordingly, the radio frequency unit 1501 may be configured to transmit the first control signal to the terminal device;
wherein the first control signal is used for adjusting the encoding parameters of the audio data.
Optionally, the processor 1510 may be further configured to:
in the case that the first earphone is the master earphone and the second earphone is the slave earphone, after acquiring the first data change characteristic of the first earphone in the first time period,
under the condition that the first data change characteristic does not meet the first target condition, acquiring the strength of a second communication signal between the first earphone and the terminal equipment within a third time length;
and under the condition that the second communication signal strength meets the second signal strength condition, the transmission rate of the audio data between the first earphone and the terminal equipment is improved.
Optionally, the processor 1510 may be further configured to:
under the condition that the first data change characteristic does not meet a first target condition, acquiring a current coding parameter of the audio data and a retention amount of first data in an audio cache of the first earphone;
determining a target coding parameter according to the current coding parameter, the retention amount and the first data change characteristic;
accordingly, the radio frequency unit 1501 may be configured to send a second control signal carrying the target encoding parameter to the terminal device, where the second control signal is used to adjust the encoding parameter of the audio data to the target encoding parameter.
It should be understood that in the embodiment of the present application, the input Unit 1504 may include a Graphics Processing Unit (GPU) 15041 and a microphone 15042, and the Graphics processor 15041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 1506 may include a display panel 15061, and the display panel 15061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1507 includes a touch panel 15071 and other input devices 15072. A touch panel 15071, also referred to as a touch screen. The touch panel 15071 may include two parts of a touch detection device and a touch controller. Other input devices 15072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 1509 may be used to store software programs as well as various data including, but not limited to, application programs and an operating system. The processor 1510 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 1510.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the embodiment of the earphone control method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device in the above embodiment. Readable storage media, including computer-readable storage media, such as Read-Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, etc.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the embodiment of the earphone control method, and the same technical effect can be achieved.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method of the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A headset control method is applied to a wireless headset which comprises a first headset and a second headset, and is characterized by comprising the following steps:
when the first earphone is a master earphone and the second earphone is a slave earphone, acquiring a first data change characteristic of the first earphone within a first time length, wherein the master earphone is used for being connected with the slave earphone and a terminal device respectively, and the first data change characteristic is a change characteristic of first data in an audio cache of the first earphone;
and under the condition that the first data change characteristic meets a first target condition, switching the second earphone to a master earphone and switching the first earphone to a slave earphone.
2. The method of claim 1, wherein switching the second earphone to a master earphone and the first earphone to a slave earphone in the case that the first data variation characteristic satisfies a first target condition further comprises:
under the condition that the first data change characteristic meets a first target condition, acquiring first communication signal strength between the second earphone and the terminal equipment within a second time length;
and under the condition that the first communication signal strength meets a first signal strength condition, switching the second earphone to a master earphone and switching the first earphone to a slave earphone.
3. The method of claim 2, wherein switching the second headset to a master headset and the first headset to a slave headset if the first communication signal strength satisfies a first signal strength condition further comprises:
acquiring a first maintenance time when the first communication signal strength meets a first signal strength condition, wherein the first maintenance time is the time for maintaining the first earphone as the main earphone;
and under the condition that the first maintenance time is greater than or equal to a first time threshold value, switching the second earphone to a master earphone and switching the first earphone to a slave earphone.
4. The method of claim 3, wherein after obtaining the first communication signal strength of the second headset for the second duration, the method further comprises:
generating a first control signal if a second target condition is met; the second target condition includes: the first communication signal strength does not satisfy the first signal strength condition, or the first maintenance time is less than the first time threshold;
sending the first control signal to the terminal equipment;
wherein the first control signal is used for adjusting the encoding parameter of the first data.
5. The method of claim 1, wherein after obtaining the first data change characteristic for the first headset for the first duration in the case where the first headset is a master headset and the second headset is a slave headset, the method further comprises:
under the condition that the first data change characteristic does not meet the first target condition, acquiring second communication signal intensity of the first earphone and the terminal equipment within a third time length;
and under the condition that the second communication signal strength meets a second signal strength condition, the transmission rate of first data between the first earphone and the terminal equipment is improved.
6. The method of claim 1, wherein after obtaining the first data change characteristic for the first headset for the first duration in the case where the first headset is a master headset and the second headset is a slave headset, the method further comprises:
under the condition that the first data change characteristic does not meet the first target condition, acquiring a current coding parameter of the first data and a retention amount of the first data in an audio buffer of the first earphone;
determining a target coding parameter according to the current coding parameter, the remaining amount and the first data change characteristic;
and sending a second control signal carrying the target coding parameter to the terminal equipment, wherein the second control signal is used for adjusting the coding parameter of the first data to the target coding parameter.
7. An earphone control device applied to a wireless earphone, wherein the wireless earphone comprises a first earphone and a second earphone, the device comprises:
a first obtaining module, configured to obtain a first data change characteristic of the first earphone within a first time duration when the first earphone is a master earphone and the second earphone is a slave earphone, where the master earphone is used to connect with the slave earphone and a terminal device, respectively, and the first data change characteristic is a change characteristic of first data in an audio buffer of the first earphone;
and the switching module is used for switching the second earphone into a master earphone and switching the first earphone into a slave earphone under the condition that the first data change characteristic meets a first target condition.
8. The apparatus of claim 7, wherein the switching module comprises:
the obtaining unit is used for obtaining the first communication signal strength between the second earphone and the terminal equipment within a second time length under the condition that the first data change characteristic meets a first target condition;
and the switching unit is used for switching the second earphone into the master earphone and switching the first earphone into the slave earphone under the condition that the first communication signal strength meets a first signal strength condition.
9. A terminal device, characterized in that the terminal device comprises: a processor, a memory and a program or instructions stored on the memory and executable on the processor, which when executed by the processor, implement the steps of the headset control method according to any of claims 1 to 6.
10. A readable storage medium, characterized in that the readable storage medium stores thereon a program or instructions which, when executed by a processor, implement the steps of the headphone control method according to any one of claims 1 to 6.
CN202110176992.3A 2021-02-09 2021-02-09 Earphone control method, device, equipment and medium Pending CN112788494A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110176992.3A CN112788494A (en) 2021-02-09 2021-02-09 Earphone control method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110176992.3A CN112788494A (en) 2021-02-09 2021-02-09 Earphone control method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN112788494A true CN112788494A (en) 2021-05-11

Family

ID=75761349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110176992.3A Pending CN112788494A (en) 2021-02-09 2021-02-09 Earphone control method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112788494A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113365257A (en) * 2021-06-04 2021-09-07 华勤技术股份有限公司 Master-slave earphone switching method and device, earphone and readable storage medium
CN113613223A (en) * 2021-06-29 2021-11-05 成都市安比科技有限公司 Master-slave switching method of TWS (time-and-time-shift switching) system, first equipment and second equipment
CN115134429A (en) * 2022-06-28 2022-09-30 恒玄科技(上海)股份有限公司 Audio sharing method and device based on TWS earphone, storage medium and earphone

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106535081A (en) * 2016-12-20 2017-03-22 建荣半导体(深圳)有限公司 Bluetooth mode switching method and device, communication system and stereophonic audio transmission method
US20170208394A1 (en) * 2014-07-18 2017-07-20 Beijing Zhigu Rui Tuo Tech Co., Ltd Channel configuration method and apparatus and user equipment
CN107145330A (en) * 2017-04-26 2017-09-08 歌尔科技有限公司 A kind of method and apparatus for connecting ears bluetooth earphone
CN108323241A (en) * 2018-01-25 2018-07-24 深圳市为通博科技有限责任公司 Principal and subordinate's role transforming method, chip and data transmission system
CN109461450A (en) * 2018-11-01 2019-03-12 恒玄科技(上海)有限公司 Transmission method, system, storage medium and the bluetooth headset of audio data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170208394A1 (en) * 2014-07-18 2017-07-20 Beijing Zhigu Rui Tuo Tech Co., Ltd Channel configuration method and apparatus and user equipment
CN106535081A (en) * 2016-12-20 2017-03-22 建荣半导体(深圳)有限公司 Bluetooth mode switching method and device, communication system and stereophonic audio transmission method
CN107145330A (en) * 2017-04-26 2017-09-08 歌尔科技有限公司 A kind of method and apparatus for connecting ears bluetooth earphone
CN108323241A (en) * 2018-01-25 2018-07-24 深圳市为通博科技有限责任公司 Principal and subordinate's role transforming method, chip and data transmission system
CN109461450A (en) * 2018-11-01 2019-03-12 恒玄科技(上海)有限公司 Transmission method, system, storage medium and the bluetooth headset of audio data

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113365257A (en) * 2021-06-04 2021-09-07 华勤技术股份有限公司 Master-slave earphone switching method and device, earphone and readable storage medium
CN113365257B (en) * 2021-06-04 2023-01-24 华勤技术股份有限公司 Master-slave earphone switching method and device, earphone and readable storage medium
CN113613223A (en) * 2021-06-29 2021-11-05 成都市安比科技有限公司 Master-slave switching method of TWS (time-and-time-shift switching) system, first equipment and second equipment
CN115134429A (en) * 2022-06-28 2022-09-30 恒玄科技(上海)股份有限公司 Audio sharing method and device based on TWS earphone, storage medium and earphone

Similar Documents

Publication Publication Date Title
CN112788494A (en) Earphone control method, device, equipment and medium
US10819766B2 (en) Voice encoding and sending method and apparatus
US10182022B2 (en) Dynamic jitter buffer size adjustment
CN108011686B (en) Information coding frame loss recovery method and device
WO2015058656A1 (en) Live broadcast control method and main broadcast device
US20210337610A1 (en) Wireless communication method, terminal, audio component, device, and storage medium
CN108370580B (en) Matching user equipment and network scheduling periods
CA2742858C (en) Audio/video data play control method and apparatus
KR102201123B1 (en) Signal-aware data transfer in cellular networks
CN111869142B (en) Data transmission method, device, equipment, system and medium
EP2188999A2 (en) Synchronizing remote audio with fixed video
CN111225209B (en) Video data plug flow method, device, terminal and storage medium
US20210029404A1 (en) Systems and methods for reducing latency of a video transmission system
KR101580990B1 (en) Apparatus and method for adaptive audio quality control using bluetooth
CN105472404A (en) Data processing method in video service
WO2021015749A1 (en) Radio frequency condition aware audio buffering
US11445457B2 (en) Content distribution system
WO2022077993A1 (en) Transmission parameter determination method and apparatus and terminal device
US11418559B2 (en) Content distribution system
CN114710804A (en) Data transmission adjusting method and device, electronic equipment and readable storage medium
CN115037416A (en) Data forward error correction processing method, device, electronic equipment and storage medium
CN113035206B (en) Signal processing device, signal processing method, program, and computer-readable medium
US9806967B2 (en) Communication device and data processing method
US8791981B2 (en) Bit rate control apparatus and method thereof
EP2424159A1 (en) Information transmission apparatus, information transmission method, and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination