WO2022222878A1 - 一种音频数据无缝切换方法 - Google Patents

一种音频数据无缝切换方法 Download PDF

Info

Publication number
WO2022222878A1
WO2022222878A1 PCT/CN2022/087331 CN2022087331W WO2022222878A1 WO 2022222878 A1 WO2022222878 A1 WO 2022222878A1 CN 2022087331 W CN2022087331 W CN 2022087331W WO 2022222878 A1 WO2022222878 A1 WO 2022222878A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
playback device
electronic device
audio playback
moment
Prior art date
Application number
PCT/CN2022/087331
Other languages
English (en)
French (fr)
Inventor
刘超
牛翔宇
牛辉
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022222878A1 publication Critical patent/WO2022222878A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/16Performing reselection for specific purposes
    • H04W36/18Performing reselection for specific purposes for allowing seamless reselection, e.g. soft reselection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a method for seamless switching of audio data.
  • Bluetooth Bluetooth
  • a terminal such as a smart phone and an audio playback device (eg, a Bluetooth headset) are connected through Bluetooth, and the smart phone can transmit audio data to the audio playback device.
  • the present application provides a method for seamless switching of audio data, which realizes that when an electronic device switches the connection of a Bluetooth device, the time delay existing in the switching of the Bluetooth device is considered, and the audio data is not interrupted, and the switching of the Bluetooth device is realized.
  • the audio data playback progress is synchronized when the audio data is played, which improves the user experience.
  • the present application provides a system for seamless switching of audio data
  • the system includes an electronic device, a first audio playback device, and a second audio playback device; the electronic device is used for sending audio data to the first audio playback device; The first audio playback device is used to play audio data; the electronic device is also used to: establish a communication connection with the second audio playback device; send a stop playback instruction and the first audio frame to the first audio playback device; play to the second audio playback device The device sends a start playback instruction and a second audio frame; the first audio playback device is also used to stop playing the audio after the first audio frame is played at the first moment after receiving the stop instruction and the first audio frame sent by the electronic device data; the second audio playback device is also used to start playing the second audio frame at the first moment after receiving the start playback instruction and the two audio frames sent by the electronic device; wherein, the second audio frame is in the first audio frame subsequent adjacent frames.
  • the time delay existing in the switching of the Bluetooth device is considered.
  • the electronic device will send the stop playback instruction and the first audio frame to the first audio playback device, and the electronic device will start The play instruction and the second audio frame are sent to the second audio playback device.
  • the first audio playback device stops playing the audio data after playing the first audio frame at the first moment, and the second audio playback device starts to play the second audio frame just at the first moment.
  • the electronic device sends the start playback instruction and the second audio frame to the second audio playback device, and the electronic device sends the playback start instruction and the second audio frame to the second audio playback device.
  • the first audio playback device stops playing the audio data after the first audio frame is played at the first moment, and the second audio playback device just starts to play the second audio frame at the second moment.
  • the method realizes that when the electronic device switches the connection of the Bluetooth device, the time delay existing when the Bluetooth device is switched is taken into account, and the audio data is not interrupted, and the playback progress of the audio data is synchronized when the Bluetooth device is switched, so that the Play audio data seamlessly, improving user experience.
  • the electronic device is specifically configured to: at the second moment, send a stop playing instruction and the first audio frame to the first audio playback device; at the third moment, send the second audio frame to the second
  • the audio playback device sends a start playback instruction and a second audio frame; wherein, the difference between the first moment and the second time shown is the first playback delay of the first audio playback device, and the difference between the first moment and the third moment is the second playback delay of the second audio playback device; the difference between the second moment and the third moment is the first value, and the delay difference between the first playback delay and the second playback delay is the first value.
  • the first playback delay of the first audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the first audio playback device plays the first audio frame. This period of time is the duration of the first audio playback device.
  • the second playback delay of the second audio playback device starts timing when the second audio frame leaves the electronic device, and stops timing until the second audio playback device plays the second audio frame. This period of time is the second time of the second audio playback device.
  • the first playback delay includes the Bluetooth transmission delay of the first audio device, the decoding delay of the first audio device, and the hardware delay of the first audio device.
  • the second playback delay includes the Bluetooth transmission delay of the second audio device, the decoding delay of the second audio device, and the hardware delay of the second audio device.
  • the present application provides another audio data seamless switching system.
  • the system includes an electronic device, a first audio playback device, and a second audio playback device; the electronic device is used for sending audio data to the first audio playback device. ; A first audio playback device for playing audio data.
  • the electronic device is further used to: establish a communication connection with the second audio playback device; when the first playback delay of the first audio playback device is less than the second playback delay of the second audio playback device, send the message to the first audio playback device the first instruction and the first audio frame; send the second instruction and the first audio frame to the second audio playback device; the first audio playback device is also used for after receiving the first instruction and the first audio frame sent by the electronic device , play the first audio frame with the volume decreasing at the first moment, and stop playing the audio data at the second moment; the second audio playback device is also used for, after receiving the second instruction and the first audio frame sent by the electronic device, at the first At the second time, the volume is increased to play the first audio frame.
  • the volume decrease may be a linear reduction of the volume, or a reduction of the volume gradient, and the volume is not reduced after the volume is reduced to a preset value, or the volume is not reduced after a certain period of time.
  • the volume increase may be a linear increase of the volume, or an increase of the volume gradient, and the volume is not increased after the volume is increased to a preset value, or the volume is not increased after a certain period of time.
  • the present application does not limit the manner of decreasing the volume and increasing the volume.
  • the time delay existing when the Bluetooth device is switched is considered, and there is audio data played repeatedly between the two devices.
  • the audio data played repeatedly is played by decreasing the volume of the first audio playback device, and the repeated audio data is played by increasing the volume of the second audio playback device. The problem of repeated playback has been solved and the audio data can be played without interruption.
  • the electronic device when the first playback delay of the first audio playback device is greater than the second playback delay of the second audio playback device, the electronic device is further configured to: send the first audio The playback device sends the first instruction and the first audio frame; and sends the second instruction and the first audio frame to the second audio playback device.
  • the first audio playback device is further configured to play the first audio frame in a decreasing volume at the fourth moment after receiving the first instruction and the first audio frame sent by the electronic device, and stop playing the audio after the first audio frame is played data;
  • the second audio playback device is further configured to play the first audio frame with increasing volume at a fourth moment after receiving the second instruction and the first audio frame sent by the electronic device.
  • the volume decrease may be a linear reduction of the volume, or a reduction of the volume gradient, and the volume is not reduced after the volume is reduced to a preset value, or the volume is not reduced after a certain period of time.
  • the volume increase may be a linear increase of the volume, or an increase of the volume gradient, and the volume is not increased after the volume is increased to a preset value, or the volume is not increased after a certain period of time.
  • the present application does not limit the manner of decreasing the volume and increasing the volume.
  • the electronic device sends the first instruction and the first audio frame to the first audio playback device, and the electronic device sends the first instruction and the first audio frame to the first audio playback device.
  • the second instruction and the first audio frame are sent to the second audio playback device.
  • the first audio playback device stops playing the audio data after finishing playing the first audio frame, and the second audio playback device just starts to play the first audio frame. That is, the audio data repeatedly played by the first audio playback device and the second audio playback device is the first audio frame.
  • the first audio frame is played by decreasing the volume of the first audio playback device, and the first audio frame is played by increasing the volume of the second audio playback device.
  • the problem of repeated playback has been solved to achieve non-interrupted playback. audio data.
  • the present application provides a method for seamless switching of audio data.
  • the method includes: an electronic device sends audio data to a first audio playback device, and the audio data is played by the first audio playback device. Afterwards, the electronic device does not disconnect the connection with the first audio playback device and establishes a communication connection with the second audio playback device, after which the electronic device sends a stop playback instruction and the first audio frame to the first audio playback device; wherein, the stop playback instruction is used for Instruct the first audio playback device to stop playing the audio data after receiving the stop playback instruction and the first audio frame sent by the electronic device, and stop playing the audio data after the first audio frame is played at the first moment; the electronic device sends the second audio playback device to start playing The instruction and the second audio frame; wherein, the start playing instruction is used to instruct the second audio playing device to start playing the second audio frame at the first moment after receiving the start playing instruction and the second audio frame sent by the electronic device.
  • the second audio frame is an adjacent frame after the
  • the time delay existing in the switching of the Bluetooth device is considered.
  • the electronic device will send the stop playback instruction and the first audio frame to the first audio playback device, and the electronic device will start The play instruction and the second audio frame are sent to the second audio playback device.
  • the first audio playback device stops playing the audio data after playing the first audio frame at the first moment, and the second audio playback device starts to play the second audio frame just at the first moment.
  • the electronic device sends the start playback instruction and the second audio frame to the second audio playback device, and the electronic device sends the playback start instruction and the second audio frame to the second audio playback device.
  • the first audio playback device stops playing the audio data after the first audio frame is played at the first moment, and the second audio playback device just starts to play the second audio frame at the second moment.
  • the method realizes that when the electronic device switches the connection of the Bluetooth device, the time delay existing when the Bluetooth device is switched is taken into account, and the audio data is not interrupted, and the playback progress of the audio data is synchronized when the Bluetooth device is switched, so that the Play audio data seamlessly, improving user experience.
  • the electronic device at the second moment, sends a stop playback instruction and the first audio frame to the first audio playback device; at the third moment, sends to the second audio playback device Start playing the instruction and the second audio frame; wherein, the difference between the first moment and the second moment is the first playback delay of the first audio playback device, and the difference between the first moment and the third moment is the second audio
  • the second playback delay of the playback device the difference between the second moment and the third moment is the first value, and the delay difference between the first playback delay and the second playback delay is the first value.
  • the first playback delay of the first audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the first audio playback device plays the first audio frame. This period of time is the duration of the first audio playback device.
  • the second playback delay of the second audio playback device starts timing when the second audio frame leaves the electronic device, and stops timing until the second audio playback device plays the second audio frame. This period of time is the second time of the second audio playback device.
  • the first playback delay includes the Bluetooth transmission delay of the first audio device, the decoding delay of the first audio device, and the hardware delay of the first audio device.
  • the second playback delay includes the Bluetooth transmission delay of the second audio device, the decoding delay of the second audio device, and the hardware delay of the second audio device.
  • the electronic device disconnects from the first audio playback device when it stops playing audio data after the first audio playback device finishes playing the first audio frame. In this way, when the electronic device establishes the connection with the second audio data, it does not disconnect the connection with the first audio playback device.
  • the electronic device is disconnected from the first audio playback device, in order to achieve seamless playback of the audio data provided the possibility.
  • the first playback time delay when the first playback time delay is greater than the second playback time delay, the first time is prior to the second time; when the first playback time delay is smaller than the second playback time delay , the second moment precedes the first moment.
  • the time for the first audio playback device to receive one frame of audio data frame and to play the one frame of audio data frame is longer than the time for the second audio playback device to receive one frame of audio data frame and play out the frame of audio data, in order to make the first audio playback device just stop playing the audio data, and the second audio playback device just start playing the audio data, so the electronic device needs to send the second audio playback device to the second audio playback device.
  • the second audio playback Before starting the playback instruction and the second audio frame, send the stop playback instruction and the first audio frame to the first audio playback device. After the playback delay difference between the first audio playback device and the second audio playback device, the second audio playback The device receives a start playback instruction and a second audio frame.
  • the time for the first audio playback device to receive one frame of audio data frame and to play the one frame of audio data frame is less than the time for the second audio playback device to receive one frame of audio data frame and play out the frame of audio data, in order to make the first audio playback device just stop playing the audio data, and the second audio playback device just start to play the audio data, so the electronic device needs to send the first audio playback device to the first audio playback device.
  • the start playback instruction and the second audio frame Before stopping the playback instruction and the first audio frame, send the start playback instruction and the second audio frame to the second audio playback device.
  • the first audio playback The device receives the stop playback instruction and the first audio frame.
  • the electronic device after the electronic device establishes a communication connection with the second audio playback device, the electronic device starts to send a stop instruction to the first audio playback device or sends a start instruction to the second audio playback device. Before the instruction, the electronic device also needs to calculate the playback delay of the first audio playback device and the second audio playback device. Specifically, the electronic device sends the first test data to the first audio playback device, and sends the second test data to the second audio playback device. The electronic device receives the first information including the fourth moment and the fifth moment sent by the first audio playback device; wherein, the fourth moment is the moment when the first test data leaves the electronic device, and the fifth moment is the first audio playback device.
  • the electronic device receives the second information that includes the sixth moment and the seventh moment sent by the second audio playback device; wherein, the sixth moment is the moment when the second test data leaves the electronic device, and the seventh moment
  • the electronic device determines the first playback delay, which is the difference between the fifth moment and the fourth moment
  • the electronic device determines the second playback delay , and the second playback delay is the difference between the seventh moment and the sixth moment.
  • the electronic device can calculate the playback delay of the first audio playback device and the playback delay of the second audio playback device.
  • the playback delay of the second audio playback device is stored in the electronic device, and thereafter, the electronic device does not need to recalculate the playback delay of the first audio playback device and the playback delay of the second audio playback device each time.
  • the present application provides another method for seamless switching of audio data.
  • the method includes: the electronic device sends audio data to a first audio playback device, and the audio data is played by the first audio playback device; the electronic device communicates with the first audio playback device. Two audio playback devices establish a communication connection.
  • the electronic device sends the first instruction and the first audio frame to the first audio playback device, and sends the first instruction and the first audio frame to the second audio playback device. Send the second command and the first audio frame.
  • the first instruction is used to instruct the first audio playback device to play the first audio frame in a decreasing volume at the first moment after receiving the first instruction and the first audio frame sent by the electronic device, and stop playing the audio data at the second moment.
  • the second instruction is used to instruct the second audio playback device to play the first audio frame with increasing volume at the second moment after receiving the second instruction and the first audio frame sent by the electronic device.
  • the volume decrease may be a linear reduction of the volume, or a reduction of the volume gradient, and the volume is not reduced after the volume is reduced to a preset value, or the volume is not reduced after a certain period of time.
  • the volume increase may be a linear increase of the volume, or an increase of the volume gradient, and the volume is not increased after the volume is increased to a preset value, or the volume is not increased after a certain period of time.
  • the present application does not limit the manner of decreasing the volume and increasing the volume.
  • the time delay existing when the Bluetooth device is switched is considered, and there is audio data played repeatedly between the two devices.
  • the audio data played repeatedly is played by decreasing the volume of the first audio playback device, and the repeated audio data is played by increasing the volume of the second audio playback device. The problem of repeated playback has been solved and the audio data can be played without interruption.
  • the electronic device further sends a second audio frame to the first audio playback device
  • the first instruction is further used to instruct the first audio playback device to receive the first audio frame sent by the electronic device. After the instruction and the first audio frame, after the first audio frame is played with the volume decreasing at the first moment, the audio data is stopped after the second audio frame is played at the second moment.
  • the electronic device is specifically configured to: at the third moment, the electronic device sends the first audio playback device to the first audio playback device. an instruction and the first audio frame; at the third moment, send the second instruction and the first audio frame to the second audio playback device; wherein, the difference between the first moment and the third moment is the first audio playback device a playback delay, the difference between the second moment and the third moment is the second playback delay of the second audio playback device; the difference between the second moment and the first moment is the first value, the first playback delay and the first The delay difference between the two playback delays is the first value.
  • the first playback delay of the first audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the first audio playback device plays the first audio frame. This period of time is the duration of the first audio playback device.
  • the second playback delay of the second audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the second audio playback device plays the first audio frame. This period of time is the second time of the second audio playback device. Playback delay.
  • the first audio frame may be audio data during a real-time call or playing music or video.
  • the first playback delay includes the Bluetooth transmission delay of the first audio device, the decoding delay of the first audio device, and the hardware delay of the first audio device.
  • the second playback delay includes the Bluetooth transmission delay of the second audio device, the decoding delay of the second audio device, and the hardware delay of the second audio device.
  • the electronic device when the first playback delay of the first audio playback device is greater than the second playback delay of the second audio playback device, the electronic device is further configured to: send the first audio The playback device sends the first instruction and the first audio frame; and sends the second instruction and the first audio frame to the second audio playback device.
  • the first audio playback device is further configured to play the first audio frame in a decreasing volume at the fourth moment after receiving the first instruction and the first audio frame sent by the electronic device, and stop playing the audio after the first audio frame is played data;
  • the second audio playback device is further configured to play the first audio frame with increasing volume at a fourth moment after receiving the second instruction and the first audio frame sent by the electronic device.
  • the volume decrease may be a linear reduction of the volume, or a reduction of the volume gradient, and the volume is not reduced after the volume is reduced to a preset value, or the volume is not reduced after a certain period of time.
  • the volume increase may be a linear increase of the volume, or an increase of the volume gradient, and the volume is not increased after the volume is increased to a preset value, or the volume is not increased after a certain period of time.
  • the present application does not limit the manner of decreasing the volume and increasing the volume.
  • the electronic device sends the first instruction and the first audio frame to the first audio playback device, and the electronic device sends the first instruction and the first audio frame to the first audio playback device.
  • the second instruction and the first audio frame are sent to the second audio playback device.
  • the first audio playback device stops playing the audio data after finishing playing the first audio frame, and the second audio playback device just starts to play the first audio frame. That is, the audio data repeatedly played by the first audio playback device and the second audio playback device is the first audio frame.
  • the first audio frame is played by decreasing the volume of the first audio playback device, and the first audio frame is played by increasing the volume of the second audio playback device.
  • the problem of repeated playback has been solved to achieve non-interrupted playback. audio data.
  • the first instruction includes an instruction to decrease the volume and an instruction to stop playing;
  • the second instruction includes an instruction to increase the volume and an instruction to start playing.
  • the volume decrease instruction is used to instruct the first audio playback device to decrease the volume to play the first audio frame after receiving the first audio frame;
  • the stop playback instruction is used to instruct the first audio playback device to play the first audio frame after receiving the second audio frame. Stop playing audio data after the second audio frame.
  • the volume increasing instruction is used to instruct the second audio playing device to play the first audio frame with increasing volume after receiving the first audio frame.
  • the electronic device may also send a volume increase instruction and a playback stop instruction to the first audio playback device, respectively.
  • the electronic device sends the first instruction and the first audio frame to the first audio playback device at the fifth moment; the electronic device sends the second audio playback device to the second audio playback device at the sixth moment Send the second command and the first audio frame, wherein the difference between the fourth time and the fifth time is the first playback delay of the first audio playback device, and the difference between the fourth time and the sixth time is the second audio playback
  • the second playback delay of the device; the difference between the sixth moment and the fifth moment is the first value, and the first playback delay and the second playback delay are the first value.
  • the first playback delay of the first audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the first audio playback device plays the first audio frame. This period of time is the duration of the first audio playback device.
  • the second playback delay of the second audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the second audio playback device plays the first audio frame. This period of time is the second time of the second audio playback device. Playback delay.
  • the first audio frame may be audio data during a real-time call or playing music or video.
  • the first playback delay includes the Bluetooth transmission delay of the first audio device, the decoding delay of the first audio device, and the hardware delay of the first audio device.
  • the second playback delay includes the Bluetooth transmission delay of the second audio device, the decoding delay of the second audio device, and the hardware delay of the second audio device.
  • the electronic device before the electronic device starts to send a stop command to the first audio playback device or sends a start command to the second audio playback device, the electronic device also needs to calculate the value of the first audio playback device. and the playback delay of the second audio playback device. Specifically, the electronic device sends the first test data to the first audio playback device, and sends the second test data to the second audio playback device. The electronic device receives the first information including the seventh moment and the eighth moment sent by the first audio playback device; wherein, the seventh moment is the moment when the first test data leaves the electronic device, and the eighth moment is the first audio playback device playing the first information. A moment of test data.
  • the electronic device receives the second information including the ninth time and the tenth time sent by the second audio playback device; wherein, the ninth time is the time when the second test data leaves the electronic device, and the tenth time is when the second audio playback device plays the first time. 2. The moment of test data.
  • the electronic device determines the first playback delay, and the first playback delay is the difference between the eighth time point and the seventh time point.
  • the electronic device determines the second playback delay, and the second playback delay is the difference between the tenth time and the ninth time. In this way, the electronic device calculates the playback delay of the first audio playback device and the second audio playback device, which provides a possibility for seamless playback of audio data when the first audio playback device and the second audio playback device are switched subsequently.
  • the electronic device can calculate the playback delay of the first audio playback device and the playback delay of the second audio playback device.
  • the playback delay of the second audio playback device is stored in the electronic device, and thereafter, the electronic device does not need to recalculate the playback delay of the first audio playback device and the playback delay of the second audio playback device each time.
  • the present application provides an electronic device including one or more processors and one or more memories.
  • the one or more memories are coupled to the one or more processors for storing computer program code, the computer program code comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform
  • the electronic device executes the method steps.
  • an embodiment of the present application provides a computer storage medium, including computer instructions, which, when the computer instructions are executed on an electronic device, cause the electronic device to execute the method steps in any of the possible implementations of any of the foregoing aspects.
  • an embodiment of the present application provides a computer program product that, when the computer program product runs on a computer, enables an electronic device to execute the steps of the electronic device execution method in any of the possible implementations of any one of the foregoing aspects.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • 2A-2B are timing diagrams of audio data playback when a group of electronic devices 100 switch Bluetooth devices according to an embodiment of the present application;
  • FIGS. 3A-3H are schematic diagrams of operations for switching a Bluetooth device by a group of electronic devices 100 according to an embodiment of the present application
  • Fig. 4 is another interface schematic diagram provided by the embodiment of the present application.
  • 5A-5B are schematic diagrams of a group of home application scenarios provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of the principle of calculating the reference time of two Bluetooth devices by an electronic device 100 according to an embodiment of the present application;
  • FIG. 7 is a schematic diagram of the principle of calculating the playback delay of audio data played by the audio playback device 200 by an electronic device 100 according to an embodiment of the present application;
  • FIG. 8 is a schematic diagram of the principle of calculating the playback delay of audio data played by the audio playback device 300 by an electronic device 100 according to an embodiment of the present application;
  • FIGS. 9-12 are schematic schematic diagrams of the principles of seamlessly playing audio data when a group of electronic devices 100 switch Bluetooth devices according to an embodiment of the application;
  • FIG. 13 is a flowchart of a method for seamless switching of audio data provided by an embodiment of the present application.
  • FIG. 14 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application.
  • FIG. 15 is a software structural block diagram of an electronic device 100 provided by an embodiment of the application.
  • FIG. 16 is a schematic diagram of a hardware structure of an audio playback device according to an embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more.
  • UI user interface
  • the term "user interface (UI)" in the description, claims and drawings of this application is a medium interface for interaction and information exchange between an application program or an operating system and a user, and it realizes the internal form of information Conversion to and from user-acceptable forms.
  • the user interface of the application is the source code written in a specific computer language such as java and extensible markup language (XML).
  • the interface source code is parsed and rendered on the terminal device, and finally presented as content that the user can recognize.
  • Controls also known as widgets, are the basic elements of the user interface. Typical controls include toolbars, menu bars, input boxes, buttons, scroll bars, images and text.
  • the attributes and content of controls in the interface are defined by tags or nodes.
  • XML specifies the controls contained in the interface through nodes such as ⁇ Textview>, ⁇ ImgView>, and ⁇ VideoView>.
  • a node corresponds to a control or property in the interface, and the node is presented as user-visible content after parsing and rendering.
  • applications such as hybrid applications, often contain web pages in their interface.
  • a web page also known as a page, can be understood as a special control embedded in an application program interface.
  • a web page is source code written in a specific computer language, such as hypertext markup language (HTML), cascading styles Tables (cascading style sheets, CSS), java scripts (JavaScript, JS), etc.
  • the source code of the web page can be loaded and displayed as user-identifiable content by a browser or a web page display component similar in function to a browser.
  • the specific content contained in a web page is also defined by tags or nodes in the source code of the web page. For example, HTML defines the elements and attributes of web pages through ⁇ p>, ⁇ img>, ⁇ video>, and ⁇ canvas>.
  • GUI graphical user interface
  • GUI refers to a user interface related to computer operations that is displayed graphically. It can be an interface element such as a window, a control, etc. displayed in the display screen of the electronic device.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • the system includes an electronic device 100 , an audio playback device 200 and an audio playback device 300 .
  • the audio playback device 200 may be a Bluetooth device such as a Bluetooth headset and a Bluetooth speaker
  • the audio playback device 300 may be a Bluetooth device such as a car Bluetooth and a Bluetooth speaker.
  • the audio playback device 200 and the audio playback device 300 may also be other devices, such as a Bluetooth watch, etc., which are not limited in this application again.
  • the device type of the audio playback device 200 and the device type of the audio playback device 300 may be the same or different.
  • the audio playback device 200 may be a Bluetooth headset, and the audio playback device 300 may be a car Bluetooth; for another example, the device type of the audio playback device 200 and The device types of the audio playback device 300 may all be Bluetooth speakers.
  • the electronic device 100 can communicate with the audio playback device 200 and the audio playback device 300 through any one of Bluetooth technology (including classic Bluetooth and Bluetooth low energy (BLE)), Wi-Fi Direct, local area network, etc. .
  • Bluetooth technology including classic Bluetooth and Bluetooth low energy (BLE)
  • BLE Bluetooth low energy
  • Wi-Fi Direct Wireless Fidelity
  • local area network etc.
  • the embodiments of the present application are described by taking the audio playback device 200 as a Bluetooth headset, the audio playback device 300 as vehicle-mounted Bluetooth, and the electronic device 100 establishing connections with the audio playback device 200 and the audio playback device 300 via Bluetooth as an example.
  • the electronic device 100 can send audio data to the audio playback device 200 for playback through the Bluetooth transmission link.
  • the audio playback device 300 After that, the audio playback device 300 is started, and the audio playback device 300 sends a broadcast, and the broadcast carries the device identification of the audio playback device 300 .
  • the electronic device 100 receives the broadcast sent by the audio playback device 300, and the electronic device 100 recognizes the device identification of the audio playback device 300 in the broadcast, that is, the electronic device 100 and the audio playback device 300 have established a Bluetooth connection before, and the If the priority is higher than that of the audio playback device 200, the electronic device 100 will disconnect the Bluetooth connection with the audio playback device 200 and establish a Bluetooth connection with the audio playback device 300.
  • the Bluetooth transmission link sends the audio data to the audio playback device 300 for playback.
  • the audio playback device 300 starts up.
  • the electronic device 100 receives the user's switching Bluetooth connection operation.
  • the electronic device 100 will disconnect the Bluetooth connection with the audio playback device 200 and establish a Bluetooth connection with the audio playback device 300.
  • the electronic device 100 can The audio data is sent to the audio playback device 300 for playback through the Bluetooth transmission link with the audio playback device 300 .
  • the electronic device 100 disconnects the Bluetooth connection with the audio playback device 200 and establishes a Bluetooth connection with the audio playback device 300 . After that, the electronic device 100 sends audio data to the audio playback device 300 for playback. During the period of time when the electronic device 100 is disconnected from the audio playback device 200 until the electronic device 100 sends the audio data to the audio playback device 300 for playback, the audio data will be lost, affecting user experience.
  • the audio data is a call voice
  • the electronic device 100 switches the Bluetooth connection from the audio playback device 200 to the audio playback device 300
  • the call voice is interrupted during this period of time, and after a period of time, the audio playback device 300 will play the call voice, then a part of the call voice is lost.
  • the audio data is music
  • the electronic device 100 switches the Bluetooth connection from the audio playback device 200 to the audio playback device 300
  • the music being played will be paused, and after a period of time, the audio playback device 300 will not When playing music, a segment of the music is lost.
  • the electronic device 100 can adopt any one of the following methods to solve the problem of audio data loss and interruption during the switching of Bluetooth devices.
  • the electronic device 100 establishes a Bluetooth connection with the audio playback device 200 , and sends audio data to the audio playback device 200 .
  • the electronic device 100 switches the connection with the audio playback device 200 to the connection with the audio playback device 300 , the electronic device records the playback progress of the audio data when the connection with the audio playback device 200 is disconnected.
  • the electronic device 100 is disconnected from the audio playback device 200 , and the electronic device 100 sends the complete audio file corresponding to the played audio data to the audio playback device 300 , and simultaneously sends the audio playback progress of the audio data to the audio playback device 300 .
  • the audio playback device 300 receives the complete audio file and the playback progress of the audio data sent by the electronic device 100, and starts to play the audio data according to the playback progress of the audio data.
  • the electronic device 100 needs to send the complete audio file corresponding to the played audio data to the audio playback device 300.
  • the electronic device 100 cannot obtain the audio data that has not occurred, and cannot realize the synchronization of the playback progress.
  • This method only solves the problem of synchronizing the playback progress of the audio playback device 200 and the audio playback device 300.
  • the audio playback device 200 stops playing and the audio playback device 300 starts playing there is still the problem of playback interruption.
  • the electronic device 100 establishes a Bluetooth connection with the audio playback device 200 , the electronic device 100 starts to transmit audio data to the audio playback device 200 , and the audio playback device 200 plays the audio data.
  • the audio playback device 300 when the total duration of playing audio data by the audio playback device 200 is 120ms, that is, at the moment of 120ms, the audio playback device 300 is turned on, the audio playback device 300 publishes a broadcast, and the electronic device 100 receives the broadcast from the audio playback device 300 broadcast, and the priority of the audio playback device 300 is higher than that of the audio playback device 200 .
  • the electronic device 100 will establish a Bluetooth connection with the second Bluetooth device. Specifically, first, the electronic device 100 disconnects the Bluetooth connection with the audio playback device 200 . After that, the electronic device 100 buffers the audio data played after the time of 120 ms. When the duration of the audio data buffered by the electronic device 100 reaches 120 ms, the electronic device 100 establishes a Bluetooth connection with the audio playback device 300 , and the audio playback device 300 starts to play the audio data sent by the electronic device 100 .
  • the electronic device 100 sends the buffered audio data with a duration of 120 ms to the audio playback device 300 , and the audio playback device 300 will start playing the electronic device 100 Send buffered 120ms audio data.
  • the audio playback device 300 finishes playing the buffered audio data of 120 ms, it then plays the audio data after 240 ms.
  • the audio data played by the audio playback device 300 is connected to the buffered audio data, and the audio playback device 300 will use a shorter time to play the received buffered 120ms audio data, that is, the audio playback device 300
  • the received buffered 120ms audio data will be played within 80ms.
  • the audio playback device 300 has finished playing the received buffered audio data of 120ms, and at the moment of 320ms, the audio playback device 300 will play the audio data after 240ms.
  • the electronic device 100 After the electronic device 100 is disconnected from the audio playback device 200, the electronic device 100 sends the buffered audio data to the audio playback device 300, stops playing at the audio playback device 200, and sends the buffered audio data to the audio playback device at the electronic device 100.
  • 300 to the audio playback device 300 starts playing or there is a process of a terminal; and, in order to avoid time delay, the audio playback device 300 will accelerate the playback of the audio data buffered by the electronic device 100, but the accelerated playback of the buffered audio data will make the user worse experience.
  • the present application provides a method for seamless switching of audio data.
  • the method includes: establishing a communication connection between the electronic device 100 and the audio playback device 200 (first audio playback device).
  • the audio playback device 200 plays audio data transmitted by the electronic device 100 .
  • the audio playback device 300 second audio playback device
  • the electronic device 100 does not disconnect the connection with the audio playback device 200 and establishes a Bluetooth connection with the audio playback device 300 at the same time.
  • the electronic device 100 determines the difference value T of the playback delay between the first audio playback device and the second audio playback device, so that the time difference between the first audio playback device receiving the stop playback instruction and the second audio playback device receiving the start playback instruction is: After the difference value T, when the first audio playback device stops playing the audio data, the second audio playback device starts to play the audio data.
  • the electronic device 100 switches the connection of the Bluetooth device, the time delay existing in the switching of the Bluetooth device is considered, so that the audio data will not be interrupted, and the audio data playback progress when the audio playback device 200 and the audio playback device 300 are switched is realized. Synchronization improves user experience.
  • the audio data mentioned in the embodiments of the present application may be predictable audio data, such as audio data played by music or video applications; the audio data mentioned in the embodiments of the present application may also be unpredictable audio data, such as It is the audio data of the real-time call and so on.
  • the playback delay of the audio playback device 200 playing audio data means that the electronic device 100 sends the audio data to the audio playback device 200 to start timing until the microphone of the audio playback device 200 collects the audio data and the timing ends. This period of time is called audio The playback delay of the playback device 200 for playing audio data.
  • the electronic device 100 sends the audio data frame at time one to the audio playback device 200, the audio data frame at time one is transmitted to the audio playback device 200 after a period of time, and the audio playback device 200 decodes the audio data frame at time one, After the analog-to-digital conversion and other steps, the audio data frame at time one is played, and the time when the audio data frame is played is time two, that is, the time of the audio data frame collected by the microphone of the audio playback device 200 is time two, and time two is the same as the time two.
  • the difference at time one is the playback delay for the audio playback device 200 to play audio data.
  • the playback delay for the audio playback device 200 to play audio data includes Bluetooth transmission delay + codec delay + hardware delay.
  • the Bluetooth transmission delay is the transmission time for the electronic device 100 to send the audio data to the audio playback device 200 through the Bluetooth channel.
  • the encoding and decoding delay is the decoding time for the audio playback device 200 to receive the audio data and decode the audio data.
  • the hardware delay is the time it takes for the audio playback device 200 to play the audio data through the audio module in steps such as performing analog-to-digital conversion on the decoded audio data.
  • the hardware delay can be tested before the audio playback device 200 leaves the factory.
  • the playback delay of the audio playback device 300 playing audio data is the same as the playback delay of the audio playback device 200 playing audio data, and details are not described herein again.
  • connection between the electronic device 100 and the audio playback device 300 may be established in any of the following ways:
  • Manner 1 The electronic device 100 establishes a connection with the audio playback device 300 by receiving a user operation.
  • the electronic device 100 may receive a user operation to establish a connection with the second audio playback device 300 in the setting interface.
  • FIG. 3A exemplarily shows a user interface 30 on the electronic device 100 for presenting installed applications.
  • the user interface 30 displays: a status bar, a calendar indicator, a weather indicator, a tray with icons of frequently used applications, a navigation bar, an icon 301 for file management, an icon 302 for email, an icon 303 for music, an icon 304 for settings , the icon 305 of sports health, the icon 306 of weather, etc.
  • the tray of commonly used application icons includes the icon 307 of the camera, the icon 308 of the address book, the icon 309 of the phone, and the icon 310 of the information.
  • the status bar may include: one or more signal strength indicators of mobile communication signals (also known as cellular signals), operator name (such as "China Mobile"), one or more signal strengths of Wi-Fi signals indicator, battery status indicator, time indicator, etc.
  • the navigation bar may include system navigation keys such as the back key, the home screen key, and the multitasking key.
  • the user interface 30 exemplarily shown in FIG. 3A may be the Home screen.
  • the electronic device 100 receives and responds to the operation of the user clicking the setting icon 304 , and the electronic device 100 displays the setting interface 40 as shown in FIG. 3B .
  • the setting interface 40 includes an airplane mode icon, the airplane mode of the electronic device 100 is turned off, the Wi-Fi icon, the Wi-Fi of the electronic device 100 is turned off, the setting interface 40 also includes a Bluetooth icon 311, a personal hotspot icon, a mobile Network icon, Do not disturb mode icon, display and brightness icon, Huawei account icon, privacy icon, etc.
  • the electronic device 100 receives and responds to the user's operation of clicking the Bluetooth icon 311 , and the electronic device 100 displays the user interface 50 as shown in FIG. 3C .
  • the user interface 50 includes a Bluetooth icon, and the Bluetooth function of the electronic device 100 is turned on.
  • the user interface 50 also includes a device identification icon that has previously established a Bluetooth connection with the electronic device 100 .
  • the device identification icon may include "lisa”, “HUAWEI”, "123", “Nancy” and so on.
  • the electronic device 100 has established a connection with the device corresponding to the device identifier "lisa”, and the electronic device 100 has not established any connection with the device corresponding to the device identifiers "HUAWEI", "123", and "Nancy".
  • the user interface 50 also shows an identification icon for a new device that has not previously established a Bluetooth connection with the electronic device 100, which may be "jack", "ABC”, or the like.
  • the device corresponding to the device identifier "lisa” may be the audio playback device 200
  • the device corresponding to the device identifier "123” may be the audio playback device 300.
  • the electronic device 100 can receive and respond to the operation of the user clicking the device identification icon "123". If the distance between the device corresponding to the device identification icon "123" and the electronic device 100 is within a preset range, the electronic device 100 A Bluetooth connection can be established with the device corresponding to the device identification icon "123".
  • the electronic device 100 may receive the user's operation of switching the Bluetooth device on the audio data playback interface, and establish a Bluetooth connection with the audio playback device 300 .
  • FIG. 3D exemplarily shows the user interface 60 displayed by the electronic device 100 .
  • the user interface 60 includes a music playback screen 601 .
  • the music playing screen 601 includes the name and control icons of the music being played.
  • the name of the music being played is "dream it possible”.
  • Control icons include play/pause controls 602 , previous and next track controls 603 and 604 , progress bar 605 , download controls 606 , share controls 607 , toggle controls 608 and more controls 609 .
  • the electronic device 100 receives and responds to the user's operation of clicking the switch control 608, and the electronic device 100 displays the user interface 70 as shown in FIG. 3E.
  • the user interface 70 displays a prompt box 610 , and the prompt box 610 displays the audio playback mode of the electronic device 100 .
  • the electronic device 100 may change the display form of the user interface 70, such as adding a shadow when displaying the user interface 70, and the like.
  • the prompt box 610 shows that the electronic device 100 has established a connection with the Bluetooth headset whose device ID is “Lisa”, and the electronic device 100 is playing audio data through the Bluetooth headset.
  • the prompt box 610 also displays an icon of a device identification with which the electronic device 100 can establish a connection, and the icon of the device identification may be, for example, "Nancy”, “Huawei”, "123” and so on.
  • the electronic device 100 may receive and respond to the operation of the user clicking the icon of the device identification displayed in the prompt box 610, and the electronic device 100 establishes a Bluetooth connection with the device corresponding to the icon of the device identification.
  • the electronic device 100 may receive and respond to the operation of the icon "123" of the device identification, and the electronic device 100 establishes a Bluetooth connection with the device corresponding to the icon "123" of the device identification.
  • the electronic device 100 when the electronic device 100 detects a downward swipe gesture on the display screen, in response to the swipe gesture, as shown in FIG. 3G , the electronic device 100 displays a window 620 on the user interface 60 .
  • Window 620 includes a music playback widget 630 .
  • the music playing widget 630 includes the name and control icons of the music being played. In the music playing small window 630, the name of the music being played is "dream it possible".
  • the control icons include a play/pause control 602 , a previous song control 603 and a next song control 604 , a progress bar 605 and a toggle control 608 .
  • the electronic device 100 can change the display form of the user interface 60 , for example, increase the shadow when displaying the user interface 60 .
  • the electronic device 100 receives and responds to the user's operation of clicking the switching control 608 in the music playing widget 630 , and as shown in FIG. 3H , the electronic device 100 displays a window 650 on the user interface 60 .
  • the window 650 shows that the electronic device 100 has established a connection with the Bluetooth headset whose device ID is “Lisa”, and the electronic device 100 is playing audio data through the Bluetooth headset.
  • the window 650 also displays an icon of a device identification with which the electronic device 100 can establish a connection, and the icon of the device identification may be, for example, "Nancy”, “Huawei”, "123” and so on.
  • the electronic device 100 may receive and respond to the operation of the user clicking on the icon of the device identification displayed in the window 650, and the electronic device 100 establishes a Bluetooth connection with the device corresponding to the icon of the device identification.
  • the electronic device 100 can receive and respond to the operation of the icon "123" of the device identification, and the electronic device 100 establishes a Bluetooth connection with the device corresponding to the icon "123" of the device identification.
  • Mode 2 There are other Bluetooth devices near the electronic device 100 , and the priority level of one Bluetooth device (eg, the audio playback device 300 ) is higher than that of the audio playback device 200 when there are other Bluetooth devices.
  • the electronic device 100 will establish a connection with the audio playback device 300 .
  • Table 1 exemplarily shows the priorities of some devices. E.g. The priority of the device corresponding to the device ID "123" ranks first, the priority of the device corresponding to the device ID “Lisa” ranks second, the priority of the device corresponding to the device ID “Huawei” ranks third, and the device ID "Nancy” The corresponding device has the fourth priority.
  • the audio playback device 300 When the electronic device 100 has established a Bluetooth connection with the audio playback device 200 , the audio playback device 300 is turned on, and the priority of the audio playback device 300 is higher than that of the audio playback device 200 .
  • the audio playback device 300 continuously sends broadcasts, the distance between the audio playback device 300 and the electronic device 100 is within a preset range, and the electronic device 100 receives the broadcast sent by the audio playback device 300 and recognizes the identity of the audio playback device 300 carried in the broadcast. If the electronic device 100 has established a Bluetooth connection with the audio playback device 300 before, and the priority of the audio playback device 300 is higher than that of the audio playback device 200, the electronic device 100 will establish a Bluetooth connection with the audio playback device 300.
  • the prompt box 660 includes prompt information and selection controls, and the prompt information includes ““123” is about to establish a connection with you, do you agree to establish a connection?”, where “123” is the device identification of the audio playback device 300 .
  • the selection controls include control 6601 and control 6602.
  • the prompt information may be "whether to switch the connection with "Lisa” to the connection with "123”".
  • the device corresponding to the device identifier "Lisa” has currently established a connection with the electronic device 100 , and the device corresponding to the device identifier "123” is the audio playback device 300 .
  • the prompt information may also display other content, which is not limited in this application.
  • the electronic device 100 when the electronic device 100 receives and responds to the operation of the user clicking the control 6601 , the electronic device 100 will establish a Bluetooth connection with the audio playback device 300 .
  • Mode 3 There are other Bluetooth devices near the electronic device 100.
  • a Bluetooth device such as the audio playback device 300
  • the distance from the electronic device 100 is smaller than the distance between the audio playback device 200 and the electronic device 100.
  • the device 100 automatically switches the connection with the audio playback device 200 to the connection with the audio playback device 300 .
  • the electronic device 100 has established a Bluetooth connection with an audio playback device 200 (eg, a speaker), the electronic device 100 sends audio data to the audio playback device 200 (eg, a speaker), and the audio playback device 200 (eg, a speaker) plays the electronic Audio data sent by device 100 .
  • an audio playback device 200 eg, a speaker
  • the electronic device 100 moves from the first position to the second position, and at this time, in the vicinity of the second position, the audio playback device 300 (eg, a speaker) is turned on.
  • the distance between the audio playback device 200 (eg, the speaker) and the electronic device 100 is 1.2 meters
  • the distance between the audio playback device 300 (eg, the speaker) and the electronic device 100 is 0.8 meters. Since the distance between the audio playback device 300 (eg, speaker) and the electronic device 100 is smaller than the distance between the audio playback device 200 (eg, speaker) and the electronic device 100 , the electronic device 100 can establish a Bluetooth connection with the audio playback device 300 at this time.
  • the electronic device 100 may be smaller than the distance between the audio playback device 200 (eg, speaker) and the electronic device 100 according to the distance between the audio playback device 300 (eg, a speaker) and the electronic device 100 , and the electronic device 100 may reach the preset time according to the duration that the distance between the audio playback device 300 (eg, the speaker) and the electronic device 100 is shorter than the distance between the audio playback device 200 (eg, the speaker) and the electronic device 100 , the electronic device 100 and the audio The playback device 300 establishes a Bluetooth connection.
  • the audio playback device 200 eg, speaker
  • the electronic device 100 may reach the preset time according to the duration that the distance between the audio playback device 300 (eg, the speaker) and the electronic device 100 is shorter than the distance between the audio playback device 200 (eg, the speaker) and the electronic device 100 , the electronic device 100 and the audio
  • the playback device 300 establishes a Bluetooth connection.
  • FIG. 5B is a schematic diagram of a home application scenario.
  • the home application scenario includes a first room area 510 , a second room area 520 and a living room area 530 .
  • the first room area 510 includes a first sound box 501
  • the second room area 520 includes a first sound box 502
  • the living room area 530 includes a third sound box 503 .
  • the electronic device 100 first establishes a Bluetooth connection with the third speaker 503 in the living room area 530 , and the third speaker 503 plays the audio data sent by the electronic device 100 .
  • the electronic device 100 moves to the first room area 510, and the first speaker 501 is turned on. Since the distance between the first speaker 501 and the electronic device 100 is smaller than the distance between the third speaker 503 and the electronic device 100, the electronic device 100 actively communicates with the electronic device 100.
  • the first speaker 501 establishes a Bluetooth connection.
  • the electronic device 100 is moved into the first room area 510, and the first sound box 501 is turned on, because the distance between the first sound box 501 and the electronic device 100 is smaller than the distance between the third sound box 503 and the electronic device 100, and When the distance between the first speaker 501 and the electronic device 100 is smaller than the distance between the third speaker 503 and the electronic device 100 for a preset time, the electronic device 100 actively establishes a Bluetooth connection with the first speaker 501 .
  • the following will focus on how the electronic device 100 calculates the playback delay of the audio data played by the audio playback device 200 and the audio playback device 300 before switching the Bluetooth device, and switches the Bluetooth device based on the difference between the playback delays of the two Bluetooth devices. , to achieve the effect of playing audio without interruption.
  • FIG. 6 is a schematic diagram of the principle of calculating the reference time of two Bluetooth devices.
  • the electronic device 100 sends a message 1 to the device 2 at the time T1, and the message 1 carries the time stamp when it leaves the electronic device 100, and the time stamp is the time T1, for example, the time T1 is 10:00:00 , the time stamp T1 is the system time of the electronic device 100 .
  • the electronic device 100 For the electronic device 100 to send the first message to the device one, it needs to arrive at the device one after a period of network delay transmission.
  • Device 1 receives message 1 sent by electronic device 100 at time T2, and adds the timestamp of device 1 (time T2) to message 1.
  • time T2 is 11:00:01
  • time stamp T2 is The system time of device one.
  • Packet 2 leaves device 1 at time T3, device 1 adds the time stamp (time T1) of message 1 leaving the electronic device 100 to message 2, and the time stamp (time T2) when message 1 arrives at device 1. 2.
  • the time stamp (time T3) of leaving the device one for example, the time T3 is 11:00:02, and the time stamp T3 is the system time of the device one.
  • the moment when the second packet reaches the first device is the time T4.
  • the time T4 is 10:00:03
  • the time stamp T4 is the system time of the electronic device 100 .
  • the second packet carries the time stamp T1 time, the time stamp T2 time and the time stamp T3 time.
  • the round-trip delay of data transmission between the electronic device 100 and the first device (T4-T1)-(T3-T2).
  • the time difference between the electronic device 100 and the first device offset [(T2-T1)+(T3-T4)]/2.
  • the electronic device 100 uses the method shown in FIG. 6 to respectively calculate the time difference between the electronic device 100 and the audio playback device 200 and the time difference between the electronic device 100 and the audio playback device 300 .
  • the time difference between the electronic device 100 and the audio playback device 200 is 5 minutes, and the time difference between the electronic device 100 and the audio playback device 200 is 10 minutes.
  • the electronic device 100 After waiting for the completion of the initialization of the audio path of the audio playback device 300 , the electronic device 100 starts to calculate the playback delay between the audio playback device 200 and the audio playback device 300 .
  • the electronic device 100 calculates the playback delay for the audio playback device 200 to play audio data according to the test data.
  • the electronic device 100 continues to send audio data to the audio playback device 200 , and the audio playback device 200 plays the audio data.
  • the time stamp of the current progress of the audio data played by the electronic device 100 is time three, and the electronic device 100 sends the test data to the audio playback device 200.
  • the test data includes the time when the test data leaves the electronic device 100, namely time three.
  • the test data may be audio data of a specific frequency, and the audio data of the specific frequency may be audio data perceivable by human ears, or may be audio data not perceptible by human ears, which is not limited in this application.
  • the test data is transmitted to the Bluetooth protocol stack of the audio playback device 200 after a period of time through the Bluetooth channel between the electronic device 100 and the audio playback device 200 .
  • the audio playback device 200 records the time when the test data reaches the Bluetooth protocol stack of the audio playback device 200, that is, time four.
  • the difference between time four and time three is the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 200 .
  • the audio playback device 200 decodes the test data, and the audio playback device 200 records the time corresponding to the decoding of the test data, that is, time five.
  • the difference between time five and time four is the encoding and decoding delay of the audio playback device 200 .
  • the audio playback device 200 transmits the decoded test data to the audio playback module, and the audio playback module performs analog-to-digital conversion, power amplification and other operations on the test data to play out, so that the human ear can hear the audio data played by the audio playback device 200 . That is, after the test data is played, the audio playback device 200 records the time of the test data collected by the microphone of the audio playback device 200 , namely time six, and the difference between time six and time five is the hardware delay of the audio playback device 200 .
  • the audio playback device 200 After the audio playback device 200 records the test data collected by the microphone of the audio playback device 200, the audio playback device 200 sends a message 3 to the electronic device 100, and the message 3 carries the time when the test data leaves the electronic device 100 (time 3). ), the time when the test data arrives at the Bluetooth protocol stack of the audio playback device 200 (time four), the corresponding time (time five) after the test data is decoded, and the time (time six) of the test data collected by the microphone of the audio playback device 200.
  • the electronic device 100 receives the message three sent by the audio playback device 200, and the time when the message three reaches the electronic device 100 is time seven.
  • the electronic device 100 parses out the information carried in the packet 3, and the electronic device 100 can calculate the playback delay for the audio playback device 200 to play the audio data according to the information carried in the packet 3.
  • the electronic device 100 can calculate the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 200, that is, the time when the audio data frame leaves the electronic device 100 (time 3) and the Bluetooth protocol stack of the test data arriving at the audio playback device 200.
  • the difference of the time (time four) is the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 200 .
  • time three is 10:00:320
  • time four is 10:05:360
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes
  • the time difference between the electronic device 100 and the audio playback device 200 is 5 minutes.
  • the transmission delay of the Bluetooth channel is 40ms.
  • the electronic device 100 can calculate the encoding and decoding delay of the audio playback device 200, that is, the difference between the time corresponding to the decoding of the test data (time five) and the time when the test data reaches the Bluetooth protocol stack of the audio playback device 200 (time four) is: Codec delay of the audio playback device 200 .
  • time five 10:00:400
  • time four is 10:05:360
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes
  • the encoding and decoding delay of the audio playback device 200 is 40ms .
  • the electronic device 100 can calculate the hardware delay of the audio playback device 200 .
  • the hardware delay of the audio playback device 200 may also be tested when the audio playback device 200 leaves the factory, and the audio playback device 200 does not need to calculate the hardware delay of the audio playback device 200 in subsequent use.
  • the difference between the time (time six) of the test data collected by the microphone of the audio playback device 200 and the corresponding time (time five) after decoding the test data is the hardware delay of the audio playback device 200 .
  • time six is 10:00:480
  • time five is 10:05:400
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes
  • the hardware delay of the audio playback device 200 is 80 ms.
  • the electronic device 100 can calculate the playback delay of the audio playback device 200 for playing audio data, and the difference between the time (time six) of the test data collected by the microphone of the audio playback device 200 and the time when the test data leaves the electronic device 100 (time three)
  • the value is the playback delay of the audio playback device 200 playing audio data, or the playback delay of the audio playback device 200 playing audio data is equal to the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 200 plus audio playback
  • the codec delay of the device 200 is added to the hardware delay of the audio playback device 200 . Exemplarily, time three is 10:00:320, time six is 10:05:480, and the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes, then the audio playback device 200 plays the audio data playback delay is 160ms.
  • the electronic device 100 calculates the playback delay for the audio playback device 200 to play audio data according to the test data
  • the electronic device 100 may also calculate the playback delay for the audio playback device 300 to play audio data according to the test data.
  • the two can be performed simultaneously or separately, which is not limited in this application.
  • the electronic device 100 sends the test data to the audio playback device 300
  • the electronic device 100 sends the test data to the audio playback device 300
  • the electronic device 100 records the moment when the test data leaves the electronic device 100, that is, Time three
  • the test data includes the time when the test data leaves the electronic device 100, namely time three.
  • the test data may be audio data of a specific frequency
  • the audio data of the specific frequency may be audio data perceivable by human ears, or may be audio data not perceptible by human ears, which is not limited in this application.
  • the test data is transmitted to the Bluetooth protocol stack of the audio playback device 300 after a period of time through the Bluetooth channel between the electronic device 100 and the audio playback device 300 .
  • the audio playback device 300 records the time when the test data reaches the Bluetooth protocol stack of the audio playback device 300, that is, time eight.
  • the difference between time eight and time three is the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 300 .
  • the audio playback device 300 decodes the test data, and the audio playback device 300 records the time corresponding to the decoding of the test data, that is, time nine.
  • the difference between time nine and time eight is the encoding and decoding delay of the audio playback device 300 .
  • the audio playback device 300 transmits the decoded test data to the audio playback module, and the audio playback module performs analog-to-digital conversion, power amplification and other operations on the test data to play out, so that the human ear can hear the audio data played by the audio playback device 300 . That is, after the test data is played, the audio playback device 300 records the time of the test data collected by the microphone of the audio playback device 300 , namely time ten. The difference between time ten and time nine is the hardware delay of the audio playback device 300 .
  • the audio playback device 300 After the audio playback device 300 records the test data collected by the microphone of the audio playback device 300, the audio playback device 300 sends a message four to the electronic device 100, and the message four carries the test data and leaves the electronic device 100 (time three) , the time when the test data reaches the Bluetooth protocol stack of the audio playback device 300 (time 8), the corresponding time after the test data is decoded (time 9), and the time when the test data collected by the microphone of the audio playback device 300 (time 10).
  • the electronic device 100 receives the message four sent by the audio playback device 300 , and the time when the message four arrives at the electronic device 100 is time eleven.
  • the electronic device 100 parses the information carried in the packet 4, and the electronic device 100 can calculate the playback delay for the audio playback device 300 to play the audio data according to the information carried in the packet 4.
  • the electronic device 100 can calculate the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 300, that is, the time when the audio data frame leaves the electronic device 100 (time 3) and the Bluetooth protocol stack of the test data arriving at the audio playback device 300.
  • the difference of the time (time eight) is the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 300 .
  • time three is 10:00:320
  • time eight is 10:10:400
  • the relative time difference between the electronic device 100 and the audio playback device 300 is 10 minutes
  • the time difference between the electronic device 100 and the audio playback device 300 is 10 minutes.
  • the transmission delay of the Bluetooth channel is 80ms.
  • the electronic device 100 can calculate the encoding and decoding delay of the audio playback device 300, that is, the difference between the time corresponding to the decoding of the test data (time 9) and the time when the test data reaches the Bluetooth protocol stack of the audio playback device 300 (time 8) is: Codec delay of the audio playback device 300 .
  • time nine is 10:10:440
  • the relative time difference between the electronic device 100 and the audio playback device 300 is 10 minutes
  • the encoding and decoding delay of the audio playback device 300 is 40ms. .
  • the electronic device 100 can calculate the hardware delay of the audio playback device 300 .
  • the hardware delay of the audio playback device 300 may also be tested when the audio playback device 300 is shipped from the factory, and the audio playback device 300 does not need to calculate the hardware delay of the audio playback device 300 in subsequent use.
  • the difference between the time (time ten) of the test data collected by the microphone of the audio playback device 300 and the corresponding time (time nine) after the test data is decoded is the hardware delay of the audio playback device 300 .
  • time ten 10:00:560
  • time nine is 10:10:440
  • the relative time difference between the electronic device 100 and the audio playback device 300 is 10 minutes
  • the hardware delay of the audio playback device 300 is 120 ms.
  • the electronic device 100 can calculate the playback delay of the audio playback device 300 for playing audio data, and the difference between the time (time ten) of the test data collected by the microphone of the audio playback device 300 and the time when the test data leaves the electronic device 100 (time three)
  • the value is the playback delay of the audio playback device 300 playing audio data, or the playback delay of the audio playback device 300 playing audio data is equal to the transmission delay of the Bluetooth channel between the electronic device 100 and the audio playback device 300 plus audio playback
  • the codec delay of the device 300 is added to the hardware delay of the audio playback device 300 . Exemplarily, time three is 10:00:320, time ten is 10:10:560, and the relative time difference between the electronic device 100 and the audio playback device 300 is 10 minutes, then the audio playback device 300 plays the audio data playback delay is 240ms.
  • the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300, if the playback delay of the audio playback device 200 is greater than the playback delay of the audio playback device 300, the electronic device 100 will stop playing the audio at the Mth time.
  • the instruction is sent to the audio playback device 200 , and after the time T elapses, the electronic device 100 sends the audio playback instruction and audio data to the audio playback device 300 .
  • the electronic device 100 sends the audio playback instruction and audio data to the audio playback device 300 at the Mth time, and after the difference T, the electronic device 100 sends an instruction to stop playing the audio to the audio playback device 200 .
  • the time T is the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 .
  • the electronic device 100 may acquire audio data after the timestamp of the currently playing audio data in advance. Specifically, when the electronic device 100 discovers the audio playback device 300 , the electronic device 100 does not disconnect from the audio playback device 200 and establishes a Bluetooth connection with the audio playback device 300 . After that, after the initialization of the audio path of the audio playback device 300 is completed, the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300. After the playback delay of the audio playback device 200 and the audio playback device 300 is calculated, the electronic device The device 100 controls the audio playback device 200 and the audio playback device 300 to seamlessly switch and play audio data.
  • the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300 .
  • FIG. 9 exemplarily shows a sequence diagram for the electronic device 100 to realize the seamless connection of audio data played by the audio playback device 200 and the audio playback device 300 .
  • the time shown in FIG. 9 and FIG. 9 is the system time of the electronic device 100 .
  • the Bluetooth transmission delay of the audio playback device 200 is 40ms
  • the encoding and decoding delay of the audio playback device 200 is 40ms
  • the hardware delay of the audio playback device 200 is 80ms
  • the playback delay of the audio playback device 200 is 160ms.
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes.
  • the Bluetooth transmission delay of the audio playback device 300 is 80ms, the codec delay of the audio playback device 300 is 40ms, and the hardware delay of the audio playback device 300 is 120ms, the playback delay of the audio playback device 300 is 240ms.
  • the relative time difference between the electronic device 100 and the audio playback device 300 is 10 minutes.
  • the electronic device 100 establishes a connection with the audio playback device 200, the electronic device 200 sends audio data to the audio playback device 200, and the audio playback device 200 plays the audio data.
  • the electronic device 100 does not disconnect the connection with the audio playback device 200 and establishes a connection with the audio playback device 300 at the same time.
  • the audio playback device 300 establishes a Bluetooth connection with the electronic device 100 at time 10:00:240.
  • the audio playback device 300 After a period of time, the audio channel initialization of the audio playback device 300 is completed, the audio playback device 300 sends an audio channel initialization completion notification to the electronic device 100, and the electronic device 100 receives and responds to the audio channel initialization completion notification sent by the audio playback device 300. 100 starts to calculate the playback delay between the audio playback device 200 and the audio playback device 300 . How the electronic device 100 calculates the playback time delay between the audio playback device 200 and the audio playback device 300 has been described in detail in the foregoing embodiments, and will not be repeated in this application.
  • the audio path initialization of the audio playback device 300 is completed.
  • the electronic device 100 simultaneously sends a piece of audio data of a special frequency to the audio playback device 200 and the audio playback device 300 to calculate the playback delay of the audio playback device 200 and the audio playback device 300 .
  • the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300
  • the playback delay of the audio playback device 200 is calculated before the playback delay of the audio playback device 300 .
  • the calculation of the playback delay of the audio playback device 200 is completed, and at time 10:00:600, the calculation of the playback delay of the audio playback device 300 is completed.
  • the electronic device 100 After the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300, because the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300, the electronic device 100 first sends a message to the audio playback device 300. Start playing the command.
  • the electronic device 100 sends a playback start instruction to the audio playback device 300 .
  • the electronic device 100 Before the audio playback device 300 starts to play the audio data, the electronic device 100 also continues to send the audio data to the audio playback device 200 .
  • the electronic device 100 sends the audio data with a timestamp of 2'30"00 to the audio playback device 200 while sending the playback start instruction to the audio playback device 300 .
  • the electronic device 100 After the time ⁇ T after the electronic device 100 sends the instruction to start playing to the audio playing device 300 , the electronic device 100 sends the instruction to stop playing to the audio playing device 200 . It should be noted that the time ⁇ T is the difference between the playback delays of the audio playback device 200 and the audio playback device 300 .
  • the difference ⁇ T between the playback delays of the audio playback device 200 and the audio playback device 300 is 80ms.
  • the electronic device 100 sends a playback start instruction to the audio playback device 300 . After 80 ms, the electronic device 100 sends a stop playing instruction to the audio playback device 200 at time 10:00:720.
  • the electronic device 100 Before the audio playback device 300 starts to play the audio data, the electronic device 100 continues to send the audio data to the audio playback device 200. Therefore, when the electronic device 100 sends the stop playback instruction to the audio playback device 200, the corresponding timestamp The audio data is sent to the audio playback device 200.
  • the electronic device 100 sends audio data with a timestamp of 2'30"80 to the audio playback device 200 while sending a stop playback instruction to the audio playback device 200.
  • the stop playback instruction is transmitted to the audio playback device 200 through the Bluetooth channel between the electronic device 100 and the audio playback device 200, and then passes through the decoder in the audio playback device 200.
  • the data packet containing the stop playing instruction is decoded, the audio playback device 200 recognizes the stop playback instruction, and the audio playback device 200 controls the codec in the audio playback device 200 to stop working. After the codec in the audio playback device 200 stops working, the audio data decoded by the audio playback device 200 before the codec stops working will be played.
  • the audio playback device 200 receives the audio data sent by the electronic device 100, but the codec in the audio playback device 200 has stopped working and cannot decode the audio data. Therefore, the audio playback device 200 is in After the codec stops working, the audio data sent by the electronic device 100 will not be played.
  • the electronic device 100 sends the stop playback instruction to the audio playback device 200, it simultaneously sends the audio data of the time stamp corresponding to the time to the audio playback device 200. After the delay, the audio data of the time stamp is just decoded, and the codec of the audio playback device 200 just stops working.
  • the Bluetooth transmission delay of the audio playback device 200 is 40ms
  • the encoding and decoding delay of the audio playback device 200 is 40ms. Therefore, the electronic device 100 sends the audio data with a timestamp of 2'30"80 to the audio playback device 200 at the time of 10:00:720. After the Bluetooth transmission delay of 40ms and the codec delay of 40ms, a total of 80ms later , the audio data with timestamp 2'30"80 is decoded at time 10:00:800.
  • the codec in the audio playback device 200 just stops working, and when the electronic device 100 sends the stop playback instruction to the audio playback device 200, the audio data of the corresponding timestamp sent just happens to be been decoded.
  • the audio data of the corresponding time stamp can be played by the audio playback device 200 , and the audio data of the corresponding time stamp is the audio data played last by the audio playback device 200 .
  • the audio data with a timestamp of 2'30"80 is decoded by the audio playback device 200, and after the hardware delay of the audio playback device 200, the time is 2'30 ”80 of the audio data is played by the audio playback device 200 .
  • the hardware delay of the audio playback device 200 is 80ms, so at time 10:00:880, the audio data of the audio data whose time is 2'30"80 is played by the audio playback device 200 .
  • the electronic device 100 sends the audio playback device 200 the corresponding For the audio data of the time stamp, when the instruction to start playing is sent to the audio playback device 300 , the audio data corresponding to the time stamp is sent to the audio playback device 300 .
  • the time stamp of the audio data sent to the audio playback device 200 is 2'30"80. Therefore, at time 10 At :00:640, the electronic device 200 sends the audio data with a timestamp of 2'30"80 to the audio playback device 300 at the same time as sending the instruction to start playing to the audio playback device 300 . Since the playback delay of the audio playback device 300 is 240 ms, at the time of 10:00:880, the audio playback device 300 just plays the audio data with the timestamp of 2'30"80.
  • the time stamp of the last audio data played by the audio playback device 200 is 2'30"80
  • the audio playback device 300 just sets the time stamp to 2' 30"80 audio data is played. Therefore, the audio playback device 200 just stops playing, the audio playback device 300 just starts to play, and the audio playback device 200 and the audio playback device 300 can seamlessly switch and play audio data.
  • the time stamp of the audio data sent by the electronic device 100 to the audio playback device 200 is 2'30"00
  • the time stamp of the audio data sent by the electronic device 100 to the audio playback device 300 is 2'30"00
  • Timestamp is 2'30"80. Because the audio data is audio data played by a music or video application, the electronic device 100 will cache a piece of data. Therefore, at time 10:00:640, when the electronic device 100 sends audio data with a timestamp of 2'30"00 to the audio playback device 200, it can obtain the audio data with a timestamp of 2'30"80 in advance, and The audio data with the time stamp of 2'30"80 is sent to the audio playback device 300 .
  • the playback delay of the audio playback device 200 is greater than the playback delay of the audio playback device 300 .
  • FIG. 10 exemplarily shows a sequence diagram in which the electronic device 100 realizes the seamless connection of audio data played by the audio playback device 200 and the audio playback device 300 .
  • time involved in the embodiments shown in FIG. 10 and FIG. 10 is the system time of the electronic device 100 .
  • the Bluetooth transmission delay of the audio playback device 200 is 80ms
  • the encoding and decoding delay of the audio playback device 200 is 40ms
  • the hardware delay of the audio playback device 200 is 120ms
  • the playback delay of the audio playback device 200 is 240ms.
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes.
  • the Bluetooth transmission delay of the audio playback device 300 is 40ms
  • the codec delay of the audio playback device 300 is 40ms
  • the hardware delay of the audio playback device 300 is 80ms
  • the playback delay of the audio playback device 300 is 160ms.
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 10 minutes.
  • the electronic device 100 establishes a connection with the audio playback device 200, the electronic device 200 sends audio data to the audio playback device 200, and the audio playback device 200 plays the audio data.
  • the electronic device 100 does not disconnect the connection with the audio playback device 200 and establishes a connection with the audio playback device 300 at the same time.
  • the audio playback device 300 establishes a Bluetooth connection with the electronic device 100 at time 10:00:240.
  • the audio playback device 300 After a period of time, the audio channel initialization of the audio playback device 300 is completed, the audio playback device 300 sends an audio channel initialization completion notification to the electronic device 100, and the electronic device 100 receives and responds to the audio channel initialization completion notification sent by the audio playback device 300. 100 starts to calculate the playback delay between the audio playback device 200 and the audio playback device 300 . How the electronic device 100 calculates the playback time delay of the audio playback device 200 and the audio playback device 300 has been described in detail in the foregoing embodiments, and will not be repeated in this application.
  • the audio path initialization of the audio playback device 300 is completed.
  • the electronic device 100 simultaneously sends a piece of audio data of a special frequency to the audio playback device 200 and the audio playback device 300 to calculate the playback delay of the audio playback device 200 and the audio playback device 300 .
  • the playback delay of the audio playback device 300 is calculated before the playback delay of the audio playback device 200 .
  • the calculation of the playback delay of the audio playback device 300 is completed, and at time 10:00:600, the calculation of the playback delay of the audio playback device 200 is completed.
  • the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300, because the playback delay of the audio playback device 200 is greater than the playback delay of the audio playback device 300, the electronic device 100 first sends the audio playback device 200 to the audio playback device 200. Stop playing the command.
  • the electronic device 100 sends a stop playing instruction to the audio playback device 200 at time 10:00:640.
  • the electronic device 100 Before the audio playback device 300 starts to play the audio data, the electronic device 100 also continues to send the audio data to the audio playback device 200 .
  • the electronic device 100 sends audio data with a timestamp of 2'30"00 to the audio playback device 200.
  • the electronic device 100 After the time ⁇ T after the electronic device 100 sends the instruction to stop playing to the audio playback device 200 , the electronic device 100 sends the instruction to start playback to the audio playback device 300 . It should be noted that the time ⁇ T is the difference between the playback delays of the audio playback device 200 and the audio playback device 300 .
  • the difference ⁇ T between the playback delays of the audio playback device 200 and the audio playback device 300 is 80ms.
  • the electronic device 100 sends a stop playing instruction to the audio playback device 200 at time 10:00:640. After 80 ms, the electronic device 100 sends a playback start instruction to the audio playback device 300 at time 10:00:720.
  • the stop playback instruction is transmitted to the audio playback device 200 through the Bluetooth channel between the electronic device 100 and the audio playback device 200, and then passes through the decoder in the audio playback device 200.
  • the data packet containing the stop play instruction is decoded, the audio playback device 200 recognizes the stop play instruction, and the audio playback device 200 controls the codec in the audio playback device 200 to stop working. After the codec in the audio playback device 200 stops working, the audio data decoded by the audio playback device 200 before the codec stops working will be played.
  • the audio playback device 200 receives the audio data sent by the electronic device 100, but the codec in the audio playback device 200 has stopped working and cannot decode the audio data. Therefore, the audio playback device 200 is in After the codec stops working, the audio data sent by the electronic device 100 will not be played.
  • the electronic device 100 sends the stop playback instruction to the audio playback device 200, it simultaneously sends the audio data of the time stamp corresponding to the time to the audio playback device 200. After the delay, the audio data of the time stamp is just decoded, and the codec of the audio playback device 200 just stops working.
  • the Bluetooth transmission delay of the audio playback device 200 is 80ms, and the encoding and decoding delay of the audio playback device 200 is 40ms. Therefore, the electronic device 100 sends the audio data with a timestamp of 2'30"00 to the audio playback device 200 at time 10:00:760. After the Bluetooth transmission delay of 80ms and the codec delay of 40ms, a total of 120ms later , the audio data with timestamp 2'30"00 is decoded at time 10:00:760.
  • the codec in the audio playback device 200 just stops working, and when the electronic device 100 sends the stop playback instruction to the audio playback device 200, the audio data of the corresponding timestamp sent just happens to be been decoded.
  • the audio data of the corresponding time stamp can be played by the audio playback device 200 , and the audio data of the corresponding time stamp is the audio data played last by the audio playback device 200 .
  • the audio data with a timestamp of 2'30"00 is decoded by the audio playback device 200, and after the hardware delay of the audio playback device 200, the time is 2'30
  • the audio data of the audio data of "00 is played out by the audio playback device 200 .
  • the hardware delay of the audio playback device 200 is 120ms, so at time 10:00:880, the audio data of the audio data with the time of 2'30"00 is played by the audio playback device 200 .
  • the electronic device 100 sends the audio playback device 200 the corresponding For the audio data of the time stamp, when the instruction to start playing is sent to the audio playback device 300 , the audio data corresponding to the time stamp is sent to the audio playback device 300 .
  • the time stamp of the audio data sent to the audio playback device 200 is 2'30"00. Therefore, at time 10 At :00:720, the electronic device 200 sends the audio playback device 300 the audio data with a timestamp of 2'30"00 while sending the playback start instruction to the audio playback device 300 . Since the playback delay of the audio playback device 300 is 160 ms, at time 10:00:880, the audio playback device 300 just plays the audio data with the timestamp of 2'30"00.
  • the time stamp of the last audio data played by the audio playback device 200 is 2'30"00
  • the audio playback device 300 just sets the time stamp to 2' 30"00 audio data is played. Therefore, the audio playback device 200 just stops playing, the audio playback device 300 just starts to play, and the audio playback device 200 and the audio playback device 300 can seamlessly switch and play audio data.
  • the electronic device 100 cannot obtain the audio data after the timestamp of the currently playing audio data in advance. Specifically, when the electronic device 100 discovers the audio playback device 300 , the electronic device 100 does not disconnect from the audio playback device 200 and establishes a Bluetooth connection with the audio playback device 300 . After that, after the initialization of the audio path of the audio playback device 300 is completed, the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300. After the playback delay of the audio playback device 200 and the audio playback device 300 is calculated, the electronic device The device 100 controls the audio playback device 200 and the audio playback device 300 to seamlessly switch and play audio data.
  • the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300 .
  • FIG. 11 exemplarily shows a sequence diagram in which the electronic device 100 realizes the seamless connection of audio data played by the audio playback device 200 and the audio playback device 300 .
  • the time shown in FIG. 11 and FIG. 11 is the system time of the electronic device 100 .
  • the Bluetooth transmission delay of the audio playback device 200 is 40ms
  • the encoding and decoding delay of the audio playback device 200 is 40ms
  • the hardware delay of the audio playback device 200 is 80ms
  • the playback delay of the audio playback device 200 is 160ms.
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes.
  • the Bluetooth transmission delay of the audio playback device 300 is 80ms, the codec delay of the audio playback device 300 is 40ms, and the hardware delay of the audio playback device 300 is 120ms, the playback delay of the audio playback device 300 is 240ms.
  • the relative time difference between the electronic device 100 and the audio playback device 300 is 10 minutes.
  • the electronic device 100 establishes a connection with the audio playback device 200, the electronic device 200 sends audio data to the audio playback device 200, and the audio playback device 200 plays the audio data.
  • the electronic device 100 does not disconnect the connection with the audio playback device 200 and establishes a connection with the audio playback device 300 at the same time.
  • the audio playback device 300 establishes a Bluetooth connection with the electronic device 100 at time 10:00:240.
  • the audio playback device 300 After a period of time, the audio channel initialization of the audio playback device 300 is completed, the audio playback device 300 sends an audio channel initialization completion notification to the electronic device 100, and the electronic device 100 receives and responds to the audio channel initialization completion notification sent by the audio playback device 300. 100 starts to calculate the playback delay between the audio playback device 200 and the audio playback device 300 . How the electronic device 100 calculates the playback time delay between the audio playback device 200 and the audio playback device 300 has been described in detail in the foregoing embodiments, and will not be repeated in this application.
  • the audio path initialization of the audio playback device 300 is completed.
  • the electronic device 100 simultaneously sends a piece of audio data of a special frequency to the audio playback device 200 and the audio playback device 300 to calculate the playback delay of the audio playback device 200 and the audio playback device 300 .
  • the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300
  • the playback delay of the audio playback device 200 is calculated before the playback delay of the audio playback device 300 .
  • the calculation of the playback delay of the audio playback device 200 is completed, and at time 10:00:600, the calculation of the playback delay of the audio playback device 300 is completed.
  • the electronic device 100 After the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300, because the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300, the electronic device 100 first sends a message to the audio playback device 300. Start playing the command.
  • the electronic device 100 sends a playback start instruction to the audio playback device 300 .
  • the electronic device 100 Before the audio playback device 300 starts to play the audio data, the electronic device 100 also continues to send the audio data to the audio playback device 200 .
  • the electronic device 100 sends the audio data with a timestamp of 2'30"00 to the audio playback device 200 while sending the playback start instruction to the audio playback device 300 .
  • the electronic device 100 Since the audio data is the audio data in the real-time call, the electronic device 100 cannot obtain the audio data after the timestamp 2'30"00 at the time 10:00:640. That is, at the same time, the electronic device 100 sends the audio playback device 200 to the audio playback device 200. It is the same as the time stamp of the audio data sent by the audio playback device 300 .
  • the electronic device 100 sends the audio data with the time stamp of 2'30"00 to the audio playback device 200
  • the electronic device 200 sends the audio data with the time stamp of 2'30"00 to the audio playback device 200.
  • the audio data is sent to the audio playback device 300 .
  • the electronic device 100 After the time ⁇ T after the electronic device 100 sends the instruction to start playing to the audio playing device 300 , the electronic device 100 sends the instruction to stop playing to the audio playing device 200 . It should be noted that the time ⁇ T is the difference between the playback delays of the audio playback device 200 and the audio playback device 300 .
  • the difference ⁇ T between the playback delays of the audio playback device 200 and the audio playback device 300 is 80ms.
  • the electronic device 100 sends a playback start instruction to the audio playback device 300 . After 80 ms, the electronic device 100 sends a stop playing instruction to the audio playback device 200 at time 10:00:720.
  • the electronic device 100 Before the audio playback device 300 starts to play the audio data, the electronic device 100 also continues to send the audio data to the audio playback device 200 .
  • the electronic device 100 sends audio data with a timestamp of 2'30"80 to the audio playback device 200 while sending a stop playing instruction to the audio playback device 200.
  • the electronic device 100 Since the audio data is the audio data in the real-time call, the electronic device 100 cannot obtain the audio data after the timestamp 2'30"80 at the time 10:00:720. That is, at the same time, the electronic device 100 sends the audio playback device 200 to the audio playback device 200. It is the same as the time stamp of the audio data sent by the audio playback device 300 .
  • the electronic device 100 sends audio data with a timestamp of 2'30"80 to the audio playback device 200, and the electronic device 200 sends the audio data with a timestamp of 2'30"80 to the audio playback device 200.
  • the audio data is sent to the audio playback device 300 .
  • the stop playback instruction is transmitted to the audio playback device 200 through the Bluetooth channel between the electronic device 100 and the audio playback device 200, and then passes through the decoder in the audio playback device 200.
  • the data packet containing the stop playing instruction is decoded, the audio playback device 200 recognizes the stop playback instruction, and the audio playback device 200 controls the codec in the audio playback device 200 to stop working. After the codec in the audio playback device 200 stops working, the audio data decoded by the audio playback device 200 before the codec stops working will be played.
  • the audio playback device 200 receives the audio data sent by the electronic device 100, but the codec in the audio playback device 200 has stopped working and cannot decode the audio data. Therefore, the audio playback device 200 is in After the codec stops working, the audio data sent by the electronic device 100 will not be played.
  • the electronic device 100 sends the stop playback instruction to the audio playback device 200, it simultaneously sends the audio data of the time stamp corresponding to the time to the audio playback device 200. After the delay, the audio data of the time stamp is just decoded, and the codec of the audio playback device 200 just stops working.
  • the Bluetooth transmission delay of the audio playback device 200 is 40ms
  • the encoding and decoding delay of the audio playback device 200 is 40ms. Therefore, the electronic device 100 sends the audio data with a timestamp of 2'30"80 to the audio playback device 200 at the time of 10:00:720. After the Bluetooth transmission delay of 40ms and the codec delay of 40ms, a total of 80ms later , the audio data with timestamp 2'30"80 is decoded at time 10:00:800.
  • the codec in the audio playback device 200 just stops working, and when the electronic device 100 sends the stop playback instruction to the audio playback device 200, the audio data of the corresponding timestamp sent just happens to be been decoded.
  • the audio data of the corresponding time stamp can be played by the audio playback device 200 , and the audio data of the corresponding time stamp is the audio data played last by the audio playback device 200 .
  • the audio data with a timestamp of 2'30"80 is decoded by the audio playback device 200, and after the hardware delay of the audio playback device 200, the time is 2'30 ”80 of the audio data is played by the audio playback device 200 .
  • the hardware delay of the audio playback device 200 is 80ms, so at time 10:00:880, the audio data of the audio data whose time is 2'30"80 is played by the audio playback device 200.
  • the electronic device 100 sends the audio data with a timestamp of 2'30"00 to the audio playback device 200 at time 10:00:640. Since the playback delay of the audio playback device 200 is 160ms, so at time 10:00 :800, the audio data with the timestamp of 2'30"00 is played by the audio playback device 200.
  • the time stamp of the audio data sent by the electronic device 100 to the audio playback device 300 at time 10:00:640 is 2'30"00. Since the playback delay of the audio playback device 300 is 240ms, therefore When the audio playback device 300 is at time 10:00:880, the audio data of the audio data whose time is 2'30"00 is played by the audio playback device 300 .
  • the time stamp of the audio data played last by the audio playback device 200 is 2'30"80.
  • the time stamp of the audio data that the audio playback device 300 just started playing is 2'30 "00. Therefore, the time stamp of the audio data repeatedly played by the audio playback device 300 and the audio playback device 200 is 2'30"00-2'30"80.
  • the volume of the played audio data Decrease gradually, when the audio playback device 300 plays the audio data whose time stamp is 2'30"00-2'30"80, the volume of the played audio data gradually increases.
  • the volume of the audio data played by the electronic device 100 with the time stamp 2'30"00-2'30"80 gradually decreases.
  • the volume of the audio data played by the electronic device 100 with a time stamp of 2'30"00-2'30"80 gradually increases.
  • the electronic device 100 when the electronic device 100 sends audio data with a timestamp of 2'30"00 to the audio playback device 200, the electronic device 100 sends a volume reduction instruction to the audio playback device 200 at the same time.
  • the electronic device 100 sends audio data with a timestamp of 2'30"00 to the audio playback device 200, and the electronic device 100 sends a volume reduction instruction to the audio playback device at the same time. 200.
  • the electronic device 100 sends the audio data with the time stamp of 2'30"00 to the audio playback device 300, the electronic device 100 sends an instruction to increase the volume to the audio playback device 300.
  • the electronic device 100 sends audio data with a timestamp of 2'30"00 to the audio playback device 300, and the electronic device 100 sends a volume increase instruction to the audio playback device. 300.
  • the playback delay of the audio playback device 200 is greater than the playback delay of the audio playback device 300 .
  • FIG. 12 exemplarily shows a sequence diagram in which the electronic device 100 realizes the seamless connection of audio data played by the audio playback device 200 and the audio playback device 300 .
  • time involved in the embodiments shown in FIG. 12 and FIG. 12 is the system time of the electronic device 100 .
  • the Bluetooth transmission delay of the audio playback device 200 is 80ms
  • the encoding and decoding delay of the audio playback device 200 is 40ms
  • the hardware delay of the audio playback device 200 is 120ms
  • the playback delay of the audio playback device 200 is 240ms.
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 5 minutes.
  • the Bluetooth transmission delay of the audio playback device 300 is 40ms
  • the codec delay of the audio playback device 300 is 40ms
  • the hardware delay of the audio playback device 300 is 80ms
  • the playback delay of the audio playback device 300 is 160ms.
  • the relative time difference between the electronic device 100 and the audio playback device 200 is 10 minutes.
  • the electronic device 100 establishes a connection with the audio playback device 200, the electronic device 200 sends audio data to the audio playback device 200, and the audio playback device 200 plays the audio data.
  • the electronic device 100 does not disconnect the connection with the audio playback device 200 and establishes a connection with the audio playback device 300 at the same time.
  • the audio playback device 300 establishes a Bluetooth connection with the electronic device 100 at time 10:00:240.
  • the audio playback device 300 After a period of time, the audio channel initialization of the audio playback device 300 is completed, the audio playback device 300 sends an audio channel initialization completion notification to the electronic device 100, and the electronic device 100 receives and responds to the audio channel initialization completion notification sent by the audio playback device 300. 100 starts to calculate the playback delay between the audio playback device 200 and the audio playback device 300 . How the electronic device 100 calculates the playback time delay between the audio playback device 200 and the audio playback device 300 has been described in detail in the foregoing embodiments, and will not be repeated in this application.
  • the audio path initialization of the audio playback device 300 is completed.
  • the electronic device 100 simultaneously sends a piece of audio data of a special frequency to the audio playback device 200 and the audio playback device 300 to calculate the playback delay of the audio playback device 200 and the audio playback device 300 .
  • the playback delay of the audio playback device 300 is calculated before the playback delay of the audio playback device 200 .
  • the calculation of the playback delay of the audio playback device 300 is completed, and at time 10:00:600, the calculation of the playback delay of the audio playback device 200 is completed.
  • the electronic device 100 calculates the playback delay of the audio playback device 200 and the audio playback device 300, because the playback delay of the audio playback device 200 is greater than the playback delay of the audio playback device 300, the electronic device 100 first sends the audio playback device 200 to the audio playback device 200. Stop playing the command.
  • the electronic device 100 sends a stop playing instruction to the audio playback device 200 at time 10:00:640.
  • the electronic device 100 Before the audio playback device 300 starts to play the audio data, the electronic device 100 also continues to send the audio data to the audio playback device 200 .
  • the electronic device 100 sends audio data with a timestamp of 2'30"00 to the audio playback device 200.
  • the electronic device 100 After the time ⁇ T after the electronic device 100 sends the instruction to stop playing to the audio playback device 200 , the electronic device 100 sends the instruction to start playback to the audio playback device 300 . It should be noted that the time ⁇ T is the difference between the playback delays of the audio playback device 200 and the audio playback device 300 .
  • the difference ⁇ T between the playback delays of the audio playback device 200 and the audio playback device 300 is 80ms.
  • the electronic device 100 sends a stop playing instruction to the audio playback device 200 at time 10:00:640. After 80 ms, the electronic device 100 sends a playback start instruction to the audio playback device 300 at time 10:00:720.
  • the stop playback instruction is transmitted to the audio playback device 200 through the Bluetooth channel between the electronic device 100 and the audio playback device 200, and then passes through the decoder in the audio playback device 200.
  • the data packet containing the stop playing instruction is decoded, the audio playback device 200 recognizes the stop playback instruction, and the audio playback device 200 controls the codec in the audio playback device 200 to stop working. After the codec in the audio playback device 200 stops working, the audio data decoded by the audio playback device 200 before the codec stops working will be played.
  • the audio playback device 200 receives the audio data sent by the electronic device 100, but the codec in the audio playback device 200 has stopped working and cannot decode the audio data. Therefore, the audio playback device 200 is in After the codec stops working, the audio data sent by the electronic device 100 will not be played.
  • the electronic device 100 sends the stop playback instruction to the audio playback device 200, it simultaneously sends the audio data of the time stamp corresponding to the time to the audio playback device 200. After the delay, the audio data of the time stamp is just decoded, and the codec of the audio playback device 200 just stops working.
  • the Bluetooth transmission delay of the audio playback device 200 is 80ms, and the encoding and decoding delay of the audio playback device 200 is 40ms. Therefore, the electronic device 100 sends the audio data with a timestamp of 2'30"00 to the audio playback device 200 at time 10:00:760. After the Bluetooth transmission delay of 80ms and the codec delay of 40ms, a total of 120ms later , the audio data with timestamp 2'30"00 is decoded at time 10:00:760.
  • the codec in the audio playback device 200 just stops working, and when the electronic device 100 sends the stop playback instruction to the audio playback device 200, the audio data of the corresponding timestamp sent just happens to be been decoded.
  • the audio data of the corresponding time stamp can be played by the audio playback device 200 , and the audio data of the corresponding time stamp is the audio data played last by the audio playback device 200 .
  • the audio data with a timestamp of 2'30"00 is decoded by the audio playback device 200, and after the hardware delay of the audio playback device 200, the time is 2'30
  • the audio data of the audio data of "00 is played out by the audio playback device 200 .
  • the hardware delay of the audio playback device 200 is 120ms, so at time 10:00:880, the audio data of the audio data with the time of 2'30"00 is played by the audio playback device 200 .
  • the electronic device 100 sends the audio playback device 200 the corresponding For the audio data of the time stamp, when the instruction to start playing is sent to the audio playback device 300 , the audio data corresponding to the time stamp is sent to the audio playback device 300 .
  • the time stamp of the audio data sent to the audio playback device 200 is 2'30"00. Therefore, at time 10 At :00:720, the electronic device 200 sends the audio playback device 300 the audio data with a timestamp of 2'30"00 while sending the playback start instruction to the audio playback device 300 . Since the playback delay of the audio playback device 300 is 160 ms, at time 10:00:880, the audio playback device 300 just plays the audio data with the timestamp of 2'30"00.
  • the time stamp of the last audio data played by the audio playback device 200 is 2'30"00
  • the audio playback device 300 just sets the time stamp to 2' 30"00 audio data is played. Therefore, the audio playback device 200 just stops playing, the audio playback device 300 just starts to play, and the audio playback device 200 and the audio playback device 300 can seamlessly switch and play audio data.
  • FIG. 13 is a flowchart of a method for seamless switching of audio data provided by an embodiment of the present application.
  • the method is applied to an audio playback system, and the audio playback includes an electronic device 100 , an audio playback device 200 and an audio playback device 300 .
  • the hardware structure of the audio playback device 200 and the audio playback device 300 may refer to the structure of the audio playback device in the following embodiment shown in FIG. 16 , which will not be repeated here.
  • the playback time delay of the audio playback device 200 is greater than the playback time delay of the audio playback device 300, and the electronic device 100 realizes seamless switching of playback audio data between two Bluetooth devices.
  • the electronic device 100 realizes seamless playback of audio data between two Bluetooth devices switch.
  • the electronic device 100 realizes seamless playback of audio data between two Bluetooth devices switch.
  • S13010-S1313 may be executed first, and then S13014-S1319 may be executed, and then S1305-S1308 may be executed; in the embodiment of the application, S13014-S1319 may be executed first, S13010-S1313 may be executed, and then S1305-S1308 may be executed, etc. etc., this application does not limit the execution order of S13010-S1313, S13014-S1319, and S1305-S1308.
  • the electronic device 100 establishes a communication connection with the audio playback device 200 .
  • the electronic device 100 may establish a communication connection with the audio playback device 200 through any one of Bluetooth, Wi-Fi Direct, local area network, and the like.
  • the embodiments of the present application are described by taking an example of establishing a communication connection between the electronic device 100 and the audio playback device 200 through the Bluetooth technology.
  • the electronic device 100 After the electronic device 100 establishes a Bluetooth connection with the audio playback device 200, the electronic device 100 sends the audio data to the audio playback device 200, and the audio playback device 200 plays the audio data.
  • the audio data may be audio data played in a music or video application, or may be audio data in a real-time call, and the real-time call may include a voice call, a video call, and the like.
  • the electronic device 100 establishes a communication connection with the audio playback device 300 without disconnecting the communication connection with the audio playback device 200 .
  • the audio playback device 300 After the electronic device 100 establishes a communication connection with the audio playback device 200, the audio playback device 300 is turned on, the electronic device 100 does not disconnect the connection with the audio playback device 200, and the electronic device 100 establishes a communication connection with the audio playback device 200. 300 A communication connection is established.
  • the electronic device 100 establishes a connection with the second Bluetooth device and the device 300, please refer to the embodiments shown in FIG. 3A-FIG. 5B, which will not be repeated in this application.
  • the electronic device 100 determines the playback delay of the audio playback device 200 (the first playback delay) and the playback delay of the audio playback device 300 (the second playback delay).
  • the electronic device 100 if the electronic device 100 has established communication connections with the audio playback device 200 and the audio playback device 300 before, the electronic device 100 stores the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300, Then the electronic device 100 may not execute S1303. The electronic device 100 directly obtains the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 from the electronic device 100 without calculating the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 .
  • the playback delay of the audio playback device 200 (the first playback delay) and the playback delay of the audio playback device 300 (the second playback delay) may refer to include transmission delay and hardware delay.
  • the playback delay of the audio playback device 200 starts timing when the audio playback device 200 receives the first audio frame, and stops timing until the audio playback device 200 plays the first audio frame. This period of time is the playback time of the audio playback device 200 time delay.
  • the playback delay of the audio playback device 300 starts timing when the audio playback device 300 receives the second audio frame, and stops timing until the audio playback device 300 plays the second audio frame, which is the playback delay of the audio playback device 300 .
  • the calculation process of the first playback delay and the second playback delay is as follows: after the electronic device establishes a communication connection with the second audio playback device, the electronic device starts to send a stop instruction to the first audio playback device or sends a Before the second audio playback device sends the start instruction, the electronic device also needs to calculate the playback delay of the first audio playback device and the second audio playback device. Specifically, the electronic device sends the first test data to the first audio playback device, and sends the second test data to the second audio playback device.
  • the electronic device receives the first information including the fifth moment and the sixth moment sent by the first audio playback device; wherein, the fifth moment is the moment when the first test data reaches the first audio playback device to play, and the sixth moment is the first The moment when the audio playback device plays the first test data.
  • the electronic device determines the first playback delay, and the first playback delay is the difference between the sixth time and the fifth time; the electronic device determines the second playback delay, and the second playback time delay is the eighth time and the seventh time. difference value. In this way, the electronic device calculates the playback delay of the first audio playback device and the second audio playback device, which provides a possibility for seamless playback of audio data when the first audio playback device and the second audio playback device are switched subsequently.
  • the electronic device 100 executes S1305-S1308.
  • the audio playback device 200 has just finished playing the audio data of the first time stamp and stops playing the audio data, and the audio playback device 200 has just started playing Audio data for the first timestamp.
  • the seamless switching of audio data playback is realized.
  • the electronic device 100 executes S1309.
  • the real-time call application scenario that is, the audio data is unpredictable
  • the music or video playback application scenario that is, the audio data is predictable
  • the real-time call application scenario cannot obtain the audio data after the current timestamp in advance. Therefore, in the final audio The playback device 200 stops playing, and the time stamps of the audio data that the audio playback device 300 starts to play are different.
  • the audio data after the current time stamp can be obtained in advance, because the electronic device 100 is the audio data.
  • the entire corresponding file is downloaded locally, so at the end the audio playback device 200 stops playing, and the time stamps of the audio data that the audio playback device 300 starts to play are the same.
  • the audio playback device 200 and the audio playback device 300 play overlapping audio data segments.
  • the audio playback device The volume of 200 gradually decreases, and the volume of the audio playback device 300 gradually increases. For the two different situations, the strategies are different and need to be handled separately.
  • the electronic device 100 may also determine the type of audio data first, and then select a corresponding strategy according to the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 .
  • the electronic device 100 sends the stop playing instruction and the audio data (first audio frame) corresponding to the first timestamp to the audio playback device 200 (first audio playback device) at the Mth moment (second moment).
  • the Mth time instant may be the time of 640 ms as shown in FIG. 10 or FIG. 12 .
  • the electronic device 100 needs to send the stop playback instruction to the audio playback device 200 first, so that the audio playback device 200 is just fine to stop playback and the audio playback Device 300 has just started playing.
  • the electronic device 100 sends a stop playback instruction to the audio playback device 200.
  • the time stamp of the audio data played by the electronic device 100 is the first time stamp, then the electronic device 100 also needs to The audio data corresponding to the time stamp is sent to the audio playback device 200 .
  • the Mth time is the system time of the electronic device 100 .
  • the first timestamp is the playback progress of the audio data played by the electronic device 100 .
  • the electronic device 100 sends the playback start instruction and the audio data (second audio frame) corresponding to the second timestamp to the audio playback device 300 (second audio playback device) at the Nth moment (third moment).
  • the Nth time instant may be the time of 720 ms as shown in FIG. 10 or FIG. 12 .
  • the Nth time is greater than the Mth time, and the difference between the Nth time and the Mth time is the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 .
  • the electronic device 100 sends the audio data corresponding to the stop playback instruction and the first timestamp to the audio playback device 200, the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 has passed.
  • the electronic device 100 sends the start playing instruction and the audio data corresponding to the second timestamp to the audio playing device 300 .
  • the audio playback device 200 stops playing the audio data at the Pth time (the fourth time).
  • the Pth time instant may be the 880 ms time as shown in FIG. 10 or FIG. 12 .
  • the audio playback device 300 starts playing the audio data at the P-th time stamp, and the time stamp is the second time stamp.
  • the Pth time instant may be the 880 ms time as shown in FIG. 10 or FIG. 12 .
  • the audio data of the first time stamp may be audio data with a time stamp of 2'30"00 as shown in FIG. 10 or FIG. 12 .
  • the audio data of the second time stamp may be the audio data of the time stamp adjacent to the time stamp after 2'30"00 as shown in FIG. 10 or FIG. 12 .
  • the audio data with the time stamp of 2'30"00 sent by the electronic device 100 to the audio playback device 300 may also be the time stamp of the adjacent time stamp after the time stamp of 2'30"00. audio data.
  • the difference between the Pth time and the Mth time is the playback delay of the audio playback device 200 .
  • the audio playback device 200 receives the audio data corresponding to the first timestamp sent by the electronic device 100 at the Mth moment, and after the playback delay time of the audio playback device 200, that is, at time 3, the last audio data played by the audio playback device 200 The timestamp is the first timestamp. After that, the electronic device 100 stops playing the audio data.
  • the difference between time three and time two is the playback delay of the audio playback device 300 .
  • the audio playback device 300 receives the audio data corresponding to the second time stamp sent by the electronic device 100 at the Nth time, after the playback delay time of the audio playback device 300, that is, at time three, the audio data that the audio playback device 300 starts to play.
  • the timestamp is the second timestamp. After that, the electronic device 100 will play the second time stamp and the audio data after the second time stamp.
  • the audio playback device 300 just starts to play the audio data.
  • the time stamp when the audio playback device 200 just stopped playing the audio data coincides with the time stamp when the audio playback device 300 just started playing the audio data, which solves the problem of audio data interruption when the electronic device 100 switches the Bluetooth device, and improves the user experience.
  • the moment when the audio playback device 200 stops playing the audio data and the moment when the audio playback device 300 starts to play the audio data are not at the same moment (for example, the Pth moment), that is, S1308 also It can be executed before S1307, S1307 can also be executed after S1308, and S1301 and S1308 can also be executed together.
  • S1308 also It can be executed before S1307
  • S1307 can also be executed after S1308, and S1301 and S1308 can also be executed together.
  • a certain threshold eg 50ms
  • S1304-S1308 can be replaced with:
  • the electronic device 100 sends a stop playing instruction and the first audio frame to the audio playing device 200 at the second moment.
  • the electronic device 100 sends a playback start instruction and a second audio frame to the audio playback device 300 at the third moment.
  • the audio playback device 200 stops playing the audio data after the first audio frame is played at the first moment.
  • the audio playback device 300 starts to play the second audio frame at the first moment after the start instruction and the second audio frame sent by the electronic device 100 .
  • the difference between the first moment and the second moment is the first playback delay of the audio playback device 200, and the difference between the first moment and the illustrated third moment is the second playback delay of the audio playback device 300;
  • the difference between the second moment and the third moment is the first value
  • the delay difference between the first playback delay and the second playback delay is the first value
  • the first playback time delay is greater than the second playback time delay
  • the first time is prior to the second time
  • the first playback time delay is smaller than the second playback time delay
  • the second time is prior to the first time
  • the first moment may be 880ms as shown in FIG. 9, the second moment may be 720ms as shown in FIG. 9, and the third moment may be as shown in FIG. 640ms shown in 9.
  • the first moment may be 880ms as shown in FIG. 9, the second moment may be 640ms as shown in FIG. 9, and the third moment may be as shown in FIG. 720ms shown in 9
  • the second audio frame is the next audio data frame adjacent to the first audio frame.
  • the electronic device when the electronic device establishes the connection with the second audio data, it does not disconnect the connection with the first audio playback device.
  • the second audio playback device starts to play the audio data
  • the first audio playback device stops playing the audio data after playing the first audio frame
  • the electronic device is disconnected from the first audio playback device, in order to achieve seamless playback of the audio data provided the possibility.
  • the electronic device after the electronic device establishes a communication connection with the second audio playback device, before the electronic device starts to send a stop instruction to the first audio playback device or sends a start instruction to the second audio playback device, the electronic device further needs to calculate The playback delay of the first audio playback device and the second audio playback device is calculated. Specifically, the electronic device sends the first test data to the first audio playback device, and sends the second test data to the second audio playback device. The electronic device receives the first information including the fourth moment and the fifth moment sent by the first audio playback device; wherein, the fourth moment is the moment when the first test data leaves the electronic device, and the fifth moment is the first audio playback device.
  • the electronic device receives the second information that includes the sixth moment and the seventh moment sent by the second audio playback device; wherein, the sixth moment is the moment when the second test data leaves the electronic device, and the seventh moment
  • the electronic device determines the first playback delay, which is the difference between the fifth moment and the fourth moment
  • the electronic device determines the second playback delay , and the second playback delay is the difference between the seventh moment and the sixth moment.
  • the electronic device can calculate the playback delay of the first audio playback device and the playback delay of the second audio playback device.
  • the playback delay of the second audio playback device is stored in the electronic device, and thereafter, the electronic device does not need to recalculate the playback delay of the first audio playback device and the playback delay of the second audio playback device each time.
  • the predictable audio data may be audio data played in a music or video application.
  • the unpredictable audio data may be audio data in a real-time call, such as a voice call, a video call, and the like.
  • the playback delay of the audio playback device 200 is smaller than the playback delay of the audio playback device 300, for unpredictable audio data, the electronic device 100 cannot obtain the audio data after the current timestamp in advance. Therefore, the audio playback device 200 and the audio The playback device 300 will repeatedly play a piece of audio data.
  • the volume gradually decreases, and the audio playback device 300 plays the repeated audio data segment. , the volume gradually increases to solve the problem of repeated playback.
  • the electronic device 100 can obtain audio data after the current time stamp in advance, so in an ideal situation, the audio playback device 200 and the audio playback device 300 can be seamlessly connected.
  • S1310-S1313 may be executed first, and then S1314-S1319 may be executed; or S1314-S1319 may be executed first, and then S1310-S1313 may be executed, which is not limited here.
  • the electronic device 100 may not determine the type of the audio data, and treat the audio data of all scenarios as a real-time call application scenario, and S1309 may not be executed.
  • the electronic device 100 sends the audio data (the first audio frame) corresponding to the start playing instruction and the second timestamp to the audio playing device 300 at the Mth time (the sixth time).
  • the electronic device 100 sends the audio playback instruction and the audio data corresponding to the first timestamp to the audio playback device 200 at the Nth time (the fifth time).
  • the Nth time instant may be the time of 720 ms as shown in FIG. 9 .
  • the Nth time is greater than the Mth time, and the difference between the Nth time and the Mth time is the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 .
  • the electronic device 100 sends the audio data corresponding to the start playback instruction and the second timestamp to the audio playback device 300, the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 has passed.
  • the electronic device 100 sends the stop playing instruction and the audio data corresponding to the first timestamp to the audio playing device 200 .
  • the audio playback device 200 stops playing the audio data at the Pth time (the fourth time).
  • the audio playback device 300 starts playing the audio data at the Pth time (the fourth time), and the time stamp is the second time stamp.
  • the Pth time instant may be the 880 ms time as shown in FIG. 9 .
  • the difference between time three and time two is the playback delay of the audio playback device 200 .
  • the audio playback device 200 receives the audio data corresponding to the first timestamp sent by the electronic device 100 at the Nth time, and after the playback delay time of the audio playback device 200, that is, at time three, the audio playback device 200 plays the last audio data.
  • the timestamp is the first timestamp. After that, the electronic device 100 stops playing the audio data.
  • the difference between the Pth time and the Mth time is the playback delay of the audio playback device 300 .
  • the audio playback device 300 receives the audio data corresponding to the second time stamp sent by the electronic device 100 at the M-th time, and after the playback delay time of the audio playback device 300, that is, at time three, the audio data of the audio playback device 300 starts to play.
  • the timestamp is the second timestamp. After that, the electronic device 100 will play the second time stamp and the audio data after the second time stamp.
  • the audio playback device 300 just starts to play the audio data.
  • the time stamp when the audio playback device 200 just stopped playing the audio data coincides with the time stamp when the audio playback device 300 just started playing the audio data, which solves the problem of audio data interruption when the electronic device 100 switches the Bluetooth device, and improves the user experience.
  • the moment when the audio playback device 200 stops playing the audio data and the moment when the audio playback device 300 starts to play the audio data are not at the same moment (for example, the Pth moment), that is, S1313 also It can be executed before S1312, S1312 can also be executed after S1313, and S1312 and S1313 can also be executed together.
  • S1313 also It can be executed before S1312, S1312 can also be executed after S1313, and S1312 and S1313 can also be executed together.
  • a certain threshold eg 50ms
  • the electronic device 100 sends a playback start instruction, audio data (first audio frame) corresponding to the first timestamp, and a volume gradually increasing instruction to the audio playback device 300 at the Mth moment (third moment).
  • the Mth time instant may be the time of 640 ms as shown in FIG. 11 .
  • the electronic device 100 needs to send the start playback instruction to the audio playback device 300 first, so that the audio playback device 200 is just fine to stop playback and the audio playback Device 300 has just started playing.
  • the electronic device 100 sends the playback start instruction to the audio playback device 300, and at the Mth moment, the time stamp of the audio data played by the electronic device 100 is the first time stamp, then the electronic device 100 also needs to The audio data corresponding to the time stamp and the instruction to gradually increase the pronunciation volume are sent to the audio playback device 300 .
  • the Mth time is the system time of the electronic device 100 .
  • the first timestamp is the playback progress of the audio data played by the electronic device 100 .
  • the electronic device 100 sends the audio data corresponding to the first timestamp and the volume gradually decreasing instruction to the audio playback device 200 at the Mth time (third time).
  • the Mth time instant may be the time of 640 ms as shown in FIG. 11 .
  • the electronic device 100 Since the audio data is unpredictable audio data, at the Mth moment, the electronic device 100 also needs to send the audio data corresponding to the first timestamp and the volume gradually decreasing instruction to the audio playback device 200.
  • the electronic device 100 may first execute S1315, and after executing S1314, the electronic device 100 may first execute S1314, and after executing S1315, the electronic device 100 may also execute S1314 and S1315 at the same time, which is not limited herein.
  • the electronic device 100 sends the audio data (second audio frame) corresponding to the stop playing instruction and the second timestamp to the audio playing device 200, where the second timestamp is greater than the first timestamp.
  • the Nth time instant may be the 720 ms time as shown in FIG. 11 .
  • the audio data corresponding to the second time stamp may be audio data with a time stamp of 2'30"80 as shown in FIG. 11 .
  • the Nth time is greater than the Mth time, and the difference between the Nth time and the Mth time is the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 .
  • the electronic device 100 sends the audio data corresponding to the start playback instruction and the first timestamp to the audio playback device 300, the difference between the playback delay of the audio playback device 200 and the playback delay of the audio playback device 300 has passed.
  • the electronic device 100 sends the stop playback instruction and the audio data corresponding to the second timestamp to the audio playback device 200 .
  • the electronic device 100 Since the audio data is unpredictable audio data, at the Nth moment, the electronic device 100 also needs to send the audio data corresponding to the second timestamp to the audio playback device 300 .
  • the audio playback device 200 plays the audio data corresponding to the first timestamp at the Pth time (the first time).
  • the Pth time instant may be the 800 ms time as shown in FIG. 11 .
  • the difference between the Pth time and the Mth time is the playback delay of the audio playback device 200 . That is, the electronic device 100 sends the audio data corresponding to the first time stamp to the audio playback device 200 at the Mth moment, and after the playback delay time of the audio playback device 200 passes, at the Pth moment, the audio playback device 200 sends the first time stamp to the audio playback device 200. Poke the corresponding audio data to play it out.
  • the codec in the first Bluetooth device 100 just stops working at the Pth moment, then at the Pth moment, the timestamp of the audio data finally decoded by the audio playback device 200 is the second timestamp. Then, the difference between the Pth time and the Nth time is the Bluetooth transmission delay and the encoding and decoding delay of the first Bluetooth device 100 .
  • the audio playback device 200 is at the Qth moment (second moment), and the timestamp of the last played audio data is the second timestamp.
  • the Qth time instant may be the 880 ms time as shown in FIG. 11 .
  • the difference between the Qth time and the Nth time is the playback delay of the audio playback device 200
  • the difference between the Qth time and the Pth time is the hardware delay of the audio playback device 200 .
  • the time stamp of the audio data decoded by the audio playback device 200 last is the second time stamp, and after the hardware delay of the audio playback device 200, that is, at the Qth moment, the audio playback device 200 last The time stamp of the played audio data is the second time stamp.
  • the Qth time instant may be the 880 ms time as shown in FIG. 11 .
  • the difference between the Qth moment and the Mth moment is the playback delay of the audio playback device 300. It can be seen from S1315 that the electronic device 100 sends the audio data corresponding to the first timestamp to the audio playback device 200 at the Mth moment, and has experienced After the playback delay of the audio playback device 300, the Qth moment is recorded, and the time stamp of the audio data just started to be played by the audio playback device 300 is the first time stamp.
  • the time stamp of the audio data played last by the audio playback device 200 is the second time stamp
  • the time stamp of the audio data just started to be played by the audio playback device 300 is the first time stamp. Therefore, the audio playback device 300 will repeatedly play the audio data between the first time stamp and the second time stamp that has been played by the first Bluetooth device 300 .
  • the electronic device 100 sends the audio playback device 300 a volume gradually increasing command while sending the first time stamped audio data to the audio playback device 200. big order.
  • the audio playback device 200 plays the audio data between timestamp 1 and timestamp 2
  • the volume of the played audio data gradually decreases
  • the audio playback device 300 plays the audio data between timestamp 1 and timestamp 2.
  • the volume of playing audio data gradually increases, which has solved the problem of two Bluetooth devices playing audio data repeatedly.
  • S1309 and S1319 may be replaced by:
  • the electronic device When the playback delay of the audio playback device 200 is less than the playback delay of the audio playback device 300, the electronic device does not need to determine the type of audio data, and treats both predictable audio data and unpredictable audio data as unpredictable audio data to be processed.
  • the electronic device 100 sends the first instruction and the first audio frame to the audio playback device 200 at the third moment.
  • the electronic device 100 sends the second instruction and the first audio frame to the audio playback device 300.
  • the audio playback device 200 plays the first audio frame with the volume decreasing at the first moment, and stops playing the audio data at the second moment.
  • the audio playback device 300 After receiving the second instruction and the first audio frame sent by the electronic device, the audio playback device 300 increases the volume to play the first audio frame at a second moment.
  • the second instruction includes an instruction to increase the volume and an instruction to start playing.
  • the electronic device 100 sends the first instruction and the first audio frame to the audio playback device 200; at the third moment, the electronic device 100 sends the second instruction and the first audio frame to the audio playback device 300; wherein the first moment
  • the difference from the third moment is the first playback delay of the audio playback device 200, the difference between the second moment and the third moment is the second playback delay of the audio playback device 300; The difference is the first value, and the delay difference between the first playback delay and the second playback delay is the first value.
  • the first playback delay of the first audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the first audio playback device plays the first audio frame. This period of time is the duration of the first audio playback device.
  • the second playback delay of the second audio playback device starts timing when the first audio frame leaves the electronic device, and stops timing until the second audio playback device plays the first audio frame. This period of time is the second time of the second audio playback device. Playback delay.
  • the first audio frame may be audio data during a real-time call or playing music or video.
  • the first playback delay includes the Bluetooth transmission delay of the first audio device, the decoding delay of the first audio device, and the hardware delay of the first audio device.
  • the second playback delay includes the Bluetooth transmission delay of the second audio device, the decoding delay of the second audio device, and the hardware delay of the second audio device.
  • the electronic device 100 also sends a second audio frame to the audio playback device 200, and the first instruction is used to instruct the audio playback device 200 to decrease the volume at the first moment to play the first audio frame after receiving the first instruction and the first audio frame sent by the electronic device. After one audio frame, playback of the audio data is stopped after the second audio frame is played at the second moment.
  • the volume decrease may be a linear reduction of the volume, or a reduction of the volume gradient, and the volume is not reduced after the volume is reduced to a preset value, or the volume is not reduced after a certain period of time.
  • the first instruction includes an instruction to decrease the volume and an instruction to stop playing.
  • the first moment may be the 800ms moment as shown in FIG. 11
  • the second moment may be the 880ms moment as shown in FIG. 11
  • the third moment may be the 640ms moment as shown in FIG. 11 .
  • the electronic device before the electronic device starts to send a stop instruction to the first audio playback device or sends a start instruction to the second audio playback device, the electronic device also needs to calculate the playback of the first audio playback device and the second audio playback device. time delay. Specifically, the electronic device sends the first test data to the first audio playback device, and sends the second test data to the second audio playback device. The electronic device receives the first information including the seventh moment and the eighth moment sent by the first audio playback device; wherein, the seventh moment is the moment when the first test data leaves the electronic device, and the eighth moment is the first audio playback device playing the first information. A moment of test data.
  • the electronic device receives the second information including the ninth time and the tenth time sent by the second audio playback device; wherein, the ninth time is the time when the second test data leaves the electronic device, and the tenth time is when the second audio playback device plays the first time. 2. The moment of test data.
  • the electronic device determines the first playback delay, and the first playback delay is the difference between the eighth time point and the seventh time point.
  • the electronic device determines the second playback delay, and the second playback delay is the difference between the tenth time and the ninth time. In this way, the electronic device calculates the playback delay of the first audio playback device and the second audio playback device, which provides a possibility for seamless playback of audio data when the first audio playback device and the second audio playback device are switched subsequently.
  • the electronic device can calculate the playback delay of the first audio playback device and the playback delay of the second audio playback device.
  • the playback delay of the second audio playback device is stored in the electronic device, and thereafter, the electronic device does not need to recalculate the playback delay of the first audio playback device and the playback delay of the second audio playback device each time.
  • the electronic device before the electronic device starts to send a stop instruction to the first audio playback device or sends a start instruction to the second audio playback device, the electronic device also needs to calculate the playback of the first audio playback device and the second audio playback device. time delay. Specifically, the electronic device sends the first test data to the first audio playback device, and sends the second test data to the second audio playback device. The electronic device receives the first information including the seventh moment and the eighth moment sent by the first audio playback device; wherein, the seventh moment is the moment when the first test data leaves the electronic device, and the eighth moment is the first audio playback device playing the first information. A moment of test data.
  • the electronic device receives the second information including the ninth time and the tenth time sent by the second audio playback device; wherein, the ninth time is the time when the second test data leaves the electronic device, and the tenth time is when the second audio playback device plays the first time. 2. The moment of test data.
  • the electronic device determines the first playback delay, and the first playback delay is the difference between the eighth time point and the seventh time point.
  • the electronic device determines the second playback delay, and the second playback delay is the difference between the tenth time and the ninth time. In this way, the electronic device calculates the playback delay of the first audio playback device and the second audio playback device, which provides a possibility for seamless playback of audio data when the first audio playback device and the second audio playback device are switched subsequently.
  • the electronic device can calculate the playback delay of the first audio playback device and the playback delay of the second audio playback device.
  • the playback delay of the second audio playback device is stored in the electronic device, and thereafter, the electronic device does not need to recalculate the playback delay of the first audio playback device and the playback delay of the second audio playback device each time.
  • the electronic device 100 when the playback delay of the audio playback device 200 is greater than the playback delay of the audio playback device 300, the electronic device 100 further performs the following steps:
  • the first playback delay of the audio playback device 200 is greater than the second playback delay of the audio playback device 300
  • the first instruction and the first audio frame are sent to the audio playback device 200 .
  • the electronic device 100 sends the second instruction and the first audio frame to the audio playback device 300 at the sixth moment.
  • the first audio playback device after receiving the first instruction and the first audio frame sent by the electronic device, plays the first audio frame in a decreasing volume at the fourth moment, and stops playing the audio data after the first audio frame is played;
  • the second audio playback device after receiving the second instruction and the first audio frame sent by the electronic device, increases the volume at the fourth moment to play the first audio frame.
  • the volume decrease may be a linear reduction of the volume, or a reduction of the volume gradient, and the volume is not reduced after the volume is reduced to a preset value, or the volume is not reduced after a certain period of time.
  • the volume increase may be a linear increase of the volume, or an increase of the volume gradient, and the volume is not increased after the volume is increased to a preset value, or the volume is not increased after a certain period of time.
  • the present application does not limit the manner of decreasing the volume and increasing the volume.
  • the electronic device sends the first instruction and the first audio frame to the first audio playback device, and the electronic device sends the first instruction and the first audio frame to the first audio playback device.
  • the second instruction and the first audio frame are sent to the second audio playback device.
  • the first audio playback device stops playing the audio data after finishing playing the first audio frame, and the second audio playback device just starts to play the first audio frame. That is, the audio data repeatedly played by the first audio playback device and the second audio playback device is the first audio frame.
  • the first audio frame is played by decreasing the volume of the first audio playback device, and the first audio frame is played by increasing the volume of the second audio playback device.
  • the problem of repeated playback has been solved to achieve non-interrupted playback. audio data.
  • the first instruction includes an instruction to decrease the volume and an instruction to stop playing;
  • the second instruction includes an instruction to increase the volume and an instruction to start playing.
  • the volume decrease instruction is used to instruct the first audio playback device to decrease the volume to play the first audio frame after receiving the first audio frame;
  • the stop playback instruction is used to instruct the first audio playback device to play the first audio frame after receiving the second audio frame. Stop playing audio data after the second audio frame.
  • the volume increasing instruction is used to instruct the second audio playing device to play the first audio frame with increasing volume after receiving the first audio frame.
  • the electronic device may also send a volume increase instruction and a playback stop instruction to the first audio playback device, respectively.
  • the fourth moment may be the 880ms moment shown in FIG. 10 or FIG. 12 .
  • the first audio frame may be audio data with a time stamp of 2'30"00 at the time of 880ms shown in FIG. 10 or FIG. 12 .
  • the fifth moment may be the 640 ms moment shown in FIG. 10 or FIG. 12 .
  • the sixth moment may be the 720ms moment shown in FIG. 10 or FIG. 12 .
  • the first instruction includes an instruction to decrease the volume and an instruction to stop playing.
  • the second instruction includes an instruction to increase the volume and an instruction to start playing.
  • the electronic device sends the first instruction and the first audio frame to the first audio playback device, and the electronic device sends the first instruction and the first audio frame to the first audio playback device.
  • the second instruction and the first audio frame are sent to the second audio playback device.
  • the first audio playback device receives the first instruction and the first audio frame at the fourth time
  • the second audio playback device receives the second command and the second audio frame at the fifth time
  • the fourth time precedes the fifth time.
  • the difference between the fifth time and the fourth time is the difference between the first playback delay and the second playback delay.
  • the first audio playback device stops playing the audio data after finishing playing the first audio frame, and the second audio playback device just starts to play the first audio frame. That is, the audio data repeatedly played by the first audio playback device and the second audio playback device is the first audio frame.
  • the first audio frame is played by decreasing the volume of the first audio playback device, and the first audio frame is played by increasing the volume of the second audio playback device. The problem of repeated playback has been solved to achieve non-interrupted playback. audio data.
  • FIG. 14 shows a schematic structural diagram of the electronic device 100 .
  • the electronic device 100 shown in FIG. 14 is only an example, and the electronic device 100 may have more or fewer components than those shown in FIG. 14, two or more components may be combined, or Different component configurations are possible.
  • the various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, And a subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G etc. applied on the electronic device 100.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system, GLONASS
  • Beidou navigation satellite system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system, QZSS
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • the camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing the instructions stored in the internal memory 121 .
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate for according to the angle, and allows the lens to counteract the shake of the electronic device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlock and lock screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to touch operations may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal.
  • the bone conduction sensor 180M can also be disposed in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication.
  • the electronic device 100 employs an eSIM, ie: an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of the present invention takes an Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 as an example.
  • FIG. 15 is a block diagram of a software structure of an electronic device 100 according to an embodiment of the present invention.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication function of the electronic device 100 .
  • the management of call status including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
  • the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • surface manager surface manager
  • media library Media Libraries
  • 3D graphics processing library eg: OpenGL ES
  • 2D graphics engine eg: SGL
  • the Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
  • a corresponding hardware interrupt is sent to the kernel layer.
  • the kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer.
  • the application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and then starts the camera driver by calling the kernel layer.
  • the camera 193 captures still images or video.
  • FIG. 16 exemplarily shows a schematic diagram of the hardware structure of an audio playback device.
  • FIG. 16 exemplarily shows a schematic structural diagram of an audio playback device (eg, an audio playback device 200 and an audio playback device 300 ) provided by an embodiment of the present application.
  • an audio playback device eg, an audio playback device 200 and an audio playback device 300
  • the audio playback device shown in Figure 16 is only an example, and that the audio playback device may have more or fewer components than those shown in Figure 16, two or more components may be combined, or Different component configurations are possible.
  • the various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the audio playback device may include: a processor 201 , a memory 202 , a wireless communication processing module 203 , a power switch 205 , a USB communication processing module 206 , and an audio module 207 . in:
  • the processor 201 may be used to read and execute computer readable instructions.
  • the processor 201 may mainly include a controller, an arithmetic unit, and a register.
  • the controller is mainly responsible for instruction decoding, and sends out control signals for the operations corresponding to the instructions.
  • the arithmetic unit is mainly responsible for saving the register operands and intermediate operation results temporarily stored during the execution of the instruction.
  • the hardware architecture of the processor 201 may be an application specific integrated circuit (ASIC) architecture, a MIPS architecture, an ARM architecture, an NP architecture, or the like.
  • ASIC application specific integrated circuit
  • the processor 201 may be configured to parse a signal received by the Bluetooth communication processing module 203A, such as a pairing mode modification request sent by the electronic device 100, and the like.
  • the processor 201 may be configured to perform corresponding processing operations according to the parsing result, such as generating a pairing mode modification response, and the like.
  • Memory 202 is coupled to processor 201 for storing various software programs and/or sets of instructions.
  • memory 202 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
  • the memory 202 can store operating systems, such as embedded operating systems such as uCOS, VxWorks, RTLinux, and the like.
  • Memory 202 may also store communication programs that may be used to communicate with electronic device 100, one or more servers, or other devices.
  • the wireless communication processing module 203 may include one or more of a Bluetooth (BT) communication processing module 203A and a WLAN communication processing module 203B.
  • BT Bluetooth
  • WLAN WLAN
  • one or more of the Bluetooth (BT) communication processing module and the WLAN communication processing module may listen to signals transmitted by other devices (eg, electronic device 100 ), such as probe requests, scan signals, etc., and A response signal, such as a probe response, a scan response, etc., can be sent, so that other devices (such as the electronic device 100) can discover the audio playback device and establish a wireless communication connection with other devices (such as the electronic device 100) through a Bluetooth or a WLAN.
  • One or more wireless communication technologies to communicate with other devices, such as electronic device 100 may listen to signals transmitted by other devices (eg, electronic device 100 ), such as probe requests, scan signals, etc., and A response signal, such as a probe response, a scan response, etc., can be sent, so that other devices (such as the electronic device 100) can discover the audio playback device and establish a wireless communication connection with other devices (such as the electronic device 100) through a Bluetooth or a WLAN.
  • one or more of the Bluetooth (BT) communication processing module and the WLAN communication processing module may also transmit signals, such as broadcasting Bluetooth signals, beacon signals, so that other devices (eg, electronic device 100 ) can Discover the audio playback device, establish a wireless communication connection with other devices (eg, electronic device 100 ), and communicate with other devices (eg, electronic device 100 ) through one or more wireless communication technologies in Bluetooth or WLAN.
  • signals such as broadcasting Bluetooth signals, beacon signals, so that other devices (eg, electronic device 100 ) can Discover the audio playback device, establish a wireless communication connection with other devices (eg, electronic device 100 ), and communicate with other devices (eg, electronic device 100 ) through one or more wireless communication technologies in Bluetooth or WLAN.
  • the wireless communication processing module 203 may also include a cellular mobile communication processing module (not shown).
  • the cellular mobile communication processing module can communicate with other devices (such as servers) through cellular mobile communication technology.
  • antennas of the Bluetooth communication processing module there may be one or more antennas of the Bluetooth communication processing module.
  • Antennas can be used to transmit and receive electromagnetic wave signals.
  • Each antenna in an audio playback device can be used to cover a single or multiple communication frequency bands.
  • the power switch 205 may be used to control the power supply from the power source to the audio playback device.
  • the USB communication processing module 206 may be used to communicate with other devices through a USB interface (not shown).
  • the audio playback device may also not include the USB communication processing module 206 .
  • the audio module 207 can be used to output audio signals through the audio output interface, so that the audio playback device can support audio playback.
  • the audio module can also be used to receive audio data through the audio input interface.
  • the audio playback device may be a media playback device such as a Bluetooth headset.
  • the audio playback device may further include a display screen (not shown), wherein the display screen may be used to display images, prompt information, and the like.
  • the display screen can be a liquid crystal display (LCD), an organic light-emitting diode (OLED) display, and an active-matrix organic light emitting diode (AMOLED) display. screen, flexible light-emitting diode (flexible light-emitting diode, FLED) display, quantum dot light emitting diode (quantum dot light emitting diodes, QLED) display and so on.
  • the audio playback device may also include a serial interface such as an RS-232 interface.
  • the serial interface can be connected to other devices, such as audio amplifiers such as speakers, so that the Bluetooth device and the audio amplifier can cooperate to play audio and video.
  • the structure shown in FIG. 16 does not constitute a specific limitation on the Bluetooth device.
  • the Bluetooth device may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Circuit For Audible Band Transducer (AREA)

Abstract

本申请提供了一种音频数据无缝切换方法,方法包括:电子设备将音频数据发送至第一音频播放设备,并通过第一音频播放设备播放所述音频数据。之后电子设备不断开与第一音频播放设备的连接,同时与第二音频播放设备建立通信连接,之后,电子设备向第一音频播放设备发送停止播放指令和第一音频帧;其中,停止播放指令用于指示第一音频播放设备在接收到电子设备发送的停止播放指令和第一音频帧之后,在第一时刻播放完第一音频帧后停止播放音频数据;电子设备向第二音频播放设备发送开始播放指令和第二音频帧;其中,开始播放指令用于指示第二音频播放设备在接收到电子设备发送的开始播放指令和第二音频帧之后,在第一时刻开始播放第二音频帧。其中,第二音频帧是在第一音频帧之后的相邻帧。该方法实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,不会出现音频数据中断的情况,并且实现了蓝牙设备切换时音频数据播放进度同步,提高了用户体验。

Description

一种音频数据无缝切换方法
本申请要求于2021年04月23日提交中国专利局、申请号为202110444578.6、申请名称为“一种音频数据无缝切换方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种音频数据无缝切换方法。
背景技术
随着无线通信技术的发展,人们已经习惯通过无线方式将不同的智能终端设备进行连接,其中,蓝牙(Bluetooth)技术作为当前较为成熟的短距离无线通信技术,被广泛应用于智能中设备中,例如,智能手机等终端与音频播放设备(例如蓝牙耳机)之间通过蓝牙进行连接,智能手机可以将音频数据传输至音频播放设备。
但是,当智能手机切换连接至附近其他的音频播放设备(例如车载蓝牙),在蓝牙耳机、车载蓝牙与智能手机切换连接的过程中,这一段时间智能手机播放的音频数据将会丢失,影响用户体验。因此,保证智能手机在切换音频播放设备过程中音频数据不丢失是亟待解决的问题。
发明内容
本申请提供了一种音频数据无缝切换方法,实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,不会出现音频数据中断的情况,并且实现了蓝牙设备切换时音频数据播放进度同步,提高了用户体验。
第一方面,本申请提供了一种音频数据无缝切换***,***包括电子设备、第一音频播放设备、第二音频播放设备;电子设备,用于将音频数据发送至第一音频播放设备;第一音频播放设备,用于播放音频数据;电子设备,还用于:与第二音频播放设备建立通信连接;向第一音频播放设备发送停止播放指令和第一音频帧;向第二音频播放设备发送开始播放指令和第二音频帧;第一音频播放设备,还用于在接收到电子设备发送的停止指令和第一音频帧之后,在第一时刻播放完第一音频帧后停止播放音频数据;第二音频播放设备,还用于在接收到电子设备发送的开始播放指令和二音频帧之后,在第一时刻开始播放第二音频帧;其中,第二音频帧是在第一音频帧之后的相邻帧。
通过第一方面提供的***,实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟。当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备将停止播放指令和第一音频帧发送至第一音频播放设备,并且电子设备将开始播放指令和第二音频帧发送至第二音频播放设备。之后,在理想情况下,第一音频播放设备在第一时刻播完第一音频帧后停止播放音频数据,第二音频播放设备恰好在第一时刻刚开始播放第二音频帧。或者,当第一音频播放设备的第一播放时延小于第二音频播放设备的第二播放时延时,电子设备将开始播放指令和第二音频帧发送至第二音频播放设备,并且电子设备将停止播放指令和第一音频帧发送至第一音频播放设备。之后,在理想情况下,第一音频播放设备在第一时刻播完第一音频帧后停止播放音频数据,第二音频播放设备在第二 时刻恰好刚开始播放第二音频帧。这样,该方法实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,不会出现音频数据中断的情况,并且实现了蓝牙设备切换时音频数据播放进度同步,做到了无缝衔接播放音频数据,提高了用户体验。
结合第一方面,在一种可能的实现方式中,电子设备,具体用于:在第二时刻,向第一音频播放设备发送停止播放指令和第一音频帧;在第三时刻,向第二音频播放设备发送开始播放指令和第二音频帧;其中,第一时刻与所示第二时刻的差值为第一音频播放设备的第一播放时延,第一时刻与第三时刻的差值为第二音频播放设备的第二播放时延;第二时刻与第三时刻的差值为第一值,第一播放时延和第二播放时延的时延差为第一值。
其中,第一音频播放设备的第一播放时延为第一音频帧离开电子设备开始计时,直至第一音频播放设备将第一音频帧播放出来停止计时,这一段时间为第一音频播放设备的第一播放时延。第二音频播放设备的第二播放时延为第二音频帧离开电子设备开始计时,直至第二音频播放设备将第二音频帧播放出来停止计时,这一段时间为第二音频播放设备的第二播放时延。第一播放时延包括第一音频设备的蓝牙传输时延、第一音频设备的解码时延和第一音频设备的硬件时延。第二播放时延包括第二音频设备的蓝牙传输时延、第二音频设备的解码时延和第二音频设备的硬件时延。
第二方面,本申请提供了另一种音频数据无缝切换***,***包括电子设备、第一音频播放设备、第二音频播放设备;电子设备,用于将音频数据发送至第一音频播放设备;第一音频播放设备,用于播放音频数据。电子设备,还用于:与第二音频播放设备建立通信连接;当第一音频播放设备的第一播放时延小于第二音频播放设备的第二播放时延时,向第一音频播放设备发送第一指令和第一音频帧;向第二音频播放设备发送第二指令和第一音频帧;第一音频播放设备,还用于在接收到电子设备发送的第一指令和第一音频帧之后,在第一时刻音量递减播放第一音频帧,在第二时刻停止播放音频数据;第二音频播放设备,还用于在接收到电子设备发送的第二指令和第一音频帧之后,在第二时刻音量递增播放第一音频帧。
音量递减可以是音量线性减小,或者音量梯度减小,音量减小到预设值之后不在减小,或者音量减小到一定时间后不在减小。
音量递增可以是音量线性增大,或者音量梯度增大,音量增大到预设值之后不在增大,或者音量增大到一定时间后不在增大。本申请对于音量递减和音量递增的方式不做限定。
通过第二方面提供的***,实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,并且两个设备之间存在重复播放的音频数据,为了使得电子设备切换播放设备时无中断的过程,通过第一音频播放设备音量递减播放重复播放的音频数据,第二音频播放设备音量递增播放重复的音频数据,已解决重复播放的问题达到无中断播放音频数据。
结合第二方面,在一种可能的实现方式中,当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备还用于:向第一音频播放设备发送第一指令和第一音频帧;向第二音频播放设备发送第二指令和第一音频帧。第一音频播放设备,还用于在接收到电子设备发送的第一指令和第一音频帧之后,在第四时刻音量递减播放第一音频帧,并在播放完第一音频帧后停止播放音频数据;第二音频播放设备,还用于在接收到电子设备发送的第二指令和第一音频帧之后,在第四时刻音量递增播放第一音频帧。
音量递减可以是音量线性减小,或者音量梯度减小,音量减小到预设值之后不在减小,或者音量减小到一定时间后不在减小。
音量递增可以是音量线性增大,或者音量梯度增大,音量增大到预设值之后不在增大,或者音量增大到一定时间后不在增大。本申请对于音量递减和音量递增的方式不做限定。
当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备将第一指令和第一音频帧发送至第一音频播放设备,并且电子设备将第二指令和第一音频帧发送至第二音频播放设备。之后,在理想情况下,第一音频播放设备播完第一音频帧后停止播放音频数据,第二音频播放设备恰好刚开始播放第一音频帧。即第一音频播放设备与第二音频播放设备重复播放的音频数据为第一音频帧。为了使得电子设备切换播放设备时无中断的过程,通过第一音频播放设备音量递减播放第一音频帧,第二音频播放设备音量递增播放第一音频帧,已解决重复播放的问题达到无中断播放音频数据。
第三方面,本申请提供了一种音频数据无缝切换方法,方法包括:电子设备将音频数据发送至第一音频播放设备,并通过第一音频播放设备播放时所述音频数据。之后电子设备不断开与第一音频播放设备的连接与第二音频播放设备建立通信连接,之后,电子设备向第一音频播放设备发送停止播放指令和第一音频帧;其中,停止播放指令用于指示第一音频播放设备在接收到电子设备发送的停止播放指令和第一音频帧之后,在第一时刻播放完第一音频帧后停止播放音频数据;电子设备向第二音频播放设备发送开始播放指令和第二音频帧;其中,开始播放指令用于指示第二音频播放设备在接收到电子设备发送的开始播放指令和第二音频帧之后,在第一时刻开始播放第二音频帧。其中,第二音频帧是在第一音频帧之后的相邻帧。
通过第三方面提供的方法,实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟。当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备将停止播放指令和第一音频帧发送至第一音频播放设备,并且电子设备将开始播放指令和第二音频帧发送至第二音频播放设备。之后,在理想情况下,第一音频播放设备在第一时刻播完第一音频帧后停止播放音频数据,第二音频播放设备恰好在第一时刻刚开始播放第二音频帧。或者,当第一音频播放设备的第一播放时延小于第二音频播放设备的第二播放时延时,电子设备将开始播放指令和第二音频帧发送至第二音频播放设备,并且电子设备将停止播放指令和第一音频帧发送至第一音频播放设备。之后,在理想情况下,第一音频播放设备在第一时刻播完第一音频帧后停止播放音频数据,第二音频播放设备在第二时刻恰好刚开始播放第二音频帧。这样,该方法实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,不会出现音频数据中断的情况,并且实现了蓝牙设备切换时音频数据播放进度同步,做到了无缝衔接播放音频数据,提高了用户体验。
结合第三方面,在一种可能的实现方式中,电子设备,在第二时刻,向第一音频播放设备发送停止播放指令和第一音频帧;在第三时刻,向第二音频播放设备发送开始播放指令和第二音频帧;其中,第一时刻与所示第二时刻的差值为第一音频播放设备的第一播放时延,第一时刻与第三时刻的差值为第二音频播放设备的第二播放时延;第二时刻与第三时刻的差值为第一值,第一播放时延和第二播放时延的时延差为第一值。
其中,第一音频播放设备的第一播放时延为第一音频帧离开电子设备开始计时,直至第一音频播放设备将第一音频帧播放出来停止计时,这一段时间为第一音频播放设备的第一播放时延。第二音频播放设备的第二播放时延为第二音频帧离开电子设备开始计时,直至第二音频播放设备将第二音频帧播放出来停止计时,这一段时间为第二音频播放设备的第二播放时延。第一播放时延包括第一音频设备的蓝牙传输时延、第一音频设备的解码时延和第一音 频设备的硬件时延。第二播放时延包括第二音频设备的蓝牙传输时延、第二音频设备的解码时延和第二音频设备的硬件时延。
结合第三方面,在一种可能的实现方式中,电子设备在第一音频播放设备播放完第一音频帧后停止播放音频数据时,断开与第一音频播放设备的连接。这样,电子设备在于第二音频数据建立连接时,不断开与第一音频播放设备的连接。当第二音频播放设备开始播放音频数据,恰好第一音频播放设备播放完第一音频帧后停止播放音频数据时,电子设备与第一音频播放设备断开连接,为实现无缝衔接播放音频数据提供了可能。
结合第三方面,在一种可能的实现方式中,当第一播放时延大于第二播放时延时,第一时刻先于第二时刻;当第一播放时延小于第二播放时延时,第二时刻先于第一时刻。当第一播放时延大于第二播放时延时,第一音频播放设备接收到一帧音频数据帧并将该一帧音频数据帧播放出来的时间大于第二音频播放设备接收到一帧音频数据帧并将该一帧音频数据帧播放出来的时间,为了使得第一音频播放设备刚好停止播放音频数据,第二音频播放设备刚好开始播放音频数据,因此电子设备需要在向第二音频播放设备发送开始播放指令和第二音频帧之前,向第一音频播放设备发送停止播放指令和第一音频帧,经过此第一音频播放设备与第二音频播放设备的播放时延差之后,第二音频播放设备接收到开始播放指令和第二音频帧。当第一播放时延小于第二播放时延时,第一音频播放设备接收到一帧音频数据帧并将该一帧音频数据帧播放出来的时间小于第二音频播放设备接收到一帧音频数据帧并将该一帧音频数据帧播放出来的时间,为了使得第一音频播放设备刚好停止播放音频数据,第二音频播放设备刚好开始播放音频数据,因此电子设备需要在向第一音频播放设备发送停止播放指令和第一音频帧之前,向第二音频播放设备发送开始播放指令和第二音频帧,经过此第一音频播放设备与第二音频播放设备的播放时延差之后,第一音频播放设备接收到停止播放指令和第一音频帧。
结合第三方面,在一种可能的实现方式中,在电子设备与第二音频播放设备建立通信连接之后,在电子设备开始向第一音频播放设备发送停止指令或向第二音频播放设备发送开始指令之前,电子设备还需计算出第一音频播放设备和第二音频播放设备的播放时延。具体的,电子设备向第一音频播放设备发送第一测试数据,向第二音频播放设备发送第二测试数据。所述电子设备接收第一音频播放设备发送的包含第四时刻和第五时刻的第一信息;其中,第四时刻为第一测试数据离开电子设备的时刻,第五时刻为第一音频播放设备播放第一测试数据的时刻;电子设备接收第二音频播放设备发送的包含第六时刻和第七时刻的第二信息;其中,第六时刻为第二测试数据离开电子设备的时刻,第七时刻为第二音频播放设备播放第二测试数据的时刻;电子设备确定出第一播放时延,第一播放时延为第五时刻与第四时刻的差值;电子设备确定出第二播放时延,第二播放时延为第七时刻与第六时刻的差值。
在一种可能的实现方式中,电子设备若之前计算过第一音频播放设备的播放时延和第二音频播放设备的播放时延,电子设备可以将第一音频播放设备的播放时延和第二音频播放设备的播放时延保存在电子设备内,之后,电子设备不需要每次重新计算第一音频播放设备的播放时延和第二音频播放设备的播放时延。
第四方面,本申请提供了另一种音频数据无缝切换方法,方法包括:电子设备将音频数据发送至第一音频播放设备,并通过第一音频播放设备播放时音频数据;电子设备与第二音频播放设备建立通信连接。当第一音频播放设备的第一播放时延小于第二音频播放设备的第二播放时延时,电子设备向第一音频播放设备发送第一指令和第一音频帧,向第二音频播放 设备发送第二指令和第一音频帧。其中,第一指令用于指示第一音频播放设备在接收到电子设备发送的第一指令和第一音频帧之后,在第一时刻音量递减播放第一音频帧,在第二时刻停止播放音频数据;第二指令用于指示第二音频播放设备在接收到电子设备发送的第二指令和第一音频帧之后,在第二时刻音量递增播放第一音频帧。
音量递减可以是音量线性减小,或者音量梯度减小,音量减小到预设值之后不在减小,或者音量减小到一定时间后不在减小。
音量递增可以是音量线性增大,或者音量梯度增大,音量增大到预设值之后不在增大,或者音量增大到一定时间后不在增大。本申请对于音量递减和音量递增的方式不做限定。
通过第二方面提供的***,实现了电子设备在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,并且两个设备之间存在重复播放的音频数据,为了使得电子设备切换播放设备时无中断的过程,通过第一音频播放设备音量递减播放重复播放的音频数据,第二音频播放设备音量递增播放重复的音频数据,已解决重复播放的问题达到无中断播放音频数据。
结合第四方面,在一种可能的实现方式中,电子设备还向第一音频播放设备发送第二音频帧,第一指令还用于指示第一音频播放设备在接收到电子设备发送的第一指令和第一音频帧之后,在第一时刻音量递减播放第一音频帧之后,在第二时刻播放完第二音频帧后停止播放音频数据。
结合第四方面,在一种可能的实现方式中,结合第二方面,在一种可能的实现方式中,电子设备,具体用于:在第三时刻,电子设备向第一音频播放设备发送第一指令和第一音频帧;在第三时刻,向第二音频播放设备发送第二指令和第一音频帧;其中,第一时刻与所第三时刻的差值为第一音频播放设备的第一播放时延,第二时刻与第三时刻的差值为第二音频播放设备的第二播放时延;第二时刻与第一时刻的差值为第一值,第一播放时延和第二播放时延的时延差为第一值。
其中,第一音频播放设备的第一播放时延为第一音频帧离开电子设备开始计时,直至第一音频播放设备将第一音频帧播放出来停止计时,这一段时间为第一音频播放设备的第一播放时延。第二音频播放设备的第二播放时延为第一音频帧离开电子设备开始计时,直至第二音频播放设备将第一音频帧播放出来停止计时,这一段时间为第二音频播放设备的第二播放时延。第一音频帧可以为实时通话或者播放音乐或播放视频时的音频数据。
第一播放时延包括第一音频设备的蓝牙传输时延、第一音频设备的解码时延和第一音频设备的硬件时延。第二播放时延包括第二音频设备的蓝牙传输时延、第二音频设备的解码时延和第二音频设备的硬件时延。
结合第四方面,在一种可能的实现方式中,当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备还用于:向第一音频播放设备发送第一指令和第一音频帧;向第二音频播放设备发送第二指令和第一音频帧。第一音频播放设备,还用于在接收到电子设备发送的第一指令和第一音频帧之后,在第四时刻音量递减播放第一音频帧,并在播放完第一音频帧后停止播放音频数据;第二音频播放设备,还用于在接收到电子设备发送的第二指令和第一音频帧之后,在第四时刻音量递增播放第一音频帧。
音量递减可以是音量线性减小,或者音量梯度减小,音量减小到预设值之后不在减小,或者音量减小到一定时间后不在减小。
音量递增可以是音量线性增大,或者音量梯度增大,音量增大到预设值之后不在增大,或者音量增大到一定时间后不在增大。本申请对于音量递减和音量递增的方式不做限定。
当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备将第一指令和第一音频帧发送至第一音频播放设备,并且电子设备将第二指令和第一音频帧发送至第二音频播放设备。之后,在理想情况下,第一音频播放设备播完第一音频帧后停止播放音频数据,第二音频播放设备恰好刚开始播放第一音频帧。即第一音频播放设备与第二音频播放设备重复播放的音频数据为第一音频帧。为了使得电子设备切换播放设备时无中断的过程,通过第一音频播放设备音量递减播放第一音频帧,第二音频播放设备音量递增播放第一音频帧,已解决重复播放的问题达到无中断播放音频数据。
在一种可能的实现方式中,第一指令包括音量递减指令和停止播放指令;第二指令包括音量递增指令和开始播放指令。音量递减指令用于指示第一音频播放设备在接收到第一音频帧后,音量递减播放第一音频帧;停止播放指令用于指示第一音频播放设备在接收到第二音频帧之后,播放完所述第二音频帧后停止播放音频数据。音量递增指令用于指示第二音频播放设备在接收到第一音频帧之后,音量递增播放第一音频帧。
在一种可能的实现方式中,电子设备也可以分别将音量递增指令和停止播放指令发送至第一音频播放设备。
结合第四方面,在一种可能的实现方式中,电子设备在第五时刻,向第一音频播放设备发送第一指令和第一音频帧;电子设备在第六时刻,向第二音频播放设备发送第二指令和第一音频帧,其中,第四时刻与第五时刻的差值为第一音频播放设备的第一播放时延,第四时刻与第六时刻的差值为第二音频播放设备的第二播放时延;第六时刻与第五时刻的差值为第一值,第一播放时延和第二播放时延为第一值。
其中,第一音频播放设备的第一播放时延为第一音频帧离开电子设备开始计时,直至第一音频播放设备将第一音频帧播放出来停止计时,这一段时间为第一音频播放设备的第一播放时延。第二音频播放设备的第二播放时延为第一音频帧离开电子设备开始计时,直至第二音频播放设备将第一音频帧播放出来停止计时,这一段时间为第二音频播放设备的第二播放时延。第一音频帧可以为实时通话或者播放音乐或播放视频时的音频数据。
第一播放时延包括第一音频设备的蓝牙传输时延、第一音频设备的解码时延和第一音频设备的硬件时延。第二播放时延包括第二音频设备的蓝牙传输时延、第二音频设备的解码时延和第二音频设备的硬件时延。
结合第四方面,在一种可能的实现方式中,在电子设备开始向第一音频播放设备发送停止指令或向第二音频播放设备发送开始指令之前,电子设备还需计算出第一音频播放设备和第二音频播放设备的播放时延。具体的,电子设备向第一音频播放设备发送第一测试数据,向第二音频播放设备发送第二测试数据。电子设备接收第一音频播放设备发送的包含第七时刻和第八时刻的第一信息;其中,第七时刻为第一测试数据离开电子设备的时刻,第八时刻为第一音频播放设备播放第一测试数据的时刻。电子设备接收第二音频播放设备发送的包含第九时刻和第十时刻的第二信息;其中,第九时刻为第二测试数据离开电子设备的时刻,第十时刻为第二音频播放设备播放第二测试数据的时刻。电子设备确定第一播放时延,第一播放时延为第八时刻与第七时刻之间的差值。电子设备确定出第二播放时延,第二播放时延为第十时刻与第九时刻之间的差值。这样,电子设备计算出第一音频播放设备和第二音频播放设备的播放时延,为后续第一音频播放设备和第二音频播放设备切换时无缝衔接播放音频数据提供了可能。
在一种可能的实现方式中,电子设备若之前计算过第一音频播放设备的播放时延和第二音频播放设备的播放时延,电子设备可以将第一音频播放设备的播放时延和第二音频播放设 备的播放时延保存在电子设备内,之后,电子设备不需要每次重新计算第一音频播放设备的播放时延和第二音频播放设备的播放时延。
第五方面,本申请提供了一种电子设备,包括一个或多个处理器和一个或多个存储器。该一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得电子设备执行上述任一方面任一项可能的实现方式中电子设备执行方法步骤。
第六方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行上述任一方面任一项可能的实现方式中的方法步骤。
第七方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得电子设备执行上述任一方面任一项可能的实现方式中电子设备执行方法步骤。
附图说明
图1为本申请实施例提供的一种***架构的示意图;
图2A-图2B为本申请实施例提供的一组电子设备100切换蓝牙设备时的音频数据播放时序图;
图3A-图3H为本申请实施例提供的一组电子设备100切换蓝牙设备的操作示意图;
图4为本申请实施例提供的另一个界面示意图;
图5A-图5B为本申请实施例提供的一组家庭应用场景示意图;
图6为本申请实施例提供的一种电子设备100计算两个蓝牙设备基准时间的原理示意图;
图7为本申请实施例提供的一种电子设备100计算音频播放设备200播放音频数据的播放时延的原理示意图;
图8为本申请实施例提供的一种电子设备100计算音频播放设备300播放音频数据的播放时延的原理示意图;
图9-图12为本申请实施例提供的一组电子设备100切换蓝牙设备时无缝衔接播放音频数据的原理示意图;
图13为本申请实施例提供的一种音频数据无缝切换方法的流程图;
图14为本申请实施例提供的一种电子设备100的结构示意图;
图15为本申请实施例提供的一种电子设备100的软件结构框图;
图16为本申请实施例提供的一种音频播放设备的硬件结构示意图。
具体实施方式
下面将结合附图对本申请实施例中的技术方案进行清除、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者 隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
本申请的说明书和权利要求书及附图中的术语“用户界面(user interface,UI)”,是应用程序或操作***与用户之间进行交互和信息交换的介质接口,它实现信息的内部形式与用户可以接受形式之间的转换。应用程序的用户界面是通过java、可扩展标记语言(extensible markup language,XML)等特定计算机语言编写的源代码,界面源代码在终端设备上经过解析,渲染,最终呈现为用户可以识别的内容,比如图像、文本、按钮等控件。控件(control)也称为部件(widget),是用户界面的基本元素,典型的控件有工具栏(toolbar)、菜单栏(menu bar)、输入框、按钮(button)、滚动条(scrollbar)、图像和文本。界面中的控件的属性和内容是通过标签或者节点来定义的,比如XML通过<Textview>、<ImgView>、<VideoView>等节点来规定界面所包含的控件。一个节点对应界面中一个控件或属性,节点经过解析和渲染之后呈现为用户可视的内容。此外,很多应用程序,比如混合应用(hybrid application)的界面中通常还包含有网页。网页,也称为页面,可以理解为内嵌在应用程序界面中的一个特殊的控件,网页是通过特定计算机语言编写的源代码,例如超文本标记语言(hyper text markup language,HTML),层叠样式表(cascading style sheets,CSS),java脚本(JavaScript,JS)等,网页源代码可以由浏览器或与浏览器功能类似的网页显示组件加载和显示为用户可识别的内容。网页所包含的具体内容也是通过网页源代码中的标签或者节点来定义的,比如HTML通过<p>、<img>、<video>、<canvas>来定义网页的元素和属性。
用户界面常用的表现形式是图形用户界面(graphic user interface,GUI),是指采用图形方式显示的与计算机操作相关的用户界面。它可以是在电子设备的显示屏中显示的一个窗口、控件等界面元素。
下面介绍本申请实施例提供的一种***架构。
请参见图1,图1为本申请实施例提供的一种***架构的示意图。如图1所示,该***包括电子设备100、音频播放设备200和音频播放设备300。示例性的,音频播放设备200可以是蓝牙耳机、蓝牙音箱等蓝牙设备,音频播放设备300可以是车载蓝牙、蓝牙音箱等蓝牙设备。音频播放设备200和音频播放设备300还可以是其他的设备,例如蓝牙手表等等,本申请再次不做限定。
音频播放设备200的设备类型与音频播放设备300的设备类型可以相同或不同,例如音频播放设备200可以为蓝牙耳机、音频播放设备300可以为车载蓝牙;又例如,音频播放设备200的设备类型和音频播放设备300的设备类型可以都为蓝牙音箱。
其中,电子设备100可以通过蓝牙技术(包括经典蓝牙和低功耗蓝牙(bluetooth low energy,BLE))、Wi-Fi直连、局域网等任一项与音频播放设备200和音频播放设备300进行通信。
本申请实施例以音频播放设备200为蓝牙耳机,音频播放设备300为车载蓝牙,电子设备100通过蓝牙与音频播放设备200和音频播放设备300建立连接为例进行说明。
首先,电子设备100与音频播放设备200建立了蓝牙连接后,电子设备100可以通过蓝牙传输链路将音频数据发送至音频播放设备200上进行播放。
之后,音频播放设备300启动,音频播放设备300发送广播,该广播中携带有音频播放设备300的设备标识。电子设备100接收音频播放设备300发送的广播,电子设备100识别出该广播中音频播放设备300的设备标识,即电子设备100与音频播放设备300之前建立过 蓝牙连接,并且,音频播放设备300的优先级高于音频播放设备200的优先级,则电子设备100将断开与音频播放设备200的蓝牙连接,并与音频播放设备300建立蓝牙连接,之后,电子设备100可以通过与音频播放设备300的蓝牙传输链路将音频数据发送至音频播放设备300上进行播放。
或者,音频播放设备300启动。电子设备100接收用户的切换蓝牙连接操作,响应于用户的切换蓝牙连接,电子设备100将断开与音频播放设备200的蓝牙连接,并与音频播放设备300建立蓝牙连接,之后,电子设备100可以通过与音频播放设备300的蓝牙传输链路将音频数据发送至音频播放设备300上进行播放。
目前,电子设备100断开与音频播放设备200的蓝牙连接,并与音频播放设备300建立蓝牙连接,之后,电子设备100将音频数据发送至音频播放设备300上进行播放。在电子设备100与音频播放设备200断开连接,直至电子设备100将音频数据发送至音频播放设备300上进行播放的这一段时间内,音频数据将会丢失,影响用户体验。
示例性的,当音频数据为通话语音时,则在电子设备100将蓝牙连接由音频播放设备200切换至音频播放设备300时,这一段时间内的通话语音中断,等待一段时间后,音频播放设备300才会播放通话语音,则有一段通话语音是丢失的。
又例如,当音频数据为音乐时,则在电子设备100将蓝牙连接由音频播放设备200切换至音频播放设备300时,正在播放的音乐将会暂停,等待一段时间后,音频播放设备300才会播放音乐,则有一段的音乐是丢失的。
目前,电子设备100可以采取以下任意一种来解决蓝牙设备切换过程中音频数据丢失和中断的问题。
方式一:
电子设备100与音频播放设备200建立蓝牙连接,并将音频数据发送至音频播放设备200。当电子设备100将与音频播放设备200的连接切换为与音频播放设备300的连接时,电子设备记录下与音频播放设备200断开连接时的音频数据的播放进度。之后,电子设备100与音频播放设备200断开连接,电子设备100将播放的音频数据对应的完整音频文件发送至音频播放设备300,同时将音频数据的播放进度发送至音频播放设备300。音频播放设备300接收电子设备100发送的完整音频文件以及音频数据的播放进度,并根据音频数据的播放进度开始播放音频数据。
但是该方法存在以下问题:
一、电子设备100需要将播放的音频数据对应的完整音频文件发送至音频播放设备300,对于,实时通话应用场景中,电子设备100无法获取到未发生的音频数据,不能实现播放进度同步。
二、该方法只是解决了音频播放设备200与音频播放设备300的播放进度同步的问题,在音频播放设备200停止播放,至音频播放设备300开始播放的过程中,还是存在播放中断的问题。
方式二:
如图2A所示,在0时刻,电子设备100与音频播放设备200建立蓝牙连接,电子设备100开始向音频播放设备200传输音频数据,音频播放设备200播放音频数据。
如图2A所示,当音频播放设备200播放音频数据的总时长为120ms时,即在120ms时 刻,音频播放设备300开启,音频播放设备300发布广播,电子设备100接收到音频播放设备300发布的广播,并且音频播放设备300的优先级高于音频播放设备200的优先级。响应于音频播放设备300发布的广播,电子设备100将与第二蓝牙设备建立蓝牙连接。具体的,首先,电子设备100断开与音频播放设备200的蓝牙连接。之后,电子设备100缓存120ms时刻之后播放的音频数据。当电子设备100缓存的音频数据的时长达到120ms时,电子设备100与音频播放设备300建立了蓝牙连接,并且音频播放设备300开始播放电子设备100发送的音频数据。
如图2B所示,当电子设备100与音频播放设备300建立了蓝牙连接之后,电子设备100将缓存的时长为120ms的音频数据发送至音频播放设备300,音频播放设备300将开始播放电子设备100发送的缓存的120ms的音频数据。音频播放设备300将缓存的120ms音频数据播放完成后,接着播放240ms之后的音频数据。
但是为了避免时延,使得音频播放设备300播放的音频数据和缓存的音频数据连接上,音频播放设备300将采用更短的时间播放完接收到的缓存的120ms的音频数据,即音频播放设备300将在80ms内播放完接收到的缓存的120ms的音频数据。在320ms时刻,音频播放设备300已播放完接收到的缓存的120ms的音频数据,在320ms时刻,音频播放设备300将播放240ms之后的音频数据。
但是该方法存在以下问题:
电子设备100与音频播放设备200断开连接之后,电子设备100将缓存的音频数据发送至音频播放设备300,在音频播放设备200停止播放,在电子设备100将缓存的音频数据发送至音频播放设备300至音频播放设备300开始播放还是存在一个终端的过程;并且,音频播放设备300为了避免时延,将加速播放完电子设备100缓存的音频数据,但是,加速播放缓存的音频数据,会使用户体验更差。
因此,为了解决上述问题,本申请提供了一种音频数据无缝切换方法。方法包括:电子设备100与音频播放设备200(第一音频播放设备)建立通信连接。音频播放设备200播放电子设备100传输的音频数据。同时,音频播放设备300(第二音频播放设备)开启,电子设备100不断开与音频播放设备200的连接,同时与音频播放设备300建立蓝牙连接。电子设备100确定出第一音频播放设备与第二音频播放设备的播放时延的差值T,使得第一音频播放设备收到停止播放指令和第二音频播放设备收到开始播放指令的时间差为差值T,之后,第一音频播放设备停止播放音频数据时,第二音频播放设备开始播放音频数据。这样,电子设备100在切换蓝牙设备连接时,考虑了蓝牙设备切换时存在的时间延迟,不会出现音频数据中断的情况,并且实现了音频播放设备200与音频播放设备300切换时音频数据播放进度同步,提高了用户体验。
需要说明的是,本申请实施例提及的音频数据可以是可预测的音频数据,例如音乐或视频应用播放的音频数据;本申请实施例提及的音频数据也可以不可预测的音频数据,例如是实时通话的音频数据等等。
音频播放设备200播放音频数据的播放时延是指,电子设备100将音频数据发送至音频播放设备200开始计时,直至音频播放设备200的麦克风采集到音频数据计时结束,这一段时间被称为音频播放设备200播放音频数据的播放时延。具体的,电子设备100将时刻一的音频数据帧发送至音频播放设备200,时刻一的音频数据帧经过一段时间传送至音频播放设备200,音频播放设备200将时刻一的音频数据帧解码出来,在经过模数转换等步骤将时刻 一的音频数据帧播放出来,音频数据帧播放出来的时刻为时刻二,即音频播放设备200的麦克风采集到的音频数据帧的时刻为时刻二,时刻二与时刻一的差值为音频播放设备200播放音频数据的播放时延。音频播放设备200播放音频数据的播放时延包括蓝牙传输时延+编解码时延+硬件时延。
蓝牙传输时延为电子设备100将音频数据通过蓝牙通道发送至音频播放设备200的传输时间。
编解码时延为音频播放设备200接收到音频数据,并将音频数据解码出来的解码时间。
硬件时延为音频播放设备200将解码后的音频数据进行模数转换等步骤通过音频模块将音频数据播放出来所花费的时间。硬件时延可以是音频播放设备200在出厂之前已经测试好的。
音频播放设备300播放音频数据的播放时延与音频播放设备200播放音频数据的播放时延原理是一样的,本申请在此不再赘述。
电子设备100与音频播放设备300建立连接,可以采取以下任意一种方式:
方式一:电子设备100接收用户操作与音频播放设备300建立连接。
一种可能的实现方式中,电子设备100可以接收用户操作在设置界面中与第二音频播放设备300建立连接。
如图3A所示,图3A示例性示出了电子设备100上的用于展示已安装应用程序的用户界面30。该用户界面30显示有:状态栏、日历指示符、天气指示符、具有常用应用程序图标的托盘、导航栏、文件管理的图标301、电子邮件的图标302、音乐的图标303、设置的图标304、运动健康的图标305、天气的图标306等,常用应用程序图标的托盘包括相机的图标307、通讯录的图标308、电话的图标309、信息的图标310。其中,状态栏可包括:移动通信信号(又可称为蜂窝信号)的一个或多个信号强度指示符、运营商名称(例如“***”)、Wi-Fi信号的一个或多个信号强度指示符,电池状态指示符、时间指示符等。导航栏可包括返回键、主屏幕键、多任务键等***导航键。在一些实施例中,图3A示例性所示的用户界面30可以为主界面(Home screen)。
如图3A所示,电子设备100接收并响应用户点击设置图标304的操作,电子设备100显示如图3B所示的设置界面40。如图3B所示,设置界面40包括飞行模式图标,电子设备100的飞行模式关闭,Wi-Fi图标,电子设备100的Wi-Fi关闭,设置界面40还包括蓝牙图标311、个人热点图标,移动网络图标,勿扰模式图标,显示与亮度图标,华为账号图标,隐私图标等。如图3B所示,电子设备100接收并响应用户点击蓝牙图标311的操作,电子设备100显示如图3C所示的用户界面50。
如图3C所示,用户界面50包括蓝牙图标,电子设备100的蓝牙功能开启。用户界面50还包括之前与电子设备100建立过蓝牙连接的设备标识图标,示例性的,设备标识图标可以包括“lisa”、“HUAWEI”、“123”、“Nancy”等。电子设备100与设备标识“lisa”对应的设备已建立连接,电子设备100与设备标识“HUAWEI”、“123”、“Nancy”对应的设备均未建立连接。用户界面50还示出了新设备的标识图标,该新设备以前未与电子设备100建立过蓝牙连接,新设备的标识图标可以是“jack”、“ABC”等等。示例性的,设备标识“lisa”对应的设备可以是音频播放设备200,设备标识“123”对应的设备可以是音频播放设备300。
如图3C所示,电子设备100可以接收并响应用户点击设备标识图标“123”的操作,若设备标识图标“123”对应的设备与电子设备100的距离在预设范围内,则电子设备100可以与设 备标识图标“123”对应的设备建立蓝牙连接。
另一种可能的实现方式中,电子设备100可以接收用户在音频数据播放界面的切换蓝牙设备的操作,与音频播放设备300建立蓝牙连接。
如图3D所示,图3D示例性示出了电子设备100显示的用户界面60。用户界面60包括有音乐播放画面601。
其中,音乐播放画面601中包括被播放的音乐的名称和控制图标。图3D中,被播放的音乐的名称是“dream it possible”。控制图标包括播放/暂停控件602、上一曲控件603和下一曲控件604、进度条605、下载控件606、分享控件607、切换控件608和更多控件609。
如图3D所示,电子设备100接收并响应用户点击切换控件608的操作,电子设备100显示如图3E所示的用户界面70。
用户界面70显示有提示框610,提示框610里显示的是电子设备100的音频播放模式。在一些实施例中,电子设备100检测到作用于切换控件608的用户操作后,可以更改用户界面70的显示形式,例如增加显示用户界面70时的阴影等。
如图3E所示,提示框610里显示电子设备100已与设备标识为“Lisa”的蓝牙耳机建立了连接,并且电子设备100正在通过该蓝牙耳机播放音频数据。提示框610还显示电子设备100可建立连接的设备标识的图标,设备标识的图标可以是例如“Nancy”、“Huawei”、“123”等等。
电子设备100可以接收并响应用户点击提示框610里显示的设备标识的图标的操作,电子设备100与该设备标识的图标对应的设备建立蓝牙连接。
如图3E所示,电子设备100可以接收并响应设备标识的图标“123”的操作,电子设备100与设备标识的图标“123”对应的设备建立蓝牙连接。
或者,如图3F所示,当电子设备100检测到在显示屏上的向下滑动手势时,响应于该滑动手势,如图3G所示,电子设备100在用户界面60上显示窗口620。窗口620包括音乐播放小窗口630。其中,音乐播放小窗口630包括被播放的音乐的名称和控制图标。音乐播放小窗口630中,被播放的音乐的名称是“dream it possible”。控制图标包括播放/暂停控件602、上一曲控件603和下一曲控件604、进度条605和切换控件608。
在一些实施例中,电子设备100检测到在显示屏上的向下滑动手势后,可以更改用户界面60的显示形式,例如增加显示用户界面60时的阴影等。
如图3G所示,电子设备100接收并响应用户点击音乐播放小窗口630中切换控件608的操作,如图3H所示,电子设备100在用户界面60上显示窗口650。
如图3H所示,窗口650里显示电子设备100已与设备标识为“Lisa”的蓝牙耳机建立了连接,并且电子设备100正在通过该蓝牙耳机播放音频数据。窗口650还显示电子设备100可建立连接的设备标识的图标,设备标识的图标可以是例如“Nancy”、“Huawei”、“123”等等。
电子设备100可以接收并响应用户点击窗口650里显示的设备标识的图标的操作,电子设备100与该设备标识的图标对应的设备建立蓝牙连接。
如图3H所示,电子设备100可以接收并响应设备标识的图标“123”的操作,电子设备100与设备标识的图标“123”对应的设备建立蓝牙连接。
方式二:电子设备100附近有其他的蓝牙设备,当其他的蓝牙设备中有一个蓝牙设备(例如音频播放设备300)的优先级的级别高于音频播放设备200的优先级的级别。电子设备100将与音频播放设备300建立连接。
表1
设备标识 优先级排名
123 第一
Lisa 第二
Huawei 第三
Nancy 第四
如表1所示,表1示例性示出了部分设备的优先级。例如。设备标识“123”对应的设备的优先级排名第一,设备标识“Lisa”对应的设备的优先级排名第二,设备标识“Huawei”对应的设备的优先级排名第三,设备标识“Nancy”对应的设备的优先级排名第四。
当电子设备100已经与音频播放设备200建立了蓝牙连接,此时,音频播放设备300开启,音频播放设备300的优先级高于音频播放设备200的优先级。音频播放设备300不断发送广播,音频播放设备300与电子设备100的距离在预设范围内,电子设备100接收音频播放设备300发送的广播,并识别出该广播中携带的音频播放设备300的标识,若电子设备100以前与音频播放设备300建立过蓝牙连接,并且音频播放设备300的优先级高于音频播放设备200的优先级,则电子设备100将与音频播放设备300建立蓝牙连接。
若电子设备100之前没有与音频播放设备300建立过蓝牙连接,则电子设备100的用户界面将显示如图4所示的提示框660。提示框660包括提示信息和选择控件,提示信息包括““123”将要与你建立连接,是否同意建立连接?”,其中“123”为音频播放设备300的设备标识。选择控件包括控件6601和控件6602。
或者,提示信息也可以是“是否将与“Lisa”的连接切换为与“123”的连接”。设备标识“Lisa”对应的设备当前已与电子设备100建立了连接,设备标识“123”对应的设备为音频播放设备300。提示信息还可以显示其他的内容,本申请在此不做限定。
如图4所示,电子设备100接收并响应用户点击控件6601的操作,电子设备100将与音频播放设备300建立蓝牙连接。
方式三:电子设备100附近有其他的蓝牙设备,当其他的蓝牙设备中有一个蓝牙设备(例如音频播放设备300)距离电子设备100的距离小于音频播放设备200与电子设备100的距离,则电子设备100自动将与音频播放设备200的连接切换为与音频播放设备300的连接。
如图5A所示,电子设备100已经与音频播放设备200(例如音箱)建立蓝牙连接,电子设备100将音频数据发送至音频播放设备200(例如音箱),音频播放设备200(例如音箱)播放电子设备100发送的音频数据。
此时,电子设备100从第一位置移动到了第二位置,此时,在第二位置的附近,音频播放设备300(例如音箱)开启。此时,音频播放设备200(例如音箱)与电子设备100的距离为1.2米,音频播放设备300(例如音箱)与电子设备100的距离为0.8米。由于音频播放设备300(例如音箱)与电子设备100的距离小于音频播放设备200(例如音箱)与电子设备100的距离,此时电子设备100可以与音频播放设备300建立蓝牙连接。
在一些实施例中,为了避免电子设备100频繁切换蓝牙设备,电子设备100可以根据音频播放设备300(例如音箱)与电子设备100的距离小于音频播放设备200(例如音箱)与电子设备100的距离,并且,电子设备100可以根据音频播放设备300(例如音箱)与电子设备100的距离小于音频播放设备200(例如音箱)与电子设备100的距离的持续时间达到预 设时间,电子设备100与音频播放设备300建立蓝牙连接。
如图5B所示,图5B为家庭应用场景的示意图。
如图5B所示,该家庭应用场景包括第一房间区域510、第二房间区域520和客厅区域530。第一房间区域510包括第一音箱501,第二房间区域520包括第一音箱502,客厅区域530包括第三音箱503。
电子设备100首先在客厅区域530与第三音箱503建立了蓝牙连接,第三音箱503播放电子设备100发送的音频数据。
之后,电子设备100移动到了第一房间区域510中,并且第一音箱501已开启,由于第一音箱501与电子设备100的距离小于第三音箱503与电子设备100的距离,电子设备100主动与第一音箱501建立蓝牙连接。
在一些实施例中,电子设备100移动到了第一房间区域510中,并且第一音箱501已开启,由于第一音箱501与电子设备100的距离小于第三音箱503与电子设备100的距离,并且第一音箱501与电子设备100的距离小于第三音箱503与电子设备100的距离持续时间达到了预设时间,电子设备100主动与第一音箱501建立蓝牙连接。
下面将重点介绍电子设备100在切换蓝牙设备之前,分别计算出音频播放设备200与音频播放设备300的播放音频数据的播放时延,并基于两个蓝牙设备的播放时延的差值切换蓝牙设备,达到播放音频无中断的效果。
接下来介绍两个设备建立连接之后,电子设备100如何基于NTP(Network Time Protocol)网络时间协议计算两个蓝牙设备基准时间的原理。
如图6所示,图6为计算两个蓝牙设备基准时间的原理示意图。
如图6所示,电子设备100在T1时刻发送报文一至设备二,报文一携带有其离开电子设备100时的时间戳,该时间戳为T1时刻,例如T1时刻为10:00:00,该时间戳T1时刻为电子设备100的***时间。电子设备100将报文一发送至设备一需要经过一段网络延时传输后到达设备一。
设备一在T2时刻收到电子设备100发送的报文一,并在报文一中加上设备一的时间戳(T2时刻),例如T2时刻为11:00:01,该时间戳T2时刻为设备一的***时间。
报文二在T3时刻离开设备一,设备一在报文二中加上报文一离开电子设备100的时间戳(T1时刻),报文一到达设备一的时间戳(T2时刻),报文二离开设备一的时间戳(T3时刻),例如T3时刻为11:00:02,该时间戳T3时刻为设备一的***时间。
需要经过一段网络延时传输后,报文二到达设备一的时刻为T4时刻。例如T4时刻为10:00:03,该时间戳T4时刻为电子设备100的***时间。
报文二携带有时间戳T1时刻、时间戳T2时刻和时间戳T3时刻。
电子设备100与设备一之间的数据传输的往返时延=(T4-T1)-(T3-T2)。
示例性的,可以计算出电子设备100与设备一之间的数据传输的往返时延,往返时延=(10:00:03-10:00:00)-(11:00:02-11:00:01)=2秒。
电子设备100相对设备一的时间差offset=[(T2-T1)+(T3-T4)]/2。
示例性的,电子设备100相对设备一的时间差offset=[(11:00:01-10:00:00)+(11:00:02-10:00:03)]/2=1小时。
电子设备100采用图6所示的方法,分别计算出电子设备100相对于音频播放设备200的时间差与电子设备100相对于音频播放设备300的时间差。
示例性的,电子设备100相对于音频播放设备200的时间差为5分钟,电子设备100相对于音频播放设备200的时间差为10分钟。
等待音频播放设备300的音频通路初始化完成之后,电子设备100开始计算音频播放设备200与音频播放设备300的播放时延。
首先,电子设备100根据测试数据计算出音频播放设备200播放音频数据的播放时延。
如图7所示,电子设备100持续将音频数据发送至音频播放设备200,音频播放设备200播放音频数据。之后,电子设备100播放的音频数据的当前进度的时间戳为时刻三,电子设备100将测试数据发送至音频播放设备200,测试数据包括测试数据离开电子设备100的时刻,即时刻三。测试数据可以是特定频率的音频数据,该特定频率的音频数据可以是人耳可感知的音频数据,也可以是人耳不可感知的音频数据,本申请在此不做限定。
测试数据经过电子设备100与音频播放设备200之间的蓝牙通道,经过一段时间后传送至音频播放设备200的蓝牙协议栈。音频播放设备200记录下测试数据到达音频播放设备200的蓝牙协议栈的时刻,即时刻四。时刻四与时刻三的差值为电子设备100与音频播放设备200之间的蓝牙通道的传输时延。
之后,音频播放设备200将测试数据解码出来,音频播放设备200记录下测试数据解码后对应的时刻,即时刻五。时刻五与时刻四的差值为音频播放设备200的编解码时延。
之后,音频播放设备200将解码后的测试数据传输至音频播放模块,音频播放模块将测试数据进行模数转换、功率放大等操作播放出去,使得人耳可听到音频播放设备200播放的音频数据。也即,测试数据播放出去后,音频播放设备200记录下音频播放设备200的麦克风采集的测试数据的时刻,即时刻六,时刻六与时刻五的差值为音频播放设备200的硬件时延。
在音频播放设备200记录下音频播放设备200的麦克风采集的测试数据的时刻之后,音频播放设备200发送报文三至电子设备100,报文三携带了测试数据离开电子设备100的时刻(时刻三)、测试数据到达音频播放设备200的蓝牙协议栈的时刻(时刻四)、测试数据解码后对应的时刻(时刻五)、音频播放设备200的麦克风采集的测试数据的时刻(时刻六)。
电子设备100接收音频播放设备200发送的报文三,报文三达到电子设备100的时刻为时刻七。电子设备100解析出报文三携带的信息,电子设备100根据报文三携带的信息可以计算出音频播放设备200播放音频数据的播放时延。
电子设备100可以计算出电子设备100与音频播放设备200之间的蓝牙通道的传输时延,即音频数据帧离开电子设备100的时刻(时刻三)与测试数据到达音频播放设备200的蓝牙协议栈的时刻(时刻四)的差值为电子设备100与音频播放设备200之间的蓝牙通道的传输时延。示例性的,当时刻三为10:00:320,时刻四为10:05:360,电子设备100与音频播放设备200的相对时差为5分钟,则电子设备100与音频播放设备200之间的蓝牙通道的传输时延为40ms。
电子设备100可以计算出音频播放设备200的编解码时延,即测试数据解码后对应的时刻(时刻五)与测试数据到达音频播放设备200的蓝牙协议栈的时刻(时刻四)的差值为音频播放设备200的编解码时延。示例性的,当时刻五为10:00:400,时刻四为10:05:360,电子设备100与音频播放设备200的相对时差为5分钟,则音频播放设备200的编解码时延为40ms。
电子设备100可以计算出音频播放设备200的硬件时延。在一些实施例中,音频播放设备200的硬件时延也可以是音频播放设备200在出厂时已经测试好的,音频播放设备200不 需要在后续使用时计算出音频播放设备200的硬件时延。在另一些实施例中,音频播放设备200的麦克风采集的测试数据的时刻(时刻六)与测试数据解码后对应的时刻(时刻五)的差值为音频播放设备200的硬件时延。示例性的,当时刻六为10:00:480,时刻五为10:05:400,电子设备100与音频播放设备200的相对时差为5分钟,则音频播放设备200的硬件时延为80ms。
电子设备100可以计算出音频播放设备200的播放音频数据的播放时延,音频播放设备200的麦克风采集的测试数据的时刻(时刻六)与测试数据离开电子设备100的时刻(时刻三)的差值为音频播放设备200的播放音频数据的播放时延,或者音频播放设备200的播放音频数据的播放时延等于电子设备100与音频播放设备200之间的蓝牙通道的传输时延加上音频播放设备200的编解码时延加上音频播放设备200的硬件时延。示例性的,时刻三为10:00:320,时刻六为10:05:480,电子设备100与音频播放设备200的相对时差为5分钟,则音频播放设备200的播放音频数据的播放时延为160ms。
在电子设备100根据测试数据计算出音频播放设备200播放音频数据的播放时延的同时,电子设备100也可以根据测试数据计算出音频播放设备300播放音频数据的播放时延。两者可以同时进行,也可以分开进行,本申请在此不做限定。
如图8所示,在电子设备100将测试数据发送至音频播放设备300的同时,电子设备100将测试数据发送至音频播放设备300,电子设备100记录下测试数据离开电子设备100的时刻,即时刻三,并且测试数据包括测试数据离开电子设备100的时刻,即时刻三。测试数据可以是特定频率的音频数据,该特定频率的音频数据可以是人耳可感知的音频数据,也可以是人耳不可感知的音频数据,本申请在此不做限定。
测试数据经过电子设备100与音频播放设备300之间的蓝牙通道,经过一段时间后传送至音频播放设备300的蓝牙协议栈。音频播放设备300记录下测试数据到达音频播放设备300的蓝牙协议栈的时刻,即时刻八。时刻八与时刻三的差值为电子设备100与音频播放设备300之间的蓝牙通道的传输时延。
之后,音频播放设备300将测试数据解码出来,音频播放设备300记录下测试数据解码后对应的时刻,即时刻九。时刻九与时刻八的差值为音频播放设备300的编解码时延。
之后,音频播放设备300将解码后的测试数据传输至音频播放模块,音频播放模块将测试数据进行模数转换、功率放大等操作播放出去,使得人耳可听到音频播放设备300播放的音频数据。也即,测试数据播放出去后,音频播放设备300记录下音频播放设备300的麦克风采集的测试数据的时刻,即时刻十,时刻十与时刻九的差值为音频播放设备300的硬件时延。
在音频播放设备300记录下音频播放设备300的麦克风采集的测试数据的时刻之后,音频播放设备300发送报文四至电子设备100,报文四携带了测试数据离开电子设备100的时刻(时刻三)、测试数据到达音频播放设备300的蓝牙协议栈的时刻(时刻八)、测试数据解码后对应的时刻(时刻九)、音频播放设备300的麦克风采集的测试数据的时刻(时刻十)。
电子设备100接收音频播放设备300发送的报文四,报文四到达电子设备100的时刻为时间十一。电子设备100解析出报文四携带的信息,电子设备100根据报文四携带的信息可以计算出音频播放设备300播放音频数据的播放时延。
电子设备100可以计算出电子设备100与音频播放设备300之间的蓝牙通道的传输时延,即音频数据帧离开电子设备100的时刻(时刻三)与测试数据到达音频播放设备300的蓝牙协议栈的时刻(时刻八)的差值为电子设备100与音频播放设备300之间的蓝牙通道的传输 时延。示例性的,当时刻三为10:00:320,时刻八为10:10:400,电子设备100与音频播放设备300的相对时差为10分钟,则电子设备100与音频播放设备300之间的蓝牙通道的传输时延为80ms。
电子设备100可以计算出音频播放设备300的编解码时延,即测试数据解码后对应的时刻(时刻九)与测试数据到达音频播放设备300的蓝牙协议栈的时刻(时刻八)的差值为音频播放设备300的编解码时延。示例性的,当时刻八为10:00:400,时刻九为10:10:440,电子设备100与音频播放设备300的相对时差为10分钟,则音频播放设备300的编解码时延为40ms。
电子设备100可以计算出音频播放设备300的硬件时延。在一些实施例中,音频播放设备300的硬件时延也可以是音频播放设备300在出厂时已经测试好的,音频播放设备300不需要在后续使用时计算出音频播放设备300的硬件时延。在另一些实施例中,音频播放设备300的麦克风采集的测试数据的时刻(时刻十)与测试数据解码后对应的时刻(时刻九)的差值为音频播放设备300的硬件时延。示例性的,当时刻十为10:00:560,时刻九为10:10:440,电子设备100与音频播放设备300的相对时差为10分钟,则音频播放设备300的硬件时延为120ms。
电子设备100可以计算出音频播放设备300的播放音频数据的播放时延,音频播放设备300的麦克风采集的测试数据的时刻(时刻十)与测试数据离开电子设备100的时刻(时刻三)的差值为音频播放设备300的播放音频数据的播放时延,或者音频播放设备300的播放音频数据的播放时延等于电子设备100与音频播放设备300之间的蓝牙通道的传输时延加上音频播放设备300的编解码时延加上音频播放设备300的硬件时延。示例性的,时刻三为10:00:320,时刻十为10:10:560,电子设备100与音频播放设备300的相对时差为10分钟,则音频播放设备300的播放音频数据的播放时延为240ms。
电子设备100计算出音频播放设备200与音频播放设备300的播放时延之后,若音频播放设备200的播放时延大于音频播放设备300的播放时延,电子设备100在第M时刻将停止播放音频指令发送至音频播放设备200,在经过时间T之后,电子设备100将开始播放音频指令和音频数据发送至音频播放设备300。若音频播放设备200的播放时延小于音频播放设备300的播放时延,电子设备100在第M时刻将开始播放音频指令和音频数据发送至音频播放设备300,在经过差值T之后,电子设备100将停止播放音频指令发送至音频播放设备200。其中,时间T为音频播放设备200的播放时延与音频播放设备300的播放时延的差值。
首先介绍,当音频数据为音乐或视频应用播放的音频数据这一应用场景中,电子设备100可以提前获取到当前播放的音频数据的时间戳之后的音频数据。具体的,电子设备100发现音频播放设备300,电子设备100不断开与音频播放设备200的连接,与音频播放设备300建立蓝牙连接。之后,待音频播放设备300的音频通路初始化完成之后,电子设备100计算音频播放设备200和音频播放设备300的播放时延,音频播放设备200和音频播放设备300的播放时延计算完毕之后,电子设备100控制音频播放设备200和音频播放设备300无缝衔接切换播放音频数据。
音频播放设备200的播放时延小于音频播放设备300的播放时延。
如图9所示,图9示例性示出了电子设备100实现音频播放设备200与音频播放设备300播放的音频数据无缝衔接的时序图。需要说明的是,图9以及图9所示的时刻为电子设备100的***时间。
示例性的,若音频播放设备200的蓝牙传输时延为40ms,音频播放设备200的编解码时延为40ms,音频播放设备200的硬件时延为80ms,则音频播放设备200的播放时延为160ms。电子设备100与音频播放设备200的相对时间差为5分钟。
若音频播放设备300的蓝牙传输时延为80ms,音频播放设备300的编解码时延为40ms,音频播放设备300的硬件时延为120ms,则音频播放设备300的播放时延为240ms。电子设备100与音频播放设备300的相对时间差为10分钟。
首先,电子设备100与音频播放设备200建立连接,电子设备200将音频数据发送至音频播放设备200,音频播放设备200播放音频数据。
之后,音频播放设备300开启,电子设备100不断开与音频播放设备200的连接,同时与音频播放设备300建立连接。
示例性的,音频播放设备300在时刻10:00:240时与电子设备100建立蓝牙连接。
经过一段时间后,音频播放设备300的音频通路初始化完成,音频播放设备300向电子设备100发送音频通路初始化完成通知,电子设备100接收并响应音频播放设备300发送的音频通路初始化完成通知,电子设备100开始计算音频播放设备200与音频播放设备300的播放时延。电子设备100如何计算音频播放设备200与音频播放设备300的播放时延的,在前述实施例已详细介绍,本申请在此不再赘述。
示例性的,在时刻10:00:280时,音频播放设备300的音频通路初始化完成。之后,在时刻10:00:320时,电子设备100同时向音频播放设备200和音频播放设备300发送一段特殊频率的音频数据,以计算音频播放设备200和音频播放设备300的播放时延。由于音频播放设备200的播放时延小于音频播放设备300的播放时延,因此,音频播放设备200的播放时延比音频播放设备300的播放时延先计算完成。例如,在时刻10:00:520时,音频播放设备200的播放时延计算完毕,在时刻10:00:600时,音频播放设备300的播放时延计算完毕。
电子设备100计算完音频播放设备200与音频播放设备300的播放时延之后,因为音频播放设备200的播放时延小于音频播放设备300的播放时延,因此电子设备100首先向音频播放设备300发送开始播放指令。
示例性的,电子设备100在时刻10:00:640时,向音频播放设备300发送开始播放指令。
在音频播放设备300开始播放音频数据之前,电子设备100还继续将音频数据发送至音频播放设备200。
示例性的,电子设备100在时刻10:00:640时,向音频播放设备300发送开始播放指令的同时,将时间戳为2'30”00的音频数据发送至音频播放设备200。
在电子设备100向音频播放设备300发送开始播放指令后的时间ΔT后,电子设备100向音频播放设备200发送停止播放指令。需要说明的是,时间ΔT为音频播放设备200与音频播放设备300的播放时延的差值。
示例性的,若音频播放设备200的播放时延为160ms,音频播放设备300的播放时延为240ms,则音频播放设备200与音频播放设备300的播放时延的差值ΔT为80ms。
电子设备100在时刻10:00:640时,向音频播放设备300发送开始播放指令。经过80ms之后,电子设备100在时刻10:00:720时,向音频播放设备200发送停止播放指令。
在音频播放设备300开始播放音频数据之前,电子设备100还继续将音频数据发送至音频播放设备200,因此,在电子设备100在向音频播放设备200发送停止播放指令的同时,将对应的时间戳的音频数据发送至音频播放设备200。
示例性的,电子设备100在时刻10:00:720时,向音频播放设备200发送停止播放指令的 同时,将时间戳为2'30”80的音频数据发送至音频播放设备200。
电子设备100将停止播放指令发送至音频播放设备200之后,停止播放指令经过电子设备100与音频播放设备200之间的蓝牙通道传输至音频播放设备200,之后经过音频播放设备200中的解码器将包含停止播放指令的数据包解码出来,音频播放设备200识别出停止播放指令,音频播放设备200控制音频播放设备200中的编解码器停止工作。音频播放设备200中的编解码器停止工作之后,音频播放设备200在编解码器停止工作之前解码出的音频数据将播放出来。音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,但是音频播放设备200中的编解码器已停止工作,无法将音频数据在解码出来,因此音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,将不会被播放出来。
因此,电子设备100在向音频播放设备200发送停止播放指令的同时,将该时刻对应的时间戳的音频数据同时发送给音频播放设备200,经过音频播放设备200的蓝牙传输时延和编解码时延之后,该时间戳的音频数据刚好被解码出来,音频播放设备200的编解码器刚好停止工作。
示例性的,由前述实施例可知,音频播放设备200的蓝牙传输时延为40ms,音频播放设备200的编解码时延为40ms。因此,电子设备100在时刻10:00:720时,将时间戳为2'30”80的音频数据发送至音频播放设备200,经过蓝牙传输时延40ms和编解码时延40ms,一共是80ms之后,时间戳为2'30”80的音频数据刚好在时刻10:00:800被解码出来。在时刻10:00:800时,音频播放设备200中的编解码器刚好停止工作,并且在电子设备100在向音频播放设备200发送停止播放指令的同时,发送的对应的时间戳的音频数据刚好被解码出来。该对应的时间戳的音频数据可以被音频播放设备200播放出来,并且该对应的时间戳的音频数据是音频播放设备200最后播放的音频数据。
示例性的,在时刻10:00:800时,时间戳为2'30”80的音频数据被音频播放设备200解码出来,在经过音频播放设备200的硬件时延之后,该时间为2'30”80的音频数据的音频数据被音频播放设备200播放出来。由前述实施例可知,音频播放设备200的硬件时延为80ms,因此在时刻10:00:880时,该时间为2'30”80的音频数据的音频数据被音频播放设备200播放出来。
为了使得音频播放设备200刚好停止播放的音频数据的时间戳与音频播放设备300刚好开始播放的时间戳是一致的,因此电子设备100在向音频播放设备200发送停止播放指令时,同时发送的对应时间戳的音频数据,在向音频播放设备300发送开始播放指令的同时,将该对应时间戳的音频数据发送至音频播放设备300。
示例性的,在时刻10:00:720时,电子设备100向音频播放设备200发送停止播放指令时,向音频播放设备200发送的音频数据的时间戳为2'30”80。因此在时刻10:00:640时,电子设备200向音频播放设备300发送开始播放指令的同时,将时间戳为2'30”80的音频数据发送至音频播放设备300。由于音频播放设备300的播放时延为240ms,因此,在时刻10:00:880时,音频播放设备300刚好将时间戳为2'30”80的音频数据播放出来。
前述在时刻10:00:880时,音频播放设备200播放的最后音频数据的时间戳为2'30”80,而在时刻10:00:880时,音频播放设备300刚好将时间戳为2'30”80的音频数据播放出来。因此音频播放设备200刚好停止播放,音频播放设备300刚好开始播放,音频播放设备200与音频播放设备300做到了无缝衔接切换播放音频数据。
需要说明的是,在时刻10:00:640时,电子设备100向音频播放设备200发送的音频数据 的时间戳为2'30”00,而电子设备100向音频播放设备300发送的音频数据的时间戳为2'30”80。因为,该音频数据为音乐或视频应用播放的音频数据,电子设备100会将缓存一段数据。因此,在时刻10:00:640,电子设备100在向音频播放设备200发送时间戳为2'30”00的音频数据时,可以提前获取到时间戳为2'30”80的音频数据,并将该时间戳为2'30”80的音频数据发送至音频播放设备300。
音频播放设备200的播放时延大于音频播放设备300的播放时延。
如图10所示,图10示例性示出了电子设备100实现音频播放设备200与音频播放设备300播放的音频数据无缝衔接的时序图。
需要说明的是,图10及图10所示的实施例涉及的时刻为电子设备100的***时间。
示例性的,若音频播放设备200的蓝牙传输时延为80ms,音频播放设备200的编解码时延为40ms,音频播放设备200的硬件时延为120ms,则音频播放设备200的播放时延为240ms。电子设备100与音频播放设备200的相对时间差为5分钟。
若音频播放设备300的蓝牙传输时延为40ms,音频播放设备300的编解码时延为40ms,音频播放设备300的硬件时延为80ms,则音频播放设备300的播放时延为160ms。电子设备100与音频播放设备200的相对时间差为10分钟。
首先,电子设备100与音频播放设备200建立连接,电子设备200将音频数据发送至音频播放设备200,音频播放设备200播放音频数据。
之后,音频播放设备300开启,电子设备100不断开与音频播放设备200的连接,同时与音频播放设备300建立连接。
示例性的,音频播放设备300在时刻10:00:240时与电子设备100建立蓝牙连接。
经过一段时间后,音频播放设备300的音频通路初始化完成,音频播放设备300向电子设备100发送音频通路初始化完成通知,电子设备100接收并响应音频播放设备300发送的音频通路初始化完成通知,电子设备100开始计算音频播放设备200与音频播放设备300的播放时延。电子设备100如何计算音频播放设备200与音频播放设备300的播放时延的,在前述实施例已详细介绍,本申请在此不再赘述。
示例性的,在时刻10:00:280时,音频播放设备300的音频通路初始化完成。之后,在时刻10:00:320时,电子设备100同时向音频播放设备200和音频播放设备300发送一段特殊频率的音频数据,以计算音频播放设备200和音频播放设备300的播放时延。由于音频播放设备200的播放时延大于音频播放设备300的播放时延,因此,音频播放设备300的播放时延比音频播放设备200的播放时延先计算完成。例如,在时刻10:00:520时,音频播放设备300的播放时延计算完毕,在时刻10:00:600时,音频播放设备200的播放时延计算完毕。
电子设备100计算完音频播放设备200与音频播放设备300的播放时延之后,因为音频播放设备200的播放时延大于音频播放设备300的播放时延,因此电子设备100首先向音频播放设备200发送停止播放指令。
示例性的,电子设备100在时刻10:00:640时,向音频播放设备200发送停止播放指令。
在音频播放设备300开始播放音频数据之前,电子设备100还继续将音频数据发送至音频播放设备200。
示例性的,在时刻10:00:640时,电子设备100将时间戳为2'30”00的音频数据发送至音频播放设备200。
在电子设备100向音频播放设备200发送停止播放指令后的时间ΔT后,电子设备100 向音频播放设备300发送开始播放指令。需要说明的是,时间ΔT为音频播放设备200与音频播放设备300的播放时延的差值。
示例性的,若音频播放设备200的播放时延为240ms,音频播放设备300的播放时延为160ms,则音频播放设备200与音频播放设备300的播放时延的差值ΔT为80ms。
电子设备100在时刻10:00:640时,向音频播放设备200发送停止播放指令。经过80ms之后,电子设备100在时刻10:00:720时,向音频播放设备300发送开始播放指令。
电子设备100将停止播放指令发送至音频播放设备200之后,停止播放指令经过电子设备100与音频播放设备200之间的蓝牙通道传输至音频播放设备200,之后经过音频播放设备200中的解码器将包含停止播放指令的数据包解码出来,音频播放设备200识别出停止播放指令,音频播放设备200控制音频播放设备200中的编解码器停止工作。音频播放设备200中的编解码器停止工作之后,音频播放设备200在编解码器停止工作之前解码出的音频数据将播放出来。音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,但是音频播放设备200中的编解码器已停止工作,无法将音频数据在解码出来,因此音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,将不会被播放出来。
因此,电子设备100在向音频播放设备200发送停止播放指令的同时,将该时刻对应的时间戳的音频数据同时发送给音频播放设备200,经过音频播放设备200的蓝牙传输时延和编解码时延之后,该时间戳的音频数据刚好被解码出来,音频播放设备200的编解码器刚好停止工作。
示例性的,由前述实施例可知,音频播放设备200的蓝牙传输时延为80ms,音频播放设备200的编解码时延为40ms。因此,电子设备100在时刻10:00:760时,将时间戳为2'30”00的音频数据发送至音频播放设备200,经过蓝牙传输时延80ms和编解码时延40ms,一共是120ms之后,时间戳为2'30”00的音频数据刚好在时刻10:00:760被解码出来。在时刻10:00:760时,音频播放设备200中的编解码器刚好停止工作,并且在电子设备100在向音频播放设备200发送停止播放指令的同时,发送的对应的时间戳的音频数据刚好被解码出来。该对应的时间戳的音频数据可以被音频播放设备200播放出来,并且该对应的时间戳的音频数据是音频播放设备200最后播放的音频数据。
示例性的,在时刻10:00:760时,时间戳为2'30”00的音频数据被音频播放设备200解码出来,在经过音频播放设备200的硬件时延之后,该时间为2'30”00的音频数据的音频数据被音频播放设备200播放出来。由前述实施例可知,音频播放设备200的硬件时延为120ms,因此在时刻10:00:880时,该时间为2'30”00的音频数据的音频数据被音频播放设备200播放出来。
为了使得音频播放设备200刚好停止播放的音频数据的时间戳与音频播放设备300刚好开始播放的时间戳是一致的,因此电子设备100在向音频播放设备200发送停止播放指令时,同时发送的对应时间戳的音频数据,在向音频播放设备300发送开始播放指令的同时,将该对应时间戳的音频数据发送至音频播放设备300。
示例性的,在时刻10:00:640时,电子设备100向音频播放设备200发送停止播放指令时,向音频播放设备200发送的音频数据的时间戳为2'30”00。因此在时刻10:00:720时,电子设备200向音频播放设备300发送开始播放指令的同时,将时间戳为2'30”00的音频数据发送至音频播放设备300。由于音频播放设备300的播放时延为160ms,因此,在时刻10:00:880时,音频播放设备300刚好将时间戳为2'30”00的音频数据播放出来。
前述在时刻10:00:880时,音频播放设备200播放的最后音频数据的时间戳为2'30”00,而在时刻10:00:880时,音频播放设备300刚好将时间戳为2'30”00的音频数据播放出来。因此音频播放设备200刚好停止播放,音频播放设备300刚好开始播放,音频播放设备200与音频播放设备300做到了无缝衔接切换播放音频数据。
其次介绍,当音频数据为实时通话这一应用场景中,电子设备100不可以提前获取到当前播放的音频数据的时间戳之后的音频数据。具体的,电子设备100发现音频播放设备300,电子设备100不断开与音频播放设备200的连接,与音频播放设备300建立蓝牙连接。之后,待音频播放设备300的音频通路初始化完成之后,电子设备100计算音频播放设备200和音频播放设备300的播放时延,音频播放设备200和音频播放设备300的播放时延计算完毕之后,电子设备100控制音频播放设备200和音频播放设备300无缝衔接切换播放音频数据。
音频播放设备200的播放时延小于音频播放设备300的播放时延。
如图11所示,图11示例性示出了电子设备100实现音频播放设备200与音频播放设备300播放的音频数据无缝衔接的时序图。需要说明的是,图11以及图11所示的时刻为电子设备100的***时间。
示例性的,若音频播放设备200的蓝牙传输时延为40ms,音频播放设备200的编解码时延为40ms,音频播放设备200的硬件时延为80ms,则音频播放设备200的播放时延为160ms。电子设备100与音频播放设备200的相对时间差为5分钟。
若音频播放设备300的蓝牙传输时延为80ms,音频播放设备300的编解码时延为40ms,音频播放设备300的硬件时延为120ms,则音频播放设备300的播放时延为240ms。电子设备100与音频播放设备300的相对时间差为10分钟。
首先,电子设备100与音频播放设备200建立连接,电子设备200将音频数据发送至音频播放设备200,音频播放设备200播放音频数据。
之后,音频播放设备300开启,电子设备100不断开与音频播放设备200的连接,同时与音频播放设备300建立连接。
示例性的,音频播放设备300在时刻10:00:240时与电子设备100建立蓝牙连接。
经过一段时间后,音频播放设备300的音频通路初始化完成,音频播放设备300向电子设备100发送音频通路初始化完成通知,电子设备100接收并响应音频播放设备300发送的音频通路初始化完成通知,电子设备100开始计算音频播放设备200与音频播放设备300的播放时延。电子设备100如何计算音频播放设备200与音频播放设备300的播放时延的,在前述实施例已详细介绍,本申请在此不再赘述。
示例性的,在时刻10:00:280时,音频播放设备300的音频通路初始化完成。之后,在时刻10:00:320时,电子设备100同时向音频播放设备200和音频播放设备300发送一段特殊频率的音频数据,以计算音频播放设备200和音频播放设备300的播放时延。由于音频播放设备200的播放时延小于音频播放设备300的播放时延,因此,音频播放设备200的播放时延比音频播放设备300的播放时延先计算完成。例如,在时刻10:00:520时,音频播放设备200的播放时延计算完毕,在时刻10:00:600时,音频播放设备300的播放时延计算完毕。
电子设备100计算完音频播放设备200与音频播放设备300的播放时延之后,因为音频播放设备200的播放时延小于音频播放设备300的播放时延,因此电子设备100首先向音频播放设备300发送开始播放指令。
示例性的,电子设备100在时刻10:00:640时,向音频播放设备300发送开始播放指令。
在音频播放设备300开始播放音频数据之前,电子设备100还继续将音频数据发送至音频播放设备200。
示例性的,电子设备100在时刻10:00:640时,向音频播放设备300发送开始播放指令的同时,将时间戳为2'30”00的音频数据发送至音频播放设备200。
由于该音频数据为实时通话中的音频数据,电子设备100不能在时刻10:00:640获取到时间戳2'30”00之后的音频数据。即在同一时刻,电子设备100向音频播放设备200和音频播放设备300发送的音频数据的时间戳是一样的。
示例性的,电子设备100在时刻10:00:640时,将时间戳为2'30”00的音频数据发送至音频播放设备200的同时,电子设备200将时间戳为2'30”00的音频数据发送至音频播放设备300。
在电子设备100向音频播放设备300发送开始播放指令后的时间ΔT后,电子设备100向音频播放设备200发送停止播放指令。需要说明的是,时间ΔT为音频播放设备200与音频播放设备300的播放时延的差值。
示例性的,若音频播放设备200的播放时延为160ms,音频播放设备300的播放时延为240ms,则音频播放设备200与音频播放设备300的播放时延的差值ΔT为80ms。
电子设备100在时刻10:00:640时,向音频播放设备300发送开始播放指令。经过80ms之后,电子设备100在时刻10:00:720时,向音频播放设备200发送停止播放指令。
在音频播放设备300开始播放音频数据之前,电子设备100还继续将音频数据发送至音频播放设备200。
示例性的,电子设备100在时刻10:00:720时,向音频播放设备200发送停止播放指令的同时,将时间戳为2'30”80的音频数据发送至音频播放设备200。
由于该音频数据为实时通话中的音频数据,电子设备100不能在时刻10:00:720获取到时间戳2'30”80之后的音频数据。即在同一时刻,电子设备100向音频播放设备200和音频播放设备300发送的音频数据的时间戳是一样的。
示例性的,电子设备100在时刻10:00:720时,将时间戳为2'30”80的音频数据发送至音频播放设备200的同时,电子设备200将时间戳为2'30”80的音频数据发送至音频播放设备300。
电子设备100将停止播放指令发送至音频播放设备200之后,停止播放指令经过电子设备100与音频播放设备200之间的蓝牙通道传输至音频播放设备200,之后经过音频播放设备200中的解码器将包含停止播放指令的数据包解码出来,音频播放设备200识别出停止播放指令,音频播放设备200控制音频播放设备200中的编解码器停止工作。音频播放设备200中的编解码器停止工作之后,音频播放设备200在编解码器停止工作之前解码出的音频数据将播放出来。音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,但是音频播放设备200中的编解码器已停止工作,无法将音频数据在解码出来,因此音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,将不会被播放出来。
因此,电子设备100在向音频播放设备200发送停止播放指令的同时,将该时刻对应的时间戳的音频数据同时发送给音频播放设备200,经过音频播放设备200的蓝牙传输时延和编解码时延之后,该时间戳的音频数据刚好被解码出来,音频播放设备200的编解码器刚好停止工作。
示例性的,由前述实施例可知,音频播放设备200的蓝牙传输时延为40ms,音频播放设 备200的编解码时延为40ms。因此,电子设备100在时刻10:00:720时,将时间戳为2'30”80的音频数据发送至音频播放设备200,经过蓝牙传输时延40ms和编解码时延40ms,一共是80ms之后,时间戳为2'30”80的音频数据刚好在时刻10:00:800被解码出来。在时刻10:00:800时,音频播放设备200中的编解码器刚好停止工作,并且在电子设备100在向音频播放设备200发送停止播放指令的同时,发送的对应的时间戳的音频数据刚好被解码出来。该对应的时间戳的音频数据可以被音频播放设备200播放出来,并且该对应的时间戳的音频数据是音频播放设备200最后播放的音频数据。
示例性的,在时刻10:00:800时,时间戳为2'30”80的音频数据被音频播放设备200解码出来,在经过音频播放设备200的硬件时延之后,该时间为2'30”80的音频数据的音频数据被音频播放设备200播放出来。由前述实施例可知,音频播放设备200的硬件时延为80ms,因此在时刻10:00:880时,该时间为2'30”80的音频数据的音频数据被音频播放设备200播放出来。同时,电子设备100在时刻10:00:640时,将时间戳为2'30”00的音频数据发送至音频播放设备200,由于音频播放设备200的播放时延为160ms,因此在时刻10:00:800时,时间戳为2'30”00的音频数据被音频播放设备200播放出来。
对于音频播放设备300,电子设备100在时刻10:00:640时,向音频播放设备300发送的音频数据的时间戳为2'30”00。由于音频播放设备300的播放时延为240ms,因此音频播放设备300在时刻10:00:880时,该时间为2'30”00的音频数据的音频数据被音频播放设备300播放出来。
由上述分析可知,在时刻10:00:880时,音频播放设备200最后播放的音频数据的时间戳为2'30”80。音频播放设备300刚开始播放的音频数据的时间戳为2'30”00。因此音频播放设备300与音频播放设备200重复播放的音频数据的时间戳为2'30”00-2'30”80。
为了解决音频播放设备300与音频播放设备200重复播放的音频数据的问题,音频播放设备200在播放时间戳为2'30”00-2'30”80的音频数据时,播放的音频数据的音量逐渐减小,音频播放设备300在播放时间戳为2'30”00-2'30”80的音频数据时,播放的音频数据的音量逐渐增大。
示例性的,在时刻2'30”800-时刻2'30”880之间,电子设备100播放的时间戳为2'30”00-2'30”80的音频数据的音量逐渐减小。在时刻2'30”880之后,电子设备100播放的时间戳为2'30”00-2'30”80的音频数据的音量逐渐增大。
具体实现中,在电子设备100向音频播放设备200发送时间戳为2'30”00的音频数据的同时,将减小音量指令发送至音频播放设备200。
示例性的,在时刻10:00:640时,电子设备100将时间戳为2'30”00的音频数据发送给音频播放设备200的同时,电子设备100将减小音量指令发送至音频播放设备200。
同时,在电子设备100向音频播放设备300发送时间戳为2'30”00的音频数据的同时,将增大音量指令发送至音频播放设备300。
示例性的,在时刻10:00:640时,电子设备100将时间戳为2'30”00的音频数据发送给音频播放设备300的同时,电子设备100将增大音量指令发送至音频播放设备300。
音频播放设备200的播放时延大于音频播放设备300的播放时延。
如图12所示,图12示例性示出了电子设备100实现音频播放设备200与音频播放设备300播放的音频数据无缝衔接的时序图。
需要说明的是,图12及图12所示的实施例涉及的时刻为电子设备100的***时间。
示例性的,若音频播放设备200的蓝牙传输时延为80ms,音频播放设备200的编解码时延为40ms,音频播放设备200的硬件时延为120ms,则音频播放设备200的播放时延为240ms。电子设备100与音频播放设备200的相对时间差为5分钟。
若音频播放设备300的蓝牙传输时延为40ms,音频播放设备300的编解码时延为40ms,音频播放设备300的硬件时延为80ms,则音频播放设备300的播放时延为160ms。电子设备100与音频播放设备200的相对时间差为10分钟。
首先,电子设备100与音频播放设备200建立连接,电子设备200将音频数据发送至音频播放设备200,音频播放设备200播放音频数据。
之后,音频播放设备300开启,电子设备100不断开与音频播放设备200的连接,同时与音频播放设备300建立连接。
示例性的,音频播放设备300在时刻10:00:240时与电子设备100建立蓝牙连接。
经过一段时间后,音频播放设备300的音频通路初始化完成,音频播放设备300向电子设备100发送音频通路初始化完成通知,电子设备100接收并响应音频播放设备300发送的音频通路初始化完成通知,电子设备100开始计算音频播放设备200与音频播放设备300的播放时延。电子设备100如何计算音频播放设备200与音频播放设备300的播放时延的,在前述实施例已详细介绍,本申请在此不再赘述。
示例性的,在时刻10:00:280时,音频播放设备300的音频通路初始化完成。之后,在时刻10:00:320时,电子设备100同时向音频播放设备200和音频播放设备300发送一段特殊频率的音频数据,以计算音频播放设备200和音频播放设备300的播放时延。由于音频播放设备200的播放时延大于音频播放设备300的播放时延,因此,音频播放设备300的播放时延比音频播放设备200的播放时延先计算完成。例如,在时刻10:00:520时,音频播放设备300的播放时延计算完毕,在时刻10:00:600时,音频播放设备200的播放时延计算完毕。
电子设备100计算完音频播放设备200与音频播放设备300的播放时延之后,因为音频播放设备200的播放时延大于音频播放设备300的播放时延,因此电子设备100首先向音频播放设备200发送停止播放指令。
示例性的,电子设备100在时刻10:00:640时,向音频播放设备200发送停止播放指令。
在音频播放设备300开始播放音频数据之前,电子设备100还继续将音频数据发送至音频播放设备200。
示例性的,在时刻10:00:640时,电子设备100将时间戳为2'30”00的音频数据发送至音频播放设备200。
在电子设备100向音频播放设备200发送停止播放指令后的时间ΔT后,电子设备100向音频播放设备300发送开始播放指令。需要说明的是,时间ΔT为音频播放设备200与音频播放设备300的播放时延的差值。
示例性的,若音频播放设备200的播放时延为240ms,音频播放设备300的播放时延为160ms,则音频播放设备200与音频播放设备300的播放时延的差值ΔT为80ms。
电子设备100在时刻10:00:640时,向音频播放设备200发送停止播放指令。经过80ms之后,电子设备100在时刻10:00:720时,向音频播放设备300发送开始播放指令。
电子设备100将停止播放指令发送至音频播放设备200之后,停止播放指令经过电子设备100与音频播放设备200之间的蓝牙通道传输至音频播放设备200,之后经过音频播放设备200中的解码器将包含停止播放指令的数据包解码出来,音频播放设备200识别出停止播放指令,音频播放设备200控制音频播放设备200中的编解码器停止工作。音频播放设备200 中的编解码器停止工作之后,音频播放设备200在编解码器停止工作之前解码出的音频数据将播放出来。音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,但是音频播放设备200中的编解码器已停止工作,无法将音频数据在解码出来,因此音频播放设备200在编解码器停止工作之后,接收到电子设备100发送的音频数据,将不会被播放出来。
因此,电子设备100在向音频播放设备200发送停止播放指令的同时,将该时刻对应的时间戳的音频数据同时发送给音频播放设备200,经过音频播放设备200的蓝牙传输时延和编解码时延之后,该时间戳的音频数据刚好被解码出来,音频播放设备200的编解码器刚好停止工作。
示例性的,由前述实施例可知,音频播放设备200的蓝牙传输时延为80ms,音频播放设备200的编解码时延为40ms。因此,电子设备100在时刻10:00:760时,将时间戳为2'30”00的音频数据发送至音频播放设备200,经过蓝牙传输时延80ms和编解码时延40ms,一共是120ms之后,时间戳为2'30”00的音频数据刚好在时刻10:00:760被解码出来。在时刻10:00:760时,音频播放设备200中的编解码器刚好停止工作,并且在电子设备100在向音频播放设备200发送停止播放指令的同时,发送的对应的时间戳的音频数据刚好被解码出来。该对应的时间戳的音频数据可以被音频播放设备200播放出来,并且该对应的时间戳的音频数据是音频播放设备200最后播放的音频数据。
示例性的,在时刻10:00:760时,时间戳为2'30”00的音频数据被音频播放设备200解码出来,在经过音频播放设备200的硬件时延之后,该时间为2'30”00的音频数据的音频数据被音频播放设备200播放出来。由前述实施例可知,音频播放设备200的硬件时延为120ms,因此在时刻10:00:880时,该时间为2'30”00的音频数据的音频数据被音频播放设备200播放出来。
为了使得音频播放设备200刚好停止播放的音频数据的时间戳与音频播放设备300刚好开始播放的时间戳是一致的,因此电子设备100在向音频播放设备200发送停止播放指令时,同时发送的对应时间戳的音频数据,在向音频播放设备300发送开始播放指令的同时,将该对应时间戳的音频数据发送至音频播放设备300。
示例性的,在时刻10:00:640时,电子设备100向音频播放设备200发送停止播放指令时,向音频播放设备200发送的音频数据的时间戳为2'30”00。因此在时刻10:00:720时,电子设备200向音频播放设备300发送开始播放指令的同时,将时间戳为2'30”00的音频数据发送至音频播放设备300。由于音频播放设备300的播放时延为160ms,因此,在时刻10:00:880时,音频播放设备300刚好将时间戳为2'30”00的音频数据播放出来。
前述在时刻10:00:880时,音频播放设备200播放的最后音频数据的时间戳为2'30”00,而在时刻10:00:880时,音频播放设备300刚好将时间戳为2'30”00的音频数据播放出来。因此音频播放设备200刚好停止播放,音频播放设备300刚好开始播放,音频播放设备200与音频播放设备300做到了无缝衔接切换播放音频数据。
如图13所示,图13为本申请实施例提供的一种音频数据无缝切换方法的流程图。该方法应用于音频播放***,该音频播放包括电子设备100、音频播放设备200和音频播放设备300。其中,音频播放设备200和音频播放设备300的硬件结构可以参考后续图16所示实施例中音频播放设备的结构,在此不再赘述。
S1305-S1308,音频播放设备200的播放时延大于音频播放设备300的播放时延时,电子 设备100实现两个蓝牙设备之间播放音频数据的无缝切换。
S13010-S1313,音频播放设备200的播放时延小于音频播放设备300的播放时延时,并且音频数据为可预测的应用场景中,电子设备100实现两个蓝牙设备之间播放音频数据的无缝切换。
S13014-S1319,音频播放设备200的播放时延小于音频播放设备300的播放时延时,并且音频数据为无法预测的应用场景中,电子设备100实现两个蓝牙设备之间播放音频数据的无缝切换。
需要说明的是,本申请实施例可以先执行S13010-S1313,在执行S13014-S1319,之后执行S1305-S1308;申请实施例可以先执行S13014-S1319,在执行S13010-S1313,之后执行S1305-S1308等等,本申请对于S13010-S1313、S13014-S1319、S1305-S1308的执行顺序不做限定。
S1301、电子设备100与音频播放设备200建立通信连接。
电子设备100可以通过蓝牙、Wi-Fi直连、局域网等任一项与音频播放设备200建立通信连接。本申请实施例以电子设备100与音频播放设备200通过蓝牙技术建立通信连接为例进行说明。
电子设备100与音频播放设备200建立蓝牙连接之后,电子设备100将音频数据发送至音频播放设备200,音频播放设备200播放该音频数据。
需要说明的是,音频数据可以是音乐或视频应用中播放的音频数据,也可以是实时通话中的音频数据,实时通话可以包括语音通话、视频通话等等。
S1302、电子设备100不断开与音频播放设备200的通信连接,与音频播放设备300建立通信连接。
电子设备100与音频播放设备200建立通信连接之后,音频播放设备300开启,电子设备100不断开与音频播放设备200的连接,电子设备100与音频播放设备200建立通信连接的同时,与音频播放设备300建立通信连接。
电子设备100如何与第二蓝牙和设备诶300建立连接的,请参考图3A-图5B所示的实施例,本申请在此不再赘述。
S1303、电子设备100确定出音频播放设备200的播放时延(第一播放时延)与音频播放设备300的播放时延(第二播放时延)。
电子设备100确定出音频播放设备200与音频播放设备300的播放时延的方法,请参考图7-图8所示的实施例,本身请在此不再赘述。
在一些实施例中,若电子设备100之前与音频播放设备200和音频播放设备300建立过通信连接,电子设备100中保存有音频播放设备200的播放时延和音频播放设备300的播放时延,则电子设备100可以不执行S1303。电子设备100不用计算音频播放设备200的播放时延和音频播放设备300的播放时延,直接从电子设备100中获取到音频播放设备200的播放时延和音频播放设备300的播放时延。
在一些实施例中,音频播放设备200的播放时延(第一播放时延)与音频播放设备300的播放时延(第二播放时延)可以指包括传输时延和硬件时延。具体的,音频播放设备200的播放时延为音频播放设备200接收到第一音频帧开始计时,直至音频播放设备200将第一 音频帧播放出来停止计时,这一段时间为音频播放设备200的播放时延。音频播放设备300的播放时延为音频播放设备300接收到第二音频帧开始计时,直至音频播放设备300将第二音频帧播放出来停止计时,这一段时间为音频播放设备300的播放时延。
这种情况下,第一播放时延和第二播放时延的计算过程如下:在电子设备与第二音频播放设备建立通信连接之后,在电子设备开始向第一音频播放设备发送停止指令或向第二音频播放设备发送开始指令之前,电子设备还需计算出第一音频播放设备和第二音频播放设备的播放时延。具体的,电子设备向第一音频播放设备发送第一测试数据,向第二音频播放设备发送第二测试数据。电子设备接收所第一音频播放设备发送的包含第五时刻和第六时刻的第一信息;其中,第五时刻为第一测试数据到达第一音频播放设备播放的时刻,第六时刻为第一音频播放设备播放第一测试数据的时刻。电子设备接收第二音频播放设备发送的包含第七时刻和第八时刻的第二信息;其中,第七时刻为第二测试数据到达第二音频播放设备播放的时刻,第八时刻为第二音频播放设备播放第二测试数据的时刻。电子设备确定出第一播放时延,第一播放时延为第六时刻与第五时刻的差值;电子设备确定出第二播放时延,第二播放时延为第八时刻与第七时刻的差值。这样,电子设备计算出第一音频播放设备和第二音频播放设备的播放时延,为后续第一音频播放设备和第二音频播放设备切换时无缝衔接播放音频数据提供了可能。
S1304、音频播放设备200的播放时延大于音频播放设备300的播放时延?
若音频播放设备200的播放时延大于音频播放设备300的播放时延,则电子设备100执行S1305-S1308。
对于实时通话应用场景(即音频数据为不可预测的)、播放音乐或播放视频应用场景(即音频数据为可预测的)来说,当音频播放设备200的播放时延大于音频播放设备300的播放时延,可以先将停止播放指令和第一时间戳的音频数据发送至音频播放设备200,在经过音频播放设备200的播放时延与音频播放设备300的播放时延差值之后,在向音频播放设备300发送开始播放指令和第一时间戳的音频数据,这样,在理想情况下,音频播放设备200刚播完第一时间戳的音频数据并停止播放音频数据,音频播放设备200刚开始播放第一时间戳的音频数据。实现了音频数据播放时的无缝切换。
若音频播放设备200的播放时延小于音频播放设备300的播放时延,则电子设备100执行S1309。
若音频播放设备200的播放时延小于音频播放设备300的播放时延,需要将实时通话应用场景(即音频数据为不可预测的)和播放音乐或播放视频应用场景(即音频数据为可预测的)分开,因为对于实时通话应用场景,由于音频播放设备200的播放时延小于音频播放设备300的播放时延,实时通话应用场景,不能提前获取到当前时间戳之后的音频数据,因此在最后音频播放设备200停止播放,音频播放设备300开始播放的音频数据的时间戳不一样,对于播放音乐或播放视频应用场景,可以提前获取到当前时间戳之后的音频数据,因为电子设备100是把音频数据对应的整个文件下载在本地,因此在最后音频播放设备200停止播放,音频播放设备300开始播放的音频数据的时间戳是一样的。为了解决,实时通话应用场景,最后音频播放设备200停止播放,音频播放设备300开始播放的音频数据的时间戳不一样,音频播放设备200与音频播放设备300播放重叠的音频数据段,音频播放设备200的音量逐渐减小,音频播放设备300的音量逐渐增大。对于该两种不同的情况,策略不同,需要分开处理。
在一些实施例中,电子设备100也可以先判断音频数据的类型,再根据音频播放设备200的播放时延和音频播放设备300的播放时延选择对应的策略。
S1305、电子设备100在第M时刻(第二时刻),发送停止播放指令和第一时间戳对应的音频数据(第一音频帧)至音频播放设备200(第一音频播放设备)。
第M时刻可以是如图10或图12所示的640ms时刻。
由于音频播放设备200的播放时延大于音频播放设备300的播放时延,因此电子设备100需要先将停止播放指令发送至音频播放设备200,以使得音频播放设备200刚好挺好停止播放,音频播放设备300刚好开始播放。
即在第M时刻,电子设备100将停止播放指令发送至音频播放设备200,在第M时刻,电子设备100播放的音频数据的时间戳为第一时间戳,则电子设备100还需将第一时间戳对应的音频数据发送至音频播放设备200。
需要说明的是,第M时刻为电子设备100的***时间。第一时间戳为电子设备100播放的音频数据的播放进度。
S1306、电子设备100在第N时刻(第三时刻),发送开始播放指令和第二时间戳对应的音频数据(第二音频帧)至音频播放设备300(第二音频播放设备)。
第N时刻可以是如图10或图12所示的720ms时刻。
第N时刻大于第M时刻,第N时刻与第M时刻的差值为音频播放设备200的播放时延与音频播放设备300的播放时延的差值。
在第M时刻,电子设备100在将停止播放指令和第一时间戳对应的音频数据发送至音频播放设备200之后,经过了音频播放设备200的播放时延与音频播放设备300的播放时延的差值时间之后,即在第N时刻,电子设备100将开始播放指令和第二时间戳对应的音频数据发送至音频播放设备300。
S1307、音频播放设备200在第P时刻(第四时刻),停止播放音频数据。
第P时刻可以是如图10或图12所示的880ms时刻。
S1308、音频播放设备300在第P时刻,开始播放音频数据的时间戳为第二时间戳。
第P时刻可以是如图10或图12所示的880ms时刻。
第一时间戳的音频数据的可以是如图10或图12所示的时间戳为2'30”00的音频数据。
第二时间戳的音频数据的可以是如图10或图12所示的时间戳为2'30”00之后相邻的时间戳的音频数据。
也即,在图10或图12中,电子设备100向音频播放设备300发送的时间戳为2'30”00的音频数据也可以为时间戳为2'30”00之后相邻的时间戳的音频数据。
第P时刻与第M时刻的差值为音频播放设备200的播放时延。
音频播放设备200接收电子设备100在第M时刻发送的第一时间戳对应的音频数据,经过音频播放设备200的播放时延时间之后,即在时刻三,音频播放设备200播放的最后的音频数据的时间戳为第一时间戳。之后,电子设备100停止播放音频数据。
时刻三与时刻二的差值为音频播放设备300的播放时延。
音频播放设备300接收电子设备100在第N时刻发送的第二时间戳对应的音频数据,经过音频播放设备300的播放时延时间之后,即在时刻三,音频播放设备300开始播放的音频 数据的时间戳为第二时间戳。之后,电子设备100将播放第二时间戳及第二时间戳以后的音频数据。
由上述分析可知,音频播放设备200刚停止播放音频数据时,音频播放设备300刚开始播放音频数据。并且音频播放设备200刚停止播放音频数据的时间戳与音频播放设备300刚开始播放音频数据的时间戳刚好吻合,解决了电子设备100切换蓝牙设备时出现音频数据中断的问题,提高了用户体验。
S1301-S1308可以参考图10和图12所示的实施例,本申请在此不再赘述。
在一些实施例中,由于传输网络和硬件问题,导致音频播放设备200停止播放音频数据的时刻与音频播放设备300开始播放音频数据的时刻不是在同一个时刻(例如第P时刻),即S1308也可以在S1307之前执行,S1307也可以在S1308之后执行,S1301与S1308也可以一起执行。只要音频播放设备200停止播放音频数据的时刻与音频播放设备300开始播放音频数据的时刻的差值在一定阈值(例如50ms)之内,用户是感觉不到时延存在的。
在一些实施例中,S1304-S1308可以替换为:
S1304、电子设备100在第二时刻,向音频播放设备200发送停止播放指令和第一音频帧。
S1305、电子设备100在第三时刻,向音频播放设备300发送开始播放指令和第二音频帧。
S1306、音频播放设备200在接收到电子设备100发送的停止播放指令和第一音频帧之后,在第一时刻播放完第一音频帧后停止播放音频数据。
S1307、音频播放设备300在电子设备100发送的开始播放指令和第二音频帧之后,在第一时刻开始播放第二音频帧。
其中,第一时刻与第二时刻的差值为音频播放设备200的第一播放时延,第一时刻与所示第三时刻的差值为音频播放设备300的第二播放时延;
第二时刻与第三时刻的差值为第一值,第一播放时延和第二播放时延的时延差为第一值。
当第一播放时延大于第二播放时延时,第一时刻先于第二时刻;当第一播放时延小于第二播放时延时,第二时刻先于第一时刻。
当音频播放设备200的播放时延小于音频播放设备300的播放时延时,第一时刻可以是图9所示的880ms,第二时刻可以是图9所示的720ms,第三时刻可以是图9所示的640ms。
当音频播放设备200的播放时延大于音频播放设备300的播放时延时,第一时刻可以是图9所示的880ms,第二时刻可以是图9所示的640ms,第三时刻可以是图9所示的720ms
其中,第二音频帧为第一音频帧相邻的下一帧音频数据帧。
S1308、电子设备在第一音频播放设备播放完第一音频帧后停止播放音频数据时,断开与第一音频播放设备的连接。
这样,电子设备在于第二音频数据建立连接时,不断开与第一音频播放设备的连接。当第二音频播放设备开始播放音频数据,恰好第一音频播放设备播放完第一音频帧后停止播放音频数据时,电子设备与第一音频播放设备断开连接,为实现无缝衔接播放音频数据提供了可能。
在一些实施例中,在电子设备与第二音频播放设备建立通信连接之后,在电子设备开始向第一音频播放设备发送停止指令或向第二音频播放设备发送开始指令之前,电子设备还需计算出第一音频播放设备和第二音频播放设备的播放时延。具体的,电子设备向第一音频播放设备发送第一测试数据,向第二音频播放设备发送第二测试数据。所述电子设备接收第一音频播放设备发送的包含第四时刻和第五时刻的第一信息;其中,第四时刻为第一测试数据 离开电子设备的时刻,第五时刻为第一音频播放设备播放第一测试数据的时刻;电子设备接收第二音频播放设备发送的包含第六时刻和第七时刻的第二信息;其中,第六时刻为第二测试数据离开电子设备的时刻,第七时刻为第二音频播放设备播放第二测试数据的时刻;电子设备确定出第一播放时延,第一播放时延为第五时刻与第四时刻的差值;电子设备确定出第二播放时延,第二播放时延为第七时刻与第六时刻的差值。
在一种可能的实现方式中,电子设备若之前计算过第一音频播放设备的播放时延和第二音频播放设备的播放时延,电子设备可以将第一音频播放设备的播放时延和第二音频播放设备的播放时延保存在电子设备内,之后,电子设备不需要每次重新计算第一音频播放设备的播放时延和第二音频播放设备的播放时延。
S1309、电子设备100判断出音频数据为可预测的音频数据?若是,则执行S1310-S1313;若否,则执行S1314-S1319。
示例性的,可预测的音频数据可以是音乐或视频应用中播放的音频数据。
示例性的,不可预测的音频数据可以是实时通话中的音频数据,例如语音通话、视频通话等等。
由于当音频播放设备200的播放时延小于音频播放设备300的播放时延时,对于不可预测的音频数据,电子设备100不能提前获取到当前时间戳之后的音频数据,因此音频播放设备200与音频播放设备300会重复播放一段音频数据,为了解决重复播放一段音频数据的问题,使音频播放设备200在播放重复的音频数据段时,音量逐渐减小,音频播放设备300在播放重复的音频数据段时,音量逐渐增大,解决重复播放的问题。
对于可预测的音频数据,电子设备100能提前获取到当前时间戳之后的音频数据,因此在理想情况下,音频播放设备200与音频播放设备300可以做到无缝衔接。
由上述分析可知,在音频播放设备200的播放时延小于音频播放设备300的播放时延情况下,需要对音频数据的类型进行分类,因为不同类型的音频数据的处理策略不同。
本申请可以先执行S1310-S1313,在执行S1314-S1319;也可以先执行S1314-S1319,在执行S1310-S1313,本身请在此不做限定。
在一些实施例中,电子设备100也可以不判断音频数据的类型,将所有场景的音频数据当作实时通话应用场景来处理,S1309可以不执行。
S1310、电子设备100在第M时刻(第六时刻),发送开始播放指令和第二时间戳对应的音频数据(第一音频帧)至音频播放设备300。
S1311、电子设备100在第N时刻(第五时刻),发送停止播放指令和第一时间戳对应的音频数据至音频播放设备200。
第N时刻可以是如图9所示的720ms时刻。
第N时刻大于第M时刻,第N时刻与第M时刻的差值为音频播放设备200的播放时延与音频播放设备300的播放时延的差值。
在第M时刻,电子设备100在将开始播放指令和第二时间戳对应的音频数据发送至音频播放设备300之后,经过了音频播放设备200的播放时延与音频播放设备300的播放时延的差值时间之后,即在第N时刻,电子设备100将停止播放指令和第一时间戳对应的音频数据发送至音频播放设备200。
S1312、音频播放设备200在第P时刻(第四时刻),停止播放音频数据。
S1313、音频播放设备300在第P时刻(第四时刻),开始播放音频数据的时间戳为第二时间戳。
第P时刻可以是如图9所示的880ms时刻。
时刻三与时刻二的差值为音频播放设备200的播放时延。
音频播放设备200接收电子设备100在第N时刻发送的第一时间戳对应的音频数据,经过音频播放设备200的播放时延时间之后,即在时刻三,音频播放设备200播放的最后的音频数据的时间戳为第一时间戳。之后,电子设备100停止播放音频数据。
第P时刻与第M时刻的差值为音频播放设备300的播放时延。
音频播放设备300接收电子设备100在第M时刻发送的第二时间戳对应的音频数据,经过音频播放设备300的播放时延时间之后,即在时刻三,音频播放设备300开始播放的音频数据的时间戳为第二时间戳。之后,电子设备100将播放第二时间戳及第二时间戳以后的音频数据。
由上述分析可知,音频播放设备200刚停止播放音频数据时,音频播放设备300刚开始播放音频数据。并且音频播放设备200刚停止播放音频数据的时间戳与音频播放设备300刚开始播放音频数据的时间戳刚好吻合,解决了电子设备100切换蓝牙设备时出现音频数据中断的问题,提高了用户体验。
S1310-S1313可以参考图9所示的实施例,本申请在此不再赘述。
在一些实施例中,由于传输网络和硬件问题,导致音频播放设备200停止播放音频数据的时刻与音频播放设备300开始播放音频数据的时刻不是在同一个时刻(例如第P时刻),即S1313也可以在S1312之前执行,S1312也可以在S1313之后执行,S1312与S1313也可以一起执行。只要音频播放设备200停止播放音频数据的时刻与音频播放设备300开始播放音频数据的时刻的差值在一定阈值(例如50ms)之内,用户是感觉不到时延存在的。
S1314、电子设备100在第M时刻(第三时刻),发送开始播放指令、第一时间戳对应的音频数据(第一音频帧)和音量逐渐增大指令至音频播放设备300。
第M时刻可以是如图11所示的640ms时刻。
由于音频播放设备200的播放时延小于音频播放设备300的播放时延,因此电子设备100需要先将开始播放指令发送至音频播放设备300,以使得音频播放设备200刚好挺好停止播放,音频播放设备300刚好开始播放。
即在第M时刻,电子设备100将开始播放指令发送至音频播放设备300,在第M时刻,电子设备100播放的音频数据的时间戳为第一时间戳,则电子设备100还需将第一时间戳对应的音频数据以及发音量逐渐增大指令送至音频播放设备300。
需要说明的是,第M时刻为电子设备100的***时间。第一时间戳为电子设备100播放的音频数据的播放进度。
S1315、电子设备100在第M时刻(第三时刻),将第一时间戳对应的音频数据和音量逐渐减小指令发送至音频播放设备200。
第M时刻可以是如图11所示的640ms时刻。
由于该音频数据为不可预测的音频数据,因此在第M时刻,电子设备100还需将第一时 间戳对应的音频数据和音量逐渐减小指令发送至音频播放设备200。
需要说明的是,电子设备100可以先执行S1315,在执行S1314,电子设备100也可以先执行S1314,在执行S1315,电子设备100也可以同时执行S1314和S1315,本申请在此不做限定。
S1316、电子设备100在第N时刻,发送停止播放指令和第二时间戳对应的音频数据(第二音频帧)至音频播放设备200,第二时间戳大于第一时间戳。
第N时刻可以是如图11所示的720ms时刻。
第二时间戳对应的音频数据可以是如图11所示的时间戳为2'30”80的音频数据。
第N时刻大于第M时刻,第N时刻与第M时刻的差值为音频播放设备200的播放时延与音频播放设备300的播放时延的差值。
在第M时刻,电子设备100在将开始播放指令和第一时间戳对应的音频数据发送至音频播放设备300之后,经过了音频播放设备200的播放时延与音频播放设备300的播放时延的差值时间之后,即在第N时刻,电子设备100将停止播放指令和第二时间戳对应的音频数据发送至音频播放设备200。
由于该音频数据为不可预测的音频数据,因此在第N时刻,电子设备100还需将第二时间戳对应的音频数据发送至音频播放设备300。
S1317、音频播放设备200在第P时刻(第一时刻),播放第一时间戳对应的音频数据。
第P时刻可以是如图11所示的800ms时刻。
第P时刻与第M时刻的差值,为音频播放设备200的播放时延。即电子设备100在第M时刻,将第一时间戳对应的音频数据发送至音频播放设备200,经过音频播放设备200的播放时延时间之后,在第P时刻,音频播放设备200将第一时间戳对应的音频数据播放出来。
若恰好在第P时刻,第一蓝牙设备100中的编解码器刚好停止工作,则在第P时刻,音频播放设备200最后解码出来的音频数据的时间戳为第二时间戳。则第P时刻与第N时刻的差值为第一蓝牙设备100的蓝牙传输时延与编解码时延。
S1318、音频播放设备200在第Q时刻(第二时刻),最后播放的音频数据的时间戳为第二时间戳。
第Q时刻可以是如图11所示的880ms时刻。
第Q时刻与第N时刻的差值为音频播放设备200的播放时延,第Q时刻与第P时刻的差值为音频播放设备200的硬件时延。
由S1317可知,在第P时刻,音频播放设备200最后解码出来的音频数据的时间戳为第二时间戳,经过音频播放设备200的硬件时延之后,即在第Q时刻,音频播放设备200最后播放的音频数据的而时间戳为第二时间戳。
S1319、音频播放设备300在第Q时刻(第二时刻),开始播放的音频数据的时间戳为第一时间戳。
第Q时刻可以是如图11所示的880ms时刻。
第Q时刻与第M时刻的差值为音频播放设备300的播放时延,由S1315可知,电子设备100在第M时刻,将第一时间戳对应的音频数据发送至音频播放设备200,经历过音频播 放设备300的播放时延之后,记载第Q时刻,音频播放设备300刚开始播放的音频数据的时间戳为第一时间戳。
由S1318与S1319可知,音频播放设备200最后播放的音频数据的时间戳为第二时间戳,音频播放设备300刚开始播放的音频数据的时间戳为第一时间戳。因此,音频播放设备300会重复播放第一蓝牙设备300已播放过的第一时间戳至第二时间戳之间的音频数据,为了解决重福播放的问题,电子设备100在向音频播放设备200发送第一时间戳音频数据的同时,向音频播放设备200发送音量逐渐减小指令,电子设备100在向音频播放设备300发送第一时间戳音频数据的同时,向音频播放设备300发送音量逐渐增大指令。这样,使得音频播放设备200播放时间戳一到时间戳二之间的音频数据的时候,播放音频数据的音量逐渐减小,音频播放设备300播放时间戳一到时间戳二之间的音频数据的时候,播放音频数据的音量逐渐增大,已解决两个蓝牙设备重复播放音频数据的问题。
S1314-S1319可以参考图11所示的实施例,本申请在此不再赘述。
在一些实施例中,当音频播放设备200的播放时延小于音频播放设备300的播放时延时,S1309和S1319可以替换为:
当音频播放设备200的播放时延小于音频播放设备300的播放时延时,电子设备不需要判断音频数据的类型,将可预测的音频数据和不可预测的音频数据均当作不可预测的音频数据进行处理。
S1309、电子设备100在第三时刻,向音频播放设备200发送第一指令和第一音频帧。
S1310、电子设备100在第三时刻,向音频播放设备300发送第二指令和第一音频帧。
S1311、音频播放设备200在接收到电子设备发送的第一指令和第一音频帧之后,在第一时刻音量递减播放第一音频帧,在第二时刻停止播放音频数据。
S1312、音频播放设备300在接收到电子设备发送的第二指令和第一音频帧之后,在第二时刻音量递增播放所述第一音频帧。
第二指令包括音量递增指令和开始播放指令。
在第三时刻,电子设备100向音频播放设备200发送第一指令和所述第一音频帧;在第三时刻,向音频播放设备300发送第二指令和第一音频帧;其中,第一时刻与所第三时刻的差值为音频播放设备200的第一播放时延,第二时刻与第三时刻的差值为音频播放设备300的第二播放时延;第二时刻与第一时刻的差值为第一值,第一播放时延和第二播放时延的时延差为第一值。
其中,第一音频播放设备的第一播放时延为第一音频帧离开电子设备开始计时,直至第一音频播放设备将第一音频帧播放出来停止计时,这一段时间为第一音频播放设备的第一播放时延。第二音频播放设备的第二播放时延为第一音频帧离开电子设备开始计时,直至第二音频播放设备将第一音频帧播放出来停止计时,这一段时间为第二音频播放设备的第二播放时延。第一音频帧可以为实时通话或者播放音乐或播放视频时的音频数据。
第一播放时延包括第一音频设备的蓝牙传输时延、第一音频设备的解码时延和第一音频设备的硬件时延。第二播放时延包括第二音频设备的蓝牙传输时延、第二音频设备的解码时延和第二音频设备的硬件时延。
电子设备100还向音频播放设备200发送第二音频帧,第一指令用于指示音频播放设备200在接收到电子设备发送的第一指令和第一音频帧之后,在第一时刻音量递减播放第一音频帧之后,在第二时刻播放完第二音频帧后停止播放音频数据。
音量递减可以是音量线性减小,或者音量梯度减小,音量减小到预设值之后不在减小,或者音量减小到一定时间后不在减小。
第一指令包括音量递减指令和停止播放指令。
第一时刻可以是如图11所示的800ms时刻,第二时刻可以是如图11所示的880ms时刻,第三时刻可以是如图11所示的640ms时刻。
在一些实施例中,在电子设备开始向第一音频播放设备发送停止指令或向第二音频播放设备发送开始指令之前,电子设备还需计算出第一音频播放设备和第二音频播放设备的播放时延。具体的,电子设备向第一音频播放设备发送第一测试数据,向第二音频播放设备发送第二测试数据。电子设备接收第一音频播放设备发送的包含第七时刻和第八时刻的第一信息;其中,第七时刻为第一测试数据离开电子设备的时刻,第八时刻为第一音频播放设备播放第一测试数据的时刻。电子设备接收第二音频播放设备发送的包含第九时刻和第十时刻的第二信息;其中,第九时刻为第二测试数据离开电子设备的时刻,第十时刻为第二音频播放设备播放第二测试数据的时刻。电子设备确定第一播放时延,第一播放时延为第八时刻与第七时刻之间的差值。电子设备确定出第二播放时延,第二播放时延为第十时刻与第九时刻之间的差值。这样,电子设备计算出第一音频播放设备和第二音频播放设备的播放时延,为后续第一音频播放设备和第二音频播放设备切换时无缝衔接播放音频数据提供了可能。
在一种可能的实现方式中,电子设备若之前计算过第一音频播放设备的播放时延和第二音频播放设备的播放时延,电子设备可以将第一音频播放设备的播放时延和第二音频播放设备的播放时延保存在电子设备内,之后,电子设备不需要每次重新计算第一音频播放设备的播放时延和第二音频播放设备的播放时延。
在一些实施例中,在电子设备开始向第一音频播放设备发送停止指令或向第二音频播放设备发送开始指令之前,电子设备还需计算出第一音频播放设备和第二音频播放设备的播放时延。具体的,电子设备向第一音频播放设备发送第一测试数据,向第二音频播放设备发送第二测试数据。电子设备接收第一音频播放设备发送的包含第七时刻和第八时刻的第一信息;其中,第七时刻为第一测试数据离开电子设备的时刻,第八时刻为第一音频播放设备播放第一测试数据的时刻。电子设备接收第二音频播放设备发送的包含第九时刻和第十时刻的第二信息;其中,第九时刻为第二测试数据离开电子设备的时刻,第十时刻为第二音频播放设备播放第二测试数据的时刻。电子设备确定第一播放时延,第一播放时延为第八时刻与第七时刻之间的差值。电子设备确定出第二播放时延,第二播放时延为第十时刻与第九时刻之间的差值。这样,电子设备计算出第一音频播放设备和第二音频播放设备的播放时延,为后续第一音频播放设备和第二音频播放设备切换时无缝衔接播放音频数据提供了可能。
在一种可能的实现方式中,电子设备若之前计算过第一音频播放设备的播放时延和第二音频播放设备的播放时延,电子设备可以将第一音频播放设备的播放时延和第二音频播放设备的播放时延保存在电子设备内,之后,电子设备不需要每次重新计算第一音频播放设备的播放时延和第二音频播放设备的播放时延。
在一些实施例中,当音频播放设备200的播放时延大于音频播放设备300的播放时延时,电子设备100还执行如下步骤:
当音频播放设备200的第一播放时延大于音频播放设备300的第二播放时延时,在第五时刻,向音频播放设备200发送第一指令和第一音频帧。电子设备100在第六时刻,向音频播放设备300发送第二指令和第一音频帧。第一音频播放设备,在接收到电子设备发送的第 一指令和第一音频帧之后,在第四时刻音量递减播放第一音频帧,并在播放完第一音频帧后停止播放音频数据;第二音频播放设备,在接收到电子设备发送的第二指令和第一音频帧之后,在第四时刻音量递增播放第一音频帧。
音量递减可以是音量线性减小,或者音量梯度减小,音量减小到预设值之后不在减小,或者音量减小到一定时间后不在减小。
音量递增可以是音量线性增大,或者音量梯度增大,音量增大到预设值之后不在增大,或者音量增大到一定时间后不在增大。本申请对于音量递减和音量递增的方式不做限定。
当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备将第一指令和第一音频帧发送至第一音频播放设备,并且电子设备将第二指令和第一音频帧发送至第二音频播放设备。之后,在理想情况下,第一音频播放设备播完第一音频帧后停止播放音频数据,第二音频播放设备恰好刚开始播放第一音频帧。即第一音频播放设备与第二音频播放设备重复播放的音频数据为第一音频帧。为了使得电子设备切换播放设备时无中断的过程,通过第一音频播放设备音量递减播放第一音频帧,第二音频播放设备音量递增播放第一音频帧,已解决重复播放的问题达到无中断播放音频数据。
在一种可能的实现方式中,第一指令包括音量递减指令和停止播放指令;第二指令包括音量递增指令和开始播放指令。音量递减指令用于指示第一音频播放设备在接收到第一音频帧后,音量递减播放第一音频帧;停止播放指令用于指示第一音频播放设备在接收到第二音频帧之后,播放完所述第二音频帧后停止播放音频数据。音量递增指令用于指示第二音频播放设备在接收到第一音频帧之后,音量递增播放第一音频帧。
在一种可能的实现方式中,电子设备也可以分别将音量递增指令和停止播放指令发送至第一音频播放设备。
其中,第四时刻可以是图10或图12所示的880ms时刻。第一音频帧可以是图10或图12所示的880ms时刻,时间戳为2'30”00的音频数据。
第五时刻可以是图10或图12所示的640ms时刻。第六时刻可以是图10或图12所示的720ms时刻。
第一指令包括音量递减指令和停止播放指令。第二指令包括音量递增指令和开始播放指令。
当第一音频播放设备的第一播放时延大于第二音频播放设备的第二播放时延时,电子设备将第一指令和第一音频帧发送至第一音频播放设备,并且电子设备将第二指令和第一音频帧发送至第二音频播放设备。第一音频播放设备在第四时刻接收到第一指令和第一音频帧,第二音频播放设备在第五时刻接收到第二指令和第二音频帧,第四时刻先于第五时刻,第五时刻与第四时刻的差值为第一播放时延与第二播放时延的差值。之后,在理想情况下,第一音频播放设备播完第一音频帧后停止播放音频数据,第二音频播放设备恰好刚开始播放第一音频帧。即第一音频播放设备与第二音频播放设备重复播放的音频数据为第一音频帧。为了使得电子设备切换播放设备时无中断的过程,通过第一音频播放设备音量递减播放第一音频帧,第二音频播放设备音量递增播放第一音频帧,已解决重复播放的问题达到无中断播放音频数据。
图14示出了电子设备100的结构示意图。
下面以电子设备100为例对实施例进行具体说明。应该理解的是,图14所示电子设备100仅是一个范例,并且电子设备100可以具有比图14中所示的更多的或者更少的部件,可 以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了***的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等***器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与***设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解 决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯***(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位***(global positioning system,GPS),全球导航卫星***(global navigation satellite system,GLONASS),北斗卫星导航***(beidou navigation satellite system,BDS),准天顶卫星***(quasi-zenith satellite system,QZSS)和/或星基增强***(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作***,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋 模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过***SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时***多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。
电子设备100的软件***可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android***为例,示例性说明电子设备100的软件结构。
图15是本发明实施例的电子设备100的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android***分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和***库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图15所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图15所示,应用程序框架层可以包括窗口管理器,内容提供器,视图***,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图***包括可视控件,例如显示文字的控件,显示图片的控件等。视图***可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在***顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓***的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
***库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子***进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。
如图16所示,图16示例性示出了音频播放设备的硬件结构示意图。
图16示例性的示出了本申请实施例提供的音频播放设备(例如音频播放设备200和音频播放设备300)的结构示意图。
应该理解的是,图16所示的音频播放设备仅是一个范例,并且音频播放设备可以具有比图16中所示的更多或更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
如图16所示,音频播放设备可以包括:处理器201,存储器202,无线通信处理模块203,电源开关205,USB通信处理模块206,音频模块207。其中:
处理器201可用于读取和执行计算机可读指令。具体实现中,处理器201可主要包括控制器、运算器和寄存器。其中,控制器主要负责指令译码,并为指令对应的操作发出控制信号。运算器主要负责保存指令执行过程中临时存放的寄存器操作数和中间操作结果等。具体实现中,处理器201的硬件架构可以是专用集成电路(ASIC)架构、MIPS架构、ARM架构或者NP架构等等。
在一些实施例中,处理器201可以用于解析蓝牙通信处理模块203A接收到的信号,如电子设备100发送的配对模式修改请求,等等。处理器201可以用于根据解析结果进行相应的处理操作,如生成配对模式修改响应,等等。
存储器202与处理器201耦合,用于存储各种软件程序和/或多组指令。具体实现中,存储器202可包括高速随机存取的存储器,并且也可包括非易失性存储器,例如一个或多个磁盘存储设备、闪存设备或其他非易失性固态存储设备。存储器202可以存储操作***,例如uCOS,VxWorks、RTLinux等嵌入式操作***。存储器202还可以存储通信程序,该通信程序可用于与电子设备100,一个或多个服务器,或其他设备进行通信。
无线通信处理模块203可以包括蓝牙(BT)通信处理模块203A、WLAN通信处理模块203B中的一项或多项。
在一些实施例中,蓝牙(BT)通信处理模块、WLAN通信处理模块中的一项或多项可以监听到其他设备(如电子设备100)发射的信号,如探测请求、扫描信号等等,并可以发送响应信号,如探测响应、扫描响应等,使得其他设备(如电子设备100)可以发现音频播放设备,并与其他设备(如电子设备100)建立无线通信连接,通过蓝牙或WLAN中的一种或多种无线通信技术与其他设备(如电子设备100)进行通信。
在另一些实施例中,蓝牙(BT)通信处理模块、WLAN通信处理模块中的一项或多项也可以发射信号,如广播蓝牙信号、信标信号,使得其他设备(如电子设备100)可以发现音频播放设备,并与其他设备(如电子设备100)建立无线通信连接,通过蓝牙或WLAN中的一种或多种无线通信技术与其他设备(如电子设备100)进行通信。
无线通信处理模块203还可以包括蜂窝移动通信处理模块(未示出)。蜂窝移动通信处理模块可以通过蜂窝移动通信技术与其他设备(如服务器)进行通信。
在一些实施例中蓝牙通信处理模块的天线可以有一个或多个。天线可用于发射和接收电磁波信号。音频播放设备中的每个天线可用于覆盖单个或多个通信频带。
电源开关205可用于控制电源向音频播放设备的供电。
USB通信处理模块206可用于通过USB接口(未示出)与其他设备进行通信。在一些实施例中,音频播放设备也可以不包括USB通信处理模块206。
音频模块207可用于通过音频输出接口输出音频信号,这样可使得音频播放设备支持音频播放。音频模块还可用于通过音频输入接口接收音频数据。音频播放设备可以为蓝牙耳机等媒体播放设备。
在一些实施例中,音频播放设备还可以包括显示屏(未示出),其中,该显示屏可用于显示图像,提示信息等。显示屏可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED)显示屏,有源矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED)显示屏,柔性发光二极管(flexible light-emitting diode,FLED)显示屏,量子点发光二极管(quantum dot light emitting diodes,QLED)显示屏等等。
在一些实施例中,音频播放设备还可以包括RS-232接口等串行接口。该串行接口可连接至其他设备,如音箱等音频外放设备,使得蓝牙设备和音频外放设备协作播放音视频。
可以理解的是图16示意的结构并不构成对蓝牙设备的具体限定。在本申请另一些实施例中,蓝牙设备可以包括比图示更多或更少的部件,或组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (16)

  1. 一种音频数据播放***,其特征在于,所述***包括电子设备、第一音频播放设备、第二音频播放设备;
    所述电子设备,用于将音频数据发送至第一音频播放设备;
    所述第一音频播放设备,用于播放所述音频数据;
    所述电子设备,还用于:
    与所述第二音频播放设备建立通信连接;
    向所述第一音频播放设备发送停止播放指令和第一音频帧;
    向所述第二音频播放设备发送开始播放指令和第二音频帧;
    所述第一音频播放设备,还用于在接收到所述电子设备发送的所述停止指令和所述第一音频帧之后,在第一时刻播放完所述第一音频帧后停止播放音频数据;
    所述第二音频播放设备,用于在接收到所述电子设备发送的所述开始播放指令和所述二音频帧之后,在所述第一时刻开始播放所述第二音频帧;
    其中,所述第二音频帧是在所述第一音频帧之后的相邻帧。
  2. 根据权利要求1所述的***,其特征在于,所述电子设备,具体用于:
    在第二时刻,向所述第一音频播放设备发送所述停止播放指令和所述第一音频帧;
    在第三时刻,向所述第二音频播放设备发送所述开始播放指令和所述第二音频帧;
    其中,所述第一时刻与所示第二时刻的差值为所述第一音频播放设备的第一播放时延,所述第一时刻与所述第三时刻的差值为所述第二音频播放设备的第二播放时延;
    所述第二时刻与所述第三时刻的差值为第一值,所述第一播放时延和所述第二播放时延的时延差为所述第一值。
  3. 一种音频数据播放***,其特征在于,所述***包括电子设备、第一音频播放设备、第二音频播放设备;
    所述电子设备,用于将音频数据发送至第一音频播放设备;
    所述第一音频播放设备,用于播放所述音频数据;
    所述电子设备,还用于:
    与所述第二音频播放设备建立通信连接;
    当所述第一音频播放设备的第一播放时延小于所述第二音频播放设备的第二播放时延时,向所述第一音频播放设备发送第一指令和第一音频帧;
    向所述第二音频播放设备发送第二指令和所述第一音频帧;
    所述第一音频播放设备,还用于在接收到所述电子设备发送的所述第一指令和所述第一音频帧之后,在第一时刻音量递减播放所述第一音频帧,在第二时刻停止播放音频数据;
    所述第二音频播放设备,用于在接收到所述电子设备发送的所述第二指令和所述第一音频帧之后,在所述第二时刻音量递增播放所述第一音频帧。
  4. 根据权利要求3所述的***,其特征在于,当所述第一音频播放设备的第一播放时延大于所述第二音频播放设备的第二播放时延时,所述电子设备还用于:
    向所述第一音频播放设备发送第一指令和第一音频帧;
    向所述第二音频播放设备发送第二指令和所述第一音频帧;
    所述第一音频播放设备,还用于在接收到所述电子设备发送的所述第一指令和所述第一音频帧之后,在第四时刻音量递减播放所述第一音频帧,并在播放完所述第一音频帧后停止播放音频数据;
    所述第二音频播放设备,还用于在接收到所述电子设备发送的所述第二指令和所述第一音频帧之后,在所述第四时刻音量递增播放所述第一音频帧。
  5. 一种音频数据播放方法,其特征在于,所述方法包括:
    所述电子设备将音频数据发送至第一音频播放设备,并通过所述第一音频播放设备播放所述音频数据;
    所述电子设备与第二音频播放设备建立通信连接;
    所述电子设备向所述第一音频播放设备发送停止播放指令和第一音频帧;其中,所述停止播放指令用于指示所述第一音频播放设备在接收到所述电子设备发送的所述停止指令和所述第一音频帧之后,在第一时刻播放完所述第一音频帧后停止播放音频数据;
    所述电子设备向所述第二音频播放设备发送开始播放指令和第二音频帧;其中,所述开始播放指令用于指示所述第二音频播放设备接收到所述电子设备发送的所述开始播放指令和所述二音频帧之后,在所述第一时刻开始播放所述第二音频帧;
    其中,所述第二音频帧是在所述第一音频帧之后的相邻帧。
  6. 根据权利要求5所述的方法,其特征在于,所述电子设备向所述第一音频播放设备发送停止播放指令和第一音频帧,具体包括:
    所述电子设备在第二时刻,向所述第一音频播放设备发送所述停止播放指令和所述第一音频帧;
    所述电子设备向所述第二音频播放设备发送开始播放指令和第二音频帧,具体包括:
    所述电子设备在第三时刻,向所述第二音频播放设备发送所述开始播放指令和所述第二音频帧;
    其中,所述第一时刻与所示第二时刻的差值为所述第一音频播放设备的第一播放时延,所述第一时刻与所述第三时刻的差值为所述第二音频播放设备的第二播放时延;
    所述第二时刻与所述第三时刻的差值为第一值,所述第一播放时延和所述第二播放时延的时延差为所述第一值。
  7. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    所述电子设备在所述第一音频播放设备播放完所述第一音频帧后停止播放音频数据时,断开与所述第一音频播放设备的连接。
  8. 根据权利要求5所述的方法,其特征在于,当所述第一播放时延大于所述第二播放时延时,所述第一时刻先于所述第二时刻;
    当所述第一播放时延小于所述第二播放时延时,所述第二时刻先于所述第一时刻。
  9. 根据权利要求5-8任一项所述的方法,其特征在于,在所述电子设备与所述第二音频播放设备建立通信连接之后,所述方法还包括:
    所述电子设备向所述第一音频播放设备发送第一测试数据,向所述第二音频播放设备发 送第二测试数据;
    所述电子设备接收所述第一音频播放设备发送的包含第四时刻和第五时刻的第一信息;其中,所述第四时刻为所述第一测试数据离开所述电子设备的时刻,所述第五时刻为所述第一音频播放设备播放所述第一测试数据的时刻;
    所述电子设备接收所述第二音频播放设备发送的包含第六时刻和第七时刻的第二信息;其中,所述第六时刻为所述第二测试数据离开所述电子设备的时刻,所述第七时刻为所述第二音频播放设备播放所述第二测试数据的时刻;
    所述电子设备确定出所述第一播放时延,所述第一播放时延为所述第五时刻与所述第四时刻的差值;
    所述电子设备确定出所述第二播放时延,所述第二播放时延为所述第七时刻与所述第六时刻的差值。
  10. 一种音频数据播放方法,其特征在于,所述方法包括:
    电子设备将音频数据发送至第一音频播放设备,并通过所述第一音频播放设备播放所述音频数据;
    所述电子设备与第二音频播放设备建立通信连接;
    当所述第一音频播放设备的第一播放时延小于所述第二音频播放设备的第二播放时延时,所述电子设备向所述第一音频播放设备发送第一指令和第一音频帧,向所述第二音频播放设备发送第二指令和所述第一音频帧;
    其中,所述第一指令用于指示所述第一音频播放设备在接收到所述电子设备发送的所述第一指令和所述第一音频帧之后,在第一时刻音量递减播放所述第一音频帧,在第二时刻停止播放音频数据;
    所述第二指令用于指示所述第二音频播放设备在接收到所述电子设备发送的所述第二指令和所述第一音频帧之后,在所述第二时刻音量递增播放所述第一音频帧。
  11. 根据权利要求10所述的方法,其特征在于,所述方法包括:
    所述电子设备向所述第一音频播放设备发送第二音频帧;
    所述第一指令用于指示所述第一音频播放设备在接收到所述电子设备发送的所述第一指令和所述第一音频帧之后,在第一时刻音量递减播放所述第一音频帧,在第二时刻停止播放音频数据,具体包括:
    所述第一指令用于指示所述第一音频播放设备在接收到所述电子设备发送的所述第一指令和所述第一音频帧之后,在第一时刻音量递减播放所述第一音频帧之后,在所述第二时刻播放完所述第二音频帧后停止播放音频数据。
  12. 根据权利要求10所述的方法,其特征在于,所述电子设备向所述第一音频播放设备发送第一指令和第一音频帧,具体包括:
    所述电子设备在第三时刻,向所述第一音频播放设备发送所述第一指令和所述第一音频帧;
    所述电子设备向所述第二音频播放设备发送第二指令和所述第一音频帧,具体包括:
    所述电子设备在所述第三时刻,向所述第二音频播放设备发送所述第二指令和所述第一音频帧;
    其中,所述第一时刻与所述第三时刻的差值为所述第一音频播放设备的第一播放时延,所述第二时刻与所述第三时刻的差值为所述第二音频播放设备的第二播放时延;
    所述第二时刻与所述第一时刻的差值为第一值,所述第一播放时延和所述第二播放时延的时延差为所述第一值。
  13. 根据权利要求10所述的方法,其特征在于,所述方法还包括:
    当所述第一音频播放设备的第一播放时延大于所述第二音频播放设备的第二播放时延时,所述电子设备向所述第一音频播放设备发送第一指令和第一音频帧,向所述第二音频播放设备发送第二指令和所述第一音频帧;
    其中,所述第一指令用于指示所述第一音频播放设备在接收到所述电子设备发送的所述第一指令和所述第一音频帧之后,在第四时刻音量递减播放所述第一音频帧,并在播放完所述第一音频帧后停止播放音频数据;
    所述第二指令用于指示所述第二音频播放设备在接收到所述电子设备发送的所述第二指令和所述第一音频帧之后,在所述第四时刻音量递增播放所述第一音频帧。
  14. 根据权利要求13所述的方法,其特征在于,所述电子设备向所述第一音频播放设备发送第一指令和第一音频帧,具体包括:
    所述电子设备在第五时刻,向所述第一音频播放设备发送所述第一指令和所述第一音频帧;
    所述电子设备向所述第二音频播放设备发送第二指令和所述第一音频帧,具体包括:
    所述电子设备在第六时刻,向所述第二音频播放设备发送所述第二指令和所述第一音频帧;
    其中,所述第四时刻与所述第五时刻的差值为所述第一音频播放设备的第一播放时延,所述第四时刻与所述第六时刻的差值为所述第二音频播放设备的第二播放时延;
    所述第六时刻与所述第五时刻的差值为第一值,所述第一播放时延和所述第二播放时延为所述第一值。
  15. 根据权利要求10-14任一项所述的方法,其特征在于,在所述电子设备与所述第二音频播放设备建立通信连接之后,所述方法还包括:
    所述电子设备向所述第一音频播放设备发送第一测试数据,向所述第二音频播放设备发送第二测试数据;
    所述电子设备接收所述第一音频播放设备发送的包含第七时刻和第八时刻的第一信息;其中,所述第七时刻为所述第一测试数据离开所述电子设备的时刻,所述第八时刻为所述第一音频播放设备播放所述第一测试数据的时刻;
    所述电子设备接收所述第二音频播放设备发送的包含第九时刻和第十时刻的第二信息;其中,所述第九时刻为所述第二测试数据离开所述电子设备的时刻,所述第十时刻为所述第二音频播放设备播放所述第二测试数据的时刻;
    所述电子设备确定出所述第一播放时延,所述第一播放时延为所述第八时刻与所述第七时刻之间的差值;
    所述电子设备确定出所述第二播放时延,所述第二播放时延为所述第十时刻与所述第九时刻之间的差值。
  16. 一种电子设备,其特征在于,包括一个或多个处理器、一个或多个存储器;所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行如权利要求5至15任一项所述的方法。
PCT/CN2022/087331 2021-04-23 2022-04-18 一种音频数据无缝切换方法 WO2022222878A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110444578.6A CN115243236A (zh) 2021-04-23 2021-04-23 一种音频数据无缝切换方法
CN202110444578.6 2021-04-23

Publications (1)

Publication Number Publication Date
WO2022222878A1 true WO2022222878A1 (zh) 2022-10-27

Family

ID=83666508

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/087331 WO2022222878A1 (zh) 2021-04-23 2022-04-18 一种音频数据无缝切换方法

Country Status (2)

Country Link
CN (1) CN115243236A (zh)
WO (1) WO2022222878A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070024181A (ko) * 2005-08-26 2007-03-02 삼성전자주식회사 휴대단말기와 헤드셋간에 정보 송수신 방법
CN103984518A (zh) * 2014-04-18 2014-08-13 青岛尚慧信息技术有限公司 一种智能移动终端
CN106415721A (zh) * 2014-01-22 2017-02-15 苹果公司 音频数据传输的协调切换
CN106445453A (zh) * 2016-09-23 2017-02-22 北京小米移动软件有限公司 切换音频输出路径的方法及装置
CN109379491A (zh) * 2018-09-30 2019-02-22 Oppo广东移动通信有限公司 音频播放方法、装置、电子设备及计算机可读介质
CN109445739A (zh) * 2018-09-30 2019-03-08 Oppo广东移动通信有限公司 音频播放方法、装置、电子设备及计算机可读介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070024181A (ko) * 2005-08-26 2007-03-02 삼성전자주식회사 휴대단말기와 헤드셋간에 정보 송수신 방법
CN106415721A (zh) * 2014-01-22 2017-02-15 苹果公司 音频数据传输的协调切换
CN103984518A (zh) * 2014-04-18 2014-08-13 青岛尚慧信息技术有限公司 一种智能移动终端
CN106445453A (zh) * 2016-09-23 2017-02-22 北京小米移动软件有限公司 切换音频输出路径的方法及装置
CN109379491A (zh) * 2018-09-30 2019-02-22 Oppo广东移动通信有限公司 音频播放方法、装置、电子设备及计算机可读介质
CN109445739A (zh) * 2018-09-30 2019-03-08 Oppo广东移动通信有限公司 音频播放方法、装置、电子设备及计算机可读介质

Also Published As

Publication number Publication date
CN115243236A (zh) 2022-10-25

Similar Documents

Publication Publication Date Title
WO2020259452A1 (zh) 一种移动终端的全屏显示方法及设备
WO2021027666A1 (zh) 一种蓝牙回连的方法及相关装置
WO2021000807A1 (zh) 一种应用程序中等待场景的处理方法和装置
WO2020062159A1 (zh) 无线充电方法及电子设备
CN113923230B (zh) 数据同步方法、电子设备和计算机可读存储介质
CN113691842B (zh) 一种跨设备的内容投射方法及电子设备
WO2021185244A1 (zh) 一种设备交互的方法和电子设备
CN112119641B (zh) 通过转发模式连接的多tws耳机实现自动翻译的方法及装置
WO2022033320A1 (zh) 蓝牙通信方法、终端设备及计算机可读存储介质
WO2022095788A1 (zh) 目标用户追焦拍摄方法、电子设备及存储介质
WO2021036898A1 (zh) 折叠屏设备中应用打开方法及相关装置
WO2022042326A1 (zh) 显示控制的方法及相关装置
WO2022012444A1 (zh) 多设备协作的方法、电子设备及多设备协作***
WO2022017393A1 (zh) 显示交互***、显示方法及设备
WO2021031865A1 (zh) 通话方法及装置
WO2022042637A1 (zh) 一种蓝牙数据传输方法及相关装置
WO2022170856A1 (zh) 建立连接的方法与电子设备
WO2021143391A1 (zh) 基于视频通话的共享屏幕方法及移动设备
CN114827581A (zh) 同步时延测量方法、内容同步方法、终端设备及存储介质
WO2021052388A1 (zh) 一种视频通信方法及视频通信装置
WO2021052408A1 (zh) 一种电子设备显示方法及电子设备
WO2021037034A1 (zh) 一种应用状态切换方法及终端设备
WO2023207667A1 (zh) 一种显示方法、汽车和电子设备
WO2022089563A1 (zh) 一种声音增强方法、耳机控制方法、装置及耳机
WO2022199491A1 (zh) 一种立体声组网方法、***及相关装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22790986

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22790986

Country of ref document: EP

Kind code of ref document: A1