Display device, Bluetooth device and device control method
By employing a dual-buffer mechanism between the display device and the Bluetooth device, and dynamically switching the write rate, the problem of buffer overflow or underload caused by clock asynchrony is solved. This ensures the timing continuity and time synchronization of audio data, preventing data loss.
Patent Information
- Application Number
- CN202511115205.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-28
AI Technical Summary
When a display device is connected to an external Bluetooth device via a USB bus, the local clock may be out of sync, which can cause buffer overflow or underload issues during the transmission of audio streams via the USB bus.
The display device and Bluetooth device are connected via USB bus and employ a dual-buffer mechanism. The write rate is dynamically switched according to the fill rate of the target buffer, increasing or decreasing the fill rate of the buffer to prevent buffer overflow or underload.
It effectively solves the problem of buffer overflow or underload during audio stream transmission via USB bus, ensuring the timing continuity and time synchronization of audio data and avoiding data loss.
Smart Images

Figure CN121037597A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to device control technology. More specifically, it relates to a display device, a Bluetooth device, and a device control method. Background Technology
[0002] Currently, in scenarios where a display device connects to an external Bluetooth device via a USB bus, and the Bluetooth device then connects to devices such as Bluetooth headsets and Bluetooth speakers to send audio data streams from the display device to the Bluetooth headsets and speakers, buffer overflow or underload issues can easily occur during audio stream transmission via the USB bus due to the local clock of the display device being out of sync with the local clock of the Bluetooth device. Summary of the Invention
[0003] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a display device, a Bluetooth device, and a device control method, which can effectively solve the problem of buffer overflow or underload that easily occurs during the transmission of audio streams via USB bus.
[0004] In a first aspect, embodiments of this disclosure provide a display device for connecting to a Bluetooth device via a USB bus and transmitting an audio data stream to the Bluetooth device via the USB bus. The display device includes: a controller configured to: receive a first control instruction when writing an audio data stream through a first buffer at a first write rate, the first control instruction being sent by the Bluetooth device when it detects that the fill rate of a target buffer is less than or equal to a first threshold; in response to the first control instruction, control the writing of an audio data stream through a second buffer at a second write rate, and stop writing an audio data stream through the first buffer; the second write rate being greater than the first write rate; receive a second control instruction, the second control instruction being sent by the Bluetooth device when it detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold being greater than the first threshold; and in response to the second control instruction, control the writing of an audio data stream through the first buffer and stop writing an audio data stream through the second buffer.
[0005] In this embodiment of the present disclosure, when the fill rate of the target buffer of the Bluetooth device is less than or equal to a first threshold, the display device switches the first buffer with a lower write rate to the second buffer with a higher write rate, thereby increasing the fill rate of the buffer to prevent buffer underloading. When the fill rate of the target buffer of the Bluetooth device is greater than or equal to a second threshold, the display device switches the second buffer with a higher write rate to the first buffer with a lower write rate, thereby decreasing the fill rate of the buffer to prevent buffer overloading. In this way, the problem of buffer overflow or underloading that easily occurs during the transmission of audio streams via USB bus can be effectively solved.
[0006] In some embodiments of this disclosure, the controller is further configured to: transmit the audio data stream of the first buffer to the Bluetooth device via the USB bus before stopping the writing of the audio data stream through the first buffer; and after stopping the writing of the audio data stream through the first buffer and after the audio data stream of the first buffer has been transmitted, transmit the audio data stream of the second buffer to the Bluetooth device via the USB bus.
[0007] In this embodiment of the disclosure, the above implementation scheme can ensure virtual clock alignment within the protocol stack, ensure the timing continuity of audio data during buffer switching, and avoid data loss.
[0008] In some embodiments of this disclosure, the controller is specifically configured to: respond to a second control command, control the second buffer to write audio data stream at a third write rate, and control the writing of audio data stream through the first buffer, wherein the third write rate is less than the second write rate; transmit the audio data stream of the second buffer to the Bluetooth device through the USB bus; stop writing audio data stream through the second buffer when the fill rate of the first buffer is greater than or equal to a third threshold; and after the audio data stream of the second buffer has been transmitted, transmit the audio data stream of the first buffer to the Bluetooth device through the USB bus.
[0009] In this embodiment of the disclosure, by stopping the writing of audio data stream through the second buffer when the fill rate of the first buffer is greater than or equal to the third threshold, the problem of buffer underload that may be caused by direct switching can be avoided. After the audio data stream in the second buffer is transmitted, the audio data stream in the first buffer is transmitted to the Bluetooth device through the USB bus to ensure virtual clock alignment in the protocol stack, and to ensure the timing continuity of audio data when switching buffers, thus avoiding data loss.
[0010] In some embodiments of this disclosure, the first control instruction carries a target field; the controller is further configured to: obtain a first clock offset based on the target field, the first clock offset indicating the difference between the local clock of the Bluetooth device and the local clock of the display device; and send the first clock offset to cause the Bluetooth device to adjust its local clock to synchronize with the local clock of the display device based on the first clock offset.
[0011] In this embodiment of the disclosure, during audio playback, the display device is triggered to perform non-periodic clock synchronization based on the target field sent by the Bluetooth device. In this way, the time between the display device and the Bluetooth device can be synchronized, effectively avoiding buffer overflow or underload.
[0012] In some embodiments of this disclosure, the controller is further configured to: before receiving an audio playback command, acquire a second clock offset, the second clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; and send the second clock offset to cause the Bluetooth device to adjust its local clock to synchronize with the local clock of the display device based on the second clock offset.
[0013] In some embodiments of this disclosure, the controller is further configured to: before receiving an audio playback command, acquire a third clock offset, the third clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; update a fourth threshold to the first threshold, the fourth threshold being less than the first threshold, and the fourth threshold being a preset fill rate threshold for triggering the generation of a first control command, when the third clock offset is greater than 0, the third clock offset is greater than or equal to a first clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to increase within a preset time period; send the first threshold to cause the Bluetooth device to send a first control command when it detects that the fill rate of the target buffer is less than or equal to the first threshold; update a fifth threshold to the second threshold, the fifth threshold being greater than the second threshold, and the fifth threshold being a preset fill rate threshold for triggering the generation of a second control command, when the third clock offset is less than 0, the third clock offset is less than or equal to a second clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to decrease within a preset time period; send the second threshold to cause the Bluetooth device to send a second control command when it detects that the fill rate of the target buffer is less than or equal to the second threshold.
[0014] In this embodiment of the present disclosure, before playing audio, the change in the difference between the local clock of the Bluetooth device and the local clock of the display device within a preset time period is used to determine whether to adjust the fill rate threshold of the target buffer that triggers the generation and sending of the first control command or the second control command during the audio playback process. In this way, buffer overflow and underload can be better avoided during the audio playback process.
[0015] In some embodiments of this disclosure, the controller is further configured to: send a synchronization beacon packet via the USB bus, the synchronization beacon packet carrying the local clock counter value of the display device; obtain the timestamp T1 of sending the synchronization beacon packet; receive a response packet corresponding to the synchronization beacon packet via the USB bus, the response packet carrying the timestamp T2 of the Bluetooth device receiving the synchronization beacon packet, the timestamp T3 of the Bluetooth device sending the response packet, and the local clock counter value of the Bluetooth device; obtain the timestamp T4 of receiving the response packet; and calculate a clock offset value based on T1, T2, T3, and T4, as well as the local clock counter values of the display device and the Bluetooth device.
[0016] In this embodiment of the disclosure, the clock offset between the display device and the Bluetooth device can be accurately obtained through the above-described process of obtaining the clock offset, and then clock synchronization between the devices can be achieved based on the clock offset.
[0017] Secondly, embodiments of this disclosure provide a Bluetooth device, including: the Bluetooth device for connecting to a display device via a USB bus and receiving an audio data stream transmitted from the display device via the USB bus, including: a controller configured to: when detecting that the fill rate of a target buffer is less than or equal to a first threshold, send a first control instruction, the first control instruction being used by the display device to control the writing of an audio data stream through a second buffer at a second write rate and stop writing an audio data stream through the first buffer when the display device is writing an audio data stream through the first buffer at a first write rate; the second write rate being greater than the first write rate; and when detecting that the fill rate of the target buffer is greater than or equal to a second threshold, send a second control instruction, the second control instruction being used by the display device to control the writing of an audio data stream through the first buffer and stop writing an audio data stream through the second buffer; the second threshold being greater than the first threshold.
[0018] Thirdly, embodiments of this disclosure provide a device control method, comprising: a display device connected to a Bluetooth device via a USB bus and transmitting an audio data stream to the Bluetooth device via the USB bus, comprising: when writing the audio data stream through a first buffer at a first write rate, receiving a first control instruction, the first control instruction being sent by the Bluetooth device when it detects that the fill rate of a target buffer is less than or equal to a first threshold; in response to the first control instruction, controlling the writing of the audio data stream through a second buffer at a second write rate, and stopping the writing of the audio data stream through the first buffer; the second write rate being greater than the first write rate; receiving a second control instruction, the second control instruction being sent by the Bluetooth device when it detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold being greater than the first threshold; in response to the second control instruction, controlling the writing of the audio data stream through the first buffer, and stopping the writing of the audio data stream through the second buffer.
[0019] In some embodiments of this disclosure, before stopping the writing of audio data stream through the first buffer, the method may further include: transmitting the audio data stream of the first buffer to the Bluetooth device via the USB bus; and after stopping the writing of audio data stream through the first buffer and after the audio data stream of the first buffer has been transmitted, transmitting the audio data stream of the second buffer to the Bluetooth device via the USB bus.
[0020] In some embodiments of this disclosure, the method further includes: responding to a second control command, controlling a second buffer to write an audio data stream at a third write rate, and controlling the writing of an audio data stream through a first buffer, wherein the third write rate is less than the second write rate; transmitting the audio data stream of the second buffer to the Bluetooth device via the USB bus; stopping the writing of the audio data stream through the second buffer when the fill rate of the first buffer is greater than or equal to a third threshold; and transmitting the audio data stream of the first buffer to the Bluetooth device via the USB bus after the audio data stream of the second buffer has been transmitted.
[0021] In some embodiments of this disclosure, the first control command carries a target field; the method further includes: obtaining a first clock offset based on the target field, the first clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; and sending the first clock offset to cause the Bluetooth device to adjust its local clock to synchronize with the local clock of the display device based on the first clock offset.
[0022] In some embodiments of this disclosure, the method further includes: before receiving an audio playback command, obtaining a second clock offset, the second clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; and sending the second clock offset to cause the Bluetooth device to adjust its local clock to synchronize with the local clock of the display device based on the second clock offset.
[0023] In some embodiments of this disclosure, the method further includes: before receiving an audio playback command, obtaining a third clock offset, the third clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; when the third clock offset is greater than 0, the third clock offset is greater than or equal to a first clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to increase within a preset time period, updating a fourth threshold to the first threshold, the fourth threshold being less than the first threshold, the fourth threshold being a preset fill rate threshold for the target buffer used to trigger the generation of a first control command; sending the first threshold to cause the Bluetooth device to send a first control command when it detects that the fill rate of the target buffer is less than or equal to the first threshold; when the third clock offset is less than 0, the third clock offset is less than or equal to a second clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to decrease within a preset time period, updating a fifth threshold to the second threshold, the fifth threshold being greater than the second threshold, the fifth threshold being a preset fill rate threshold for the target buffer used to trigger the generation of a second control command; sending the second threshold to cause the Bluetooth device to send a second control command when it detects that the fill rate of the target buffer is less than or equal to the second threshold.
[0024] In some embodiments of this disclosure, the method further includes: a display device sending a synchronization beacon packet via the USB bus, the synchronization beacon packet carrying the local clock counter value of the display device; obtaining a timestamp T1 for sending the synchronization beacon packet; receiving a response packet corresponding to the synchronization beacon packet via the USB bus, the response packet carrying a timestamp T2 for the Bluetooth device receiving the synchronization beacon packet, a timestamp T3 for the Bluetooth device sending the response packet, and the local clock counter value of the Bluetooth device; obtaining a timestamp T4 for receiving the response packet; and calculating a clock offset value based on T1, T2, T3, and T4, as well as the local clock counter values of the display device and the Bluetooth device.
[0025] Fourthly, embodiments of this disclosure provide a device control method, including: a Bluetooth device connected to a display device via a USB bus and receiving an audio data stream transmitted from the display device via the USB bus, comprising: when detecting that the fill rate of a target buffer is less than or equal to a first threshold, sending a first control instruction, the first control instruction being used by the display device to control the writing of an audio data stream through a second buffer at a second write rate and to stop writing an audio data stream through the first buffer when the display device is writing an audio data stream through the first buffer at a first write rate; the second write rate being greater than the first write rate; when detecting that the fill rate of the target buffer is greater than or equal to a second threshold, sending a second control instruction, the second control instruction being used by the display device to control the writing of an audio data stream through the first buffer and to stop writing an audio data stream through the second buffer; the second threshold being greater than the first threshold.
[0026] Fifthly, embodiments of this disclosure provide a computer-readable storage medium, including: storing a computer program on the computer-readable storage medium, wherein when the computer program is executed by a processor, it implements the device control method as shown in the third or fourth aspect.
[0027] In a sixth aspect, embodiments of this disclosure provide a computer program product, including: when the computer program product is run on a computer, causing the computer to implement the device control method as shown in the third or fourth aspect.
[0028] Compared with the prior art, the technical solution provided in this disclosure has the following advantages: In this disclosure, the display device and the Bluetooth device are connected via a USB bus, and the display device transmits an audio data stream to the Bluetooth device via the USB bus; when writing the audio data stream through the first buffer at a first write rate, a first control instruction is received, which is sent by the Bluetooth device when it detects that the fill rate of the target buffer is less than or equal to a first threshold; in response to the first control instruction, the audio data stream is controlled to be written through the second buffer at a second write rate, and the writing of the audio data stream through the first buffer is stopped; the second write rate is greater than the first write rate; a second control instruction is received, which is sent by the Bluetooth device when it detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold is greater than the first threshold; in response to the second control instruction, the audio data stream is controlled to be written through the first buffer, and the writing of the audio data stream through the second buffer is stopped. Thus, when the fill rate of the target buffer of the Bluetooth device is less than or equal to the first threshold, the display device switches the first buffer with a lower write rate to the second buffer with a higher write rate, thereby increasing the fill rate of the buffer to prevent buffer underloading. When the fill rate of the target buffer of the Bluetooth device is greater than or equal to the second threshold, the display device switches the second buffer with a higher write rate to the first buffer with a lower write rate, thereby decreasing the fill rate of the buffer to prevent buffer overloading. In this way, the problem of buffer overflow or underloading that easily occurs during the transmission of audio streams via the USB bus can be effectively solved. Attached Figure Description
[0029] To more clearly illustrate the implementation methods in the embodiments of this disclosure or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings.
[0030] Figure 1 An operational scenario between a display device and a control device according to some embodiments is illustrated;
[0031] Figure 2 A hardware configuration block diagram of a control device 100 according to some embodiments is shown;
[0032] Figure 3 A hardware configuration block diagram of a display device 200 according to some embodiments is shown;
[0033] Figure 4 The diagram illustrates application scenarios according to some embodiments;
[0034] Figure 5This diagram shows one of the structural block diagrams of an audio module of a display device according to some embodiments;
[0035] Figure 6 A second structural block diagram of an audio module of a display device according to some embodiments is shown;
[0036] Figure 7 A third structural block diagram of an audio module of a display device according to some embodiments is shown;
[0037] Figure 8 A schematic diagram illustrating the connection between a display device and a Bluetooth device according to some embodiments is shown;
[0038] Figure 9 A schematic diagram of a USB bus transmission channel between a display device and a Bluetooth device according to some embodiments is shown;
[0039] Figure 10 A software configuration diagram of a display device 200 according to some embodiments is shown;
[0040] Figure 11 A schematic flowchart of a device control method according to some embodiments is shown. Detailed Implementation
[0041] To make the objectives and implementation methods of this disclosure clearer, the exemplary embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this disclosure. Obviously, the exemplary embodiments described are only some embodiments of this disclosure, and not all embodiments.
[0042] It should be noted that the brief descriptions of terms in this disclosure are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this disclosure. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0043] The terms "first," "second," "third," etc., used in this disclosure, in the specification, claims, and accompanying drawings are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0044] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0045] Figure 1This is a schematic diagram illustrating an operational scenario between a display device and a control device according to an embodiment, wherein the control device includes a smart device or a control apparatus. Figure 1 As shown, the user can operate the display device 200 through the smart device 300 or the control device 100.
[0046] In some embodiments, the control device 100 may be a remote control. Communication between the remote control and the display device includes infrared protocol communication, Bluetooth protocol communication, and other short-range communication methods, controlling the display device 200 wirelessly or via wired means. Users can control the display device 200 by inputting user commands through buttons on the remote control, voice input, control panel input, etc.
[0047] In some embodiments, a smart device 300 (such as a mobile terminal, tablet computer, computer, laptop computer, etc.) can also be used to control the display device 200. For example, an application running on the smart device can be used to control the display device 200.
[0048] In some embodiments, the display device may receive instructions not through the aforementioned smart devices or control devices, but through touch or gestures.
[0049] In some embodiments, the display device 200 can also be controlled in ways other than the control device 100 and the smart device 300. For example, it can be controlled by directly receiving the user's voice commands through a module configured inside the display device 200 for acquiring voice commands, or it can be controlled by receiving the user's voice commands through a voice control device set outside the display device 200.
[0050] In some embodiments, the display device 200 also communicates with the server 400. The display device 200 may communicate via a local area network (LAN), wireless local area network (WLAN), and other networks. The server 400 may provide various content and interactive features to the display device 200. The server 400 may be a cluster or multiple clusters, and may include one or more types of servers.
[0051] Figure 2 An exemplary block diagram of the configuration of the control device 100 according to an exemplary embodiment is shown. Figure 2 As shown, the control device 100 includes a controller 110, a communication interface 130, a user input / output interface 140, an external memory, and a power supply. The control device 100 can receive user input operation commands and convert the operation commands into commands that the display device 200 can recognize and respond to, thus acting as an intermediary for interaction between the user and the display device 200.
[0052] like Figure 3The display device 200 includes at least one of the following: a tuner 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a user interface 280, an external memory, and a power supply.
[0053] In some embodiments, the controller includes a processor, a video processor, an audio processor, a graphics processor, RAM, ROM, and a first interface to an nth interface for input / output.
[0054] The display 260 includes a display screen assembly for presenting images, a driving assembly for driving image display, a component for receiving image signals from the controller output, and a user control UI interface for displaying video content, image content, menu control interface, and user control UI interface.
[0055] The display 260 can be an LCD display, an OLED display, or a projection display, and can also be a projection device and a projection screen.
[0056] The communicator 220 is a component used to communicate with external devices or servers according to various communication protocol types. For example, the communicator may include at least one of the following: a Wi-Fi module, a Bluetooth module, a wired Ethernet module, other network communication protocol chips or near-field communication protocol chips, and an infrared receiver. The display device 200 can establish the transmission and reception of control signals and data signals with the external control device 100 or the server 400 through the communicator 220.
[0057] User interface 280 can be used to receive control signals from control device 100 (such as an infrared remote control). It can also be used to directly receive user input operation commands and convert the operation commands into commands that the display device 200 can recognize and respond to; in this case, it can be called a user input interface.
[0058] Detector 230 is used to collect signals from the external environment or to interact with the external environment. For example, detector 230 includes a light receiver, a sensor for collecting ambient light intensity; or, detector 230 includes an image acquisition device, such as a camera, which can be used to collect external environmental scenes, user attributes, or user interaction gestures; or, detector 230 includes a sound acquisition device, such as a microphone, for receiving external sounds.
[0059] The external device interface 240 may include, but is not limited to, one or more of the following: High Definition Multimedia Interface (HDMI), analog or high-definition component input interface (component), composite video input interface (CVBS), USB input interface (USB), RGB port, etc. It may also be a composite input / output interface formed by multiple interfaces mentioned above.
[0060] The tuner / demodulator 210 receives broadcast television signals via wired or wireless means, and demodulates audio and video signals, such as EPG data signals, from multiple wireless or wired broadcast television signals.
[0061] In some embodiments, the controller 250 and the tuner 210 may be located in different separate devices, that is, the tuner 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.
[0062] The controller 250 controls the operation of the display device and responds to user operations through various software control programs stored in memory (internal or external memory). The controller 250 controls the overall operation of the display device 200. For example, in response to receiving a user command to select a UI object to display on the monitor 260, the controller 250 can perform operations related to the object selected by the user command.
[0063] In some embodiments, the controller includes at least one of a central processing unit (CPU), a video processor, an audio processor, a graphics processing unit (GPU), and random access memory (RAM), read-only memory (ROM), a first to an nth interface for input / output, a communication bus, etc.
[0064] RAM, also known as main memory, is an internal memory that directly exchanges data with the controller. It can be read and written at any time (except during refresh) and is very fast, typically serving as temporary data storage for the operating system or other running programs. Its biggest difference from ROM is data volatility; data stored in RAM is lost when power is off. RAM is used in computers and digital systems to temporarily store programs, data, and intermediate results. ROM operates in a non-destructive read-only manner; information can only be read, not written. Once information is written, it is fixed and will not be lost even if power is cut off; therefore, it is also called fixed-function memory.
[0065] Users can input commands through a graphical user interface (GUI) displayed on the monitor 260, and the user input interface receives the user input commands through the GUI. Alternatively, users can input commands by entering specific sounds or gestures, and the user input interface receives the user input commands by recognizing the sounds or gestures through sensors.
[0066] A "user interface" is the medium through which an application or operating system interacts and exchanges information with the user. It converts information from its internal form to a form that the user can accept. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be an icon, window, control, or other interface element displayed on the screen of a display device. Controls can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.
[0067] Currently, in scenarios where a display device connects to an external Bluetooth device via a USB bus, and the Bluetooth device then connects to devices such as Bluetooth headsets and Bluetooth speakers to send audio data streams from the display device to the Bluetooth headsets and speakers, buffer overflow or underload issues can easily occur during audio stream transmission via the USB bus due to the local clock of the display device being out of sync with the local clock of the Bluetooth device.
[0068] Currently, the solution to the aforementioned buffer overflow or underrun issues is to adjust the packet interval. However, frequently adjusting the packet interval as a passive compensation strategy often exacerbates end-to-end latency. Specifically, in USB transmission, the display device (host) and Bluetooth device (peripheral) exchange data through an endpoint buffer. The core function of the buffer is to "smooth out peaks and valleys"—to offset the differences in processing speed and transmission link fluctuations between the host and peripheral. Overflow: When the rate at which the host writes data to the buffer consistently exceeds the rate at which the peripheral reads data from the buffer, the buffer becomes full, and excess data is forced to be discarded (potentially leading to data errors or packet loss). Example: A high-speed USB 3.0 host sends a large amount of data to a low-speed USB 2.0 peripheral; the peripheral's processing capacity is insufficient, and the buffer quickly becomes full. Underrun: When the peripheral's read rate consistently exceeds the host's write rate, the buffer is exhausted, and the peripheral becomes stuck waiting due to a lack of data to process (potentially leading to stuttering or interruption). Example: A USB audio interface needs to play data in real time. If the host delays writing data due to high CPU usage, the buffer will quickly become idle, causing audio stuttering. The data packet interval is the polling cycle of the USB host for a specific endpoint (e.g., a 1ms / 10ms interval to interrupt transmission), determining how often the host sends a data request to the device. When the buffer overflows / becomes underloaded, the system usually tries to balance supply and demand by adjusting the interval: To handle overflow: If the buffer is continuously full, the host may increase the interval (e.g., from 1ms to 5ms) to reduce the amount of data written per unit time, giving the peripheral more time to process existing data. To handle underload: If the buffer frequently becomes idle, the host may decrease the interval (e.g., from 10ms to 2ms) to increase the data writing frequency and prevent the peripheral from running out of data. End-to-end latency refers to the total time it takes for data to travel from the host to the peripheral for actual processing. Frequent interval adjustments will lengthen this latency in three dimensions: the "response latency" of the adjustment decision, the "adaptation latency" after adjustment, and the "oscillation latency" of repeated adjustments.
[0069] To address the aforementioned issues, in this embodiment of the present disclosure, when the fill rate of the target buffer of the Bluetooth device is less than or equal to a first threshold, the display device switches the first buffer with a lower write rate to the second buffer with a higher write rate, thereby increasing the buffer fill rate to prevent buffer underloading. Conversely, when the fill rate of the target buffer of the Bluetooth device is greater than or equal to a second threshold, the display device switches the second buffer with a higher write rate to the first buffer with a lower write rate, thereby decreasing the buffer fill rate to prevent buffer overloading. This effectively solves the problem of buffer overflow or underloading that easily occurs during audio stream transmission via USB bus.
[0070] This disclosure provides a display device in some embodiments for connecting to a Bluetooth device via a USB bus and transmitting an audio data stream to the Bluetooth device via the USB bus. The display device includes: a controller configured to: receive a first control instruction when writing an audio data stream through a first buffer at a first write rate, the first control instruction being sent by the Bluetooth device when it detects that the fill rate of a target buffer is less than or equal to a first threshold; in response to the first control instruction, control the writing of an audio data stream through a second buffer at a second write rate, and stop writing an audio data stream through the first buffer; the second write rate being greater than the first write rate; receive a second control instruction when the Bluetooth device detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold being greater than the first threshold; and in response to the second control instruction, control the writing of an audio data stream through the first buffer and stop writing an audio data stream through the second buffer.
[0071] This disclosure provides a Bluetooth device, including: a Bluetooth device for connecting to a display device via a USB bus and receiving an audio data stream transmitted from the display device via the USB bus, comprising: a controller configured to: when a target buffer fill rate is detected to be less than or equal to a first threshold, send a first control instruction, the first control instruction being used by the display device to control the writing of an audio data stream through a second buffer at a second write rate, and to stop writing an audio data stream through the first buffer, wherein the second write rate is greater than the first write rate; and when a target buffer fill rate is detected to be greater than or equal to a second threshold, send a second control instruction, the second control instruction being used by the display device to control the writing of an audio data stream through the first buffer and to stop writing an audio data stream through the second buffer, wherein the second threshold is greater than the first threshold.
[0072] The display device provided in this disclosure can take many forms, such as a television, smart television, laser projection device, monitor, electronic bulletin board, electronic table, mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, etc. The functions of the display device are mainly implemented by the host SOC within the display device.
[0073] In this embodiment, the Bluetooth device can be a USB device with a Bluetooth module, a Bluetooth dongle, a Bluetooth transmitter, etc., and is not limited thereto. The Bluetooth device is essentially a Bluetooth adapter (Bluetooth dongle) with a USB interface to enable communication between the display device and the Bluetooth network. The USB bus provides power and data transmission channels for the Bluetooth adapter, making it the "Bluetooth communication interface" of the display device (i.e., the host, such as a computer, television, or smart home device), thereby completing the connection with Bluetooth playback devices (headphones, mobile phones, speakers, etc.).
[0074] In this embodiment, the display device pairs with a Bluetooth playback device and establishes a Bluetooth connection, creating an audio data stream transmission channel. The Bluetooth device receives the audio data stream transmitted from the display device via a USB bus and then sends the audio data stream to Bluetooth playback devices such as Bluetooth headphones or Bluetooth speakers for playback. The pairing profile between the display device and the Bluetooth playback device can be either classic Bluetooth A2DP or Bluetooth Low Energy Audio (LE audio), depending on the specific circumstances and is not limited here.
[0075] For example, such as Figure 4 As shown, display device 401 is connected to Bluetooth device 402 via a USB bus (i.e., via a USB interface). Bluetooth device 402 is connected to a subwoofer speaker 403 and two satellite speakers 404 via Bluetooth. Subwoofer speaker 403 and two satellite speakers 404 receive audio data streams from display device via Bluetooth device 402 and play the corresponding audio data.
[0076] The first control instruction is used to instruct the display device to increase the buffer fill rate, increase the buffer write rate, accelerate the transmission, or switch to a buffer with a higher write rate for buffering, etc. The specific instructions can be determined according to the actual situation and are not limited here.
[0077] The second control instruction is used to instruct the display device to reduce the buffer fill rate, or reduce the buffer write rate, or restore standard transmission, or switch to a buffer with a lower write rate for buffering, etc. The specific method can be determined according to the actual situation and is not limited here.
[0078] The first buffer and the second buffer are the sending buffers on the display device side, and the target buffer is the receiving buffer on the Bluetooth device side. The first buffer is a buffer with a low write rate in the display device, which can also be called the normal mode buffer; the second buffer is a buffer with a high write rate in the display device, which can also be called the fast mode buffer.
[0079] The sampling rate of the first buffer can be a constant, or a default or standard sampling rate. The sampling rate of the second buffer can be dynamically changed, up to a maximum of n times the sampling rate of the first buffer, where n is a number greater than 1. For example, the sampling rate of the first buffer can be 48kHz, and the sampling rate of the second buffer can reach up to 144kHz. Generally, the write rate is the same as the sampling rate.
[0080] The first and second thresholds can be determined based on the actual situation, and are not limited here.
[0081] The first write rate and the second write rate can be determined according to the actual situation, and are not limited here.
[0082] In some embodiments of this disclosure, the Bluetooth module runs a fill rate prediction algorithm: fill rate prediction value = current fill rate + α × (rate of change of transmission delay of the most recent N packets), where α is a dynamic weighting coefficient that is adaptively adjusted according to channel quality.
[0083] like Figure 5 As shown, the existing technology only includes one audio buffer in the Bluetooth protocol stack. Because the clocks of the display device and the Bluetooth device are not synchronized, buffer overflow or underload problems are prone to occur during the transmission of audio streams via the USB bus.
[0084] like Figure 6 As shown in this embodiment, the Bluetooth protocol stack is modified (extending the A2DP / LE Audio HAL: adding a buffer mode state machine (Normal / Fast) to support dynamic sampling rate switching audio stream controller: adding dual-buffer routing logic in AudioFlinger to select the data source according to the mode). Dual logical buffers are deployed on the display device side, namely Audio buffer A (normal mode, hereinafter referred to as buffer A, i.e., the first buffer) and Audio buffer B (accelerated mode, hereinafter referred to as buffer B, i.e., the second buffer). A dynamic distribution mode is also set, dynamically switching the buffer mode (i.e., controlling the audio data flow to buffer A or buffer B) based on the feedback of the target buffer's fill rate event from the Bluetooth device. Buffer A and buffer B can be circular buffers. Buffer A can store an audio data stream of a first duration (e.g., 100ms), written at a standard sampling rate (e.g., 48kHz); buffer B can store an audio data stream of a second duration (e.g., 20ms), supporting burst writing (up to n times the standard rate, where n is a number greater than 1, e.g., n = 3).
[0085] In this embodiment, an adaptive threshold control logic is also set on the Bluetooth device side. The Bluetooth device calculates the target buffer fill rate in real time and triggers buffer mode switching through a first control command or a second control command, replacing hardware signal dependence. The fill rate monitoring algorithm can calculate the receive buffer occupancy rate at a preset period (e.g., 10ms), defining a value range (e.g., 30%-70%) for the first and second thresholds. An event feedback mechanism sends a first control command when the target buffer fill rate is detected to be less than or equal to the first threshold, and sends a second control command when the target buffer fill rate is detected to be greater than or equal to the second threshold.
[0086] For example, combined Figure 6 ,like Figure 7 As shown, the display device obtains the audio configuration information of the Bluetooth playback device, such as the sampling rate (44.1kHz, 48kHz, or 96kHz), through standard protocols like Bluetooth A2DP or LE AUDIO. The Bluetooth framework layer, upon receiving this audio configuration information, configures it for the audio module, setting it in the audio driver via audio service and audio HAL. When Bluetooth audio playback begins, the audio module collects and reports audio data according to the set sampling rate, or polls the audio HAL, writing it to the audio buffer via A2DP HAL or LE AUDOHAL respectively.
[0087] In some embodiments of this disclosure, after a Bluetooth connection is established, the display device obtains audio parameters (such as encoding format, base sampling rate, etc.) from the Bluetooth device. The dual buffers are initialized: buffer A is pre-filled with a certain amount of data at the standard sampling rate (e.g., the fill rate reaches a certain threshold, such as 50%), while buffer B remains empty.
[0088] In some embodiments of this disclosure, the control instructions can be HCI event packets (specially customized instructions) or GPIO hardware interrupts (adding a GPIO synchronization hardware pin between the display device and the Bluetooth device, such as...). Figure 8 As shown in the figure, the specific details can be determined according to the actual situation, and no limit is specified here.
[0089] In this embodiment of the present disclosure, when the fill rate of the target buffer of the Bluetooth device is less than or equal to a first threshold, the display device switches the first buffer with a lower write rate to the second buffer with a higher write rate, thereby increasing the fill rate of the buffer to prevent buffer underloading. When the fill rate of the target buffer of the Bluetooth device is greater than or equal to a second threshold, the display device switches the second buffer with a higher write rate to the first buffer with a lower write rate, thereby decreasing the fill rate of the buffer to prevent buffer overloading. In this way, the problem of buffer overflow or underloading that easily occurs during the transmission of audio streams via USB bus can be effectively solved.
[0090] In some embodiments of this disclosure, after controlling the writing of audio data streams through the second buffer at the second write rate, a bandwidth preemption strategy is implemented to allocate a higher priority Socket queue for data transmission in the B buffer, ensuring that burst data packets are sent first.
[0091] In some embodiments of this disclosure, the controller is further configured to: transmit the audio data stream of the first buffer to the Bluetooth device via the USB bus before stopping writing the audio data stream through the first buffer; and after stopping writing the audio data stream through the first buffer and after the audio data stream in the first buffer has been transmitted, transmit the audio data stream of the second buffer to the Bluetooth device via the USB bus. This ensures virtual clock alignment within the protocol stack, guarantees the timing continuity of audio data during buffer switching, and avoids data loss.
[0092] In some embodiments of this disclosure, a virtual clock generator can be maintained to maintain a global logical clock at the Audio HAL layer, based on the audio frame number (rather than absolute time). This allows the frame number offset of buffer A or buffer B to be calculated during buffer switching, ensuring continuous decoding timing of the Bluetooth module.
[0093] For example, when switching from buffer A to buffer B, the timestamp T of the last audio frame read from buffer A (to the protocol stack) can be recorded, and the timestamp of the first video frame read from buffer B can be set to T+T0, where T0 is the duration of the remaining video frames to be read from buffer A. This achieves seamless connection of video frames and realizes protocol stack clock alignment.
[0094] In some embodiments of this disclosure, the controller is specifically configured to: respond to a second control command, control the second buffer to write audio data stream at a third write rate, and control the writing of audio data stream through the first buffer, wherein the third write rate is less than the second write rate; transmit the audio data stream of the second buffer to the Bluetooth device through the USB bus; stop writing audio data stream through the second buffer when the fill rate of the first buffer is greater than or equal to a third threshold; and after the audio data stream of the second buffer has been transmitted, transmit the audio data stream of the first buffer to the Bluetooth device through the USB bus.
[0095] The third write rate can be determined based on actual conditions and is not limited here.
[0096] The third threshold can be determined based on the actual situation and is not limited here. For example, the third threshold can be 50%.
[0097] It is understandable that after switching the first buffer to the second buffer, all the audio data streams buffered in the first buffer have been transmitted to the Bluetooth device, so the first buffer is empty. Also, since the write rate of the first buffer is low, if the second buffer is directly switched to the first buffer in response to the second control command, there may not be enough audio data streams in the first buffer to be transmitted to the Bluetooth device, resulting in the first buffer being underloaded. Therefore, in this embodiment of the present disclosure, in response to the second control command, during the process of switching the second buffer to the first buffer, the buffering of the second buffer is not directly stopped, but a transition phase is set, that is, the sampling rate is kept unchanged, the write rate of the second buffer is reduced, so that buffering is performed simultaneously through the first buffer and the second buffer.
[0098] It should be noted that, under normal circumstances, the write rate is the same as the sampling rate. However, during the transition phase of switching from the second buffer to the first buffer, the write rate of the second buffer is less than the sampling rate, and the extra sampled data is cached in the first buffer.
[0099] In this embodiment of the disclosure, by stopping the writing of audio data stream through the second buffer when the fill rate of the first buffer is greater than or equal to the third threshold, the problem of buffer underload that may be caused by direct switching can be avoided. After the audio data stream in the second buffer is transmitted, the audio data stream in the first buffer is transmitted to the Bluetooth device through the USB bus to ensure virtual clock alignment in the protocol stack, and to ensure the timing continuity of audio data when switching buffers, thus avoiding data loss.
[0100] In some embodiments of this disclosure, the second control command carries the local clock deviation of the Bluetooth device, and the display device can fine-tune the subsequent data packet transmission interval based on the local clock deviation of the Bluetooth device, thereby realizing an anti-timing jitter strategy.
[0101] In some embodiments of this disclosure, the first control instruction carries a target field; the controller is further configured to: obtain a first clock offset based on the target field, the first clock offset indicating the difference between the local clock of the Bluetooth device and the local clock of the display device; and send the first clock offset to cause the Bluetooth device to adjust its local clock to synchronize with the local clock of the display device based on the first clock offset.
[0102] The target field is used to indicate a sudden change in the local clock offset of the Bluetooth device (CLK_Offset change). Based on this target field, the display device is triggered to immediately initiate a non-periodic clock synchronization, that is, the Bluetooth device actively triggers the display device to perform clock synchronization.
[0103] In this embodiment of the disclosure, during audio playback, the display device is triggered to perform non-periodic clock synchronization based on the target field sent by the Bluetooth device. In this way, the time between the display device and the Bluetooth device can be synchronized, effectively avoiding buffer overflow or underload.
[0104] In some embodiments of this disclosure, the controller is further configured to: before receiving an audio playback command, acquire a second clock offset, the second clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; and send the second clock offset to cause the Bluetooth device to adjust its local clock to synchronize with the local clock of the display device based on the second clock offset.
[0105] The target clock threshold can be determined based on the actual situation and is not limited here.
[0106] In some embodiments of this disclosure, before receiving an audio playback command, that is, before audio playback, the clock offset between the local clock of the Bluetooth device and the local clock of the display device can be periodically obtained in a first cycle, that is, the second clock offset can be periodically obtained.
[0107] In some embodiments of this disclosure, a second clock offset may be periodically sent to the Bluetooth device with a second period, so that the Bluetooth device periodically synchronizes its clock with the display device. The second period may be greater than or equal to the first period, and this is not limited thereto.
[0108] In some embodiments of this disclosure, a second clock offset is sent when the absolute value of the second clock offset is greater than or equal to a target clock threshold. Thus, when the second clock offset reaches a certain value, the second clock offset is sent to enable the Bluetooth device to periodically synchronize its clock with the display device.
[0109] In this embodiment of the disclosure, before audio playback, by acquiring and sending a second clock offset, the Bluetooth device adjusts its local clock to synchronize with the local clock of the display device based on the second clock offset. This can effectively reduce the problem of buffer overflow or underload caused by the clock asynchrony between the display device and the Bluetooth device during audio playback.
[0110] In some embodiments of this disclosure, the controller is further configured to: before receiving an audio playback command, acquire a third clock offset, the third clock offset being used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; update a fourth threshold to the first threshold, the fourth threshold being less than the first threshold, and the fourth threshold being a preset fill rate threshold for triggering the generation of a first control command, when the third clock offset is greater than 0, the third clock offset is greater than or equal to a first clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to increase within a preset time period; send the first threshold to cause the Bluetooth device to send a first control command when it detects that the fill rate of the target buffer is less than or equal to the first threshold; update a fifth threshold to the second threshold, the fifth threshold being greater than the second threshold, and the fifth threshold being a preset fill rate threshold for triggering the generation of a second control command, when the third clock offset is less than 0, the third clock offset is less than or equal to a second clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to decrease within a preset time period; send the second threshold to cause the Bluetooth device to send a second control command when it detects that the fill rate of the target buffer is less than or equal to the second threshold.
[0111] The first clock threshold and the second clock threshold can be determined according to the actual situation, and are not limited here.
[0112] The fourth and fifth thresholds can be determined based on the actual situation, and are not limited here.
[0113] It is understandable that a third clock offset greater than 0 indicates that the Bluetooth device's clock is fast. If the third clock offset is greater than or equal to the first clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to increase within a preset time period, it indicates that the Bluetooth device's clock is continuously increasing for the display device, meaning that the Bluetooth device's clock is getting faster and faster. Therefore, before playing audio, it can be predicted that the Bluetooth device's clock may also become faster and faster during audio playback. This increases the threshold corresponding to the buffer fill rate that triggers the Bluetooth device to generate and send the first control command during audio playback, meaning that the first control command is triggered to be generated and sent earlier. This allows for earlier adjustment of the buffer's buffer rate, avoiding buffer underload issues.
[0114] It is understandable that a third clock offset less than 0 indicates that the Bluetooth device's clock is slow. The third clock offset is less than or equal to the second clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device is continuously decreasing within a preset time period. This indicates that the Bluetooth device's clock is continuously increasing negatively relative to the display device, meaning that the Bluetooth device's clock is getting slower and slower. Therefore, before playing audio, it can be predicted that the Bluetooth device's clock may also become slower and slower during audio playback. This reduces the threshold corresponding to the buffer fill rate that triggers the Bluetooth device to generate and send the second control command during audio playback, meaning that the second control command is triggered to be generated and sent earlier. This allows for advance adjustment of the buffer fill rate, avoiding buffer overflow issues.
[0115] In some embodiments of this disclosure, the fourth threshold is a preset fill rate threshold for the target buffer used to trigger the generation of the first control command, and the fifth threshold is a preset fill rate threshold for the target buffer used to trigger the generation of the second control command. That is, if no continuous positive increase in the Bluetooth device's clock is detected within a preset duration before audio playback, the Bluetooth device sends the first control command if it detects that the fill rate of the target buffer is less than or equal to the fourth threshold during audio playback; if no continuous negative increase in the Bluetooth device's clock is detected within a preset duration before audio playback, the second control command is sent if it detects that the fill rate of the target buffer is greater than or equal to the fifth threshold during audio playback.
[0116] In this embodiment of the present disclosure, before playing audio, the change in the difference between the local clock of the Bluetooth device and the local clock of the display device within a preset time period is used to determine whether to adjust the fill rate threshold of the target buffer that triggers the generation and sending of the first control command or the second control command during the audio playback process. In this way, buffer overflow and underload can be better avoided during the audio playback process.
[0117] In some embodiments of this disclosure, the controller is further configured to: send a synchronization beacon packet via the USB bus, the synchronization beacon packet carrying the local clock counter value of the display device; obtain the timestamp T1 of sending the synchronization beacon packet; receive a response packet corresponding to the synchronization beacon packet via the USB bus, the response packet carrying the timestamp T2 of the Bluetooth device receiving the synchronization beacon packet, the timestamp T3 of the Bluetooth device sending the response packet, and the local clock counter value of the Bluetooth device; obtain the timestamp T4 of receiving the response packet; and calculate a clock offset value based on T1, T2, T3, and T4, as well as the local clock counter values of the display device and the Bluetooth device.
[0118] In this embodiment, the period for sending synchronization beacon packets is not limited.
[0119] The synchronization beacon packet can be transmitted through the existing data transmission channel of the USB bus or through a dedicated data transmission channel; no limitation is made here.
[0120] For example, synchronization beacon packets are transmitted using a dedicated data transmission channel. After the Bluetooth connection is established, during the Bluetooth driver probe process, the display device requests the establishment of three types of endpoints from the USB bus, including two interrupt endpoints, isochronous transfer, and bulk transfer endpoints. The isochronous transfer endpoint is used for clock information synchronization; one interrupt transfer endpoint is used for clock synchronization data exchange between the Bluetooth device and the display device, and another interrupt endpoint is used for command transmission and interaction between the Bluetooth module and the SOC module; the bulk transfer endpoint is used for the transmission of audio data or large amounts of data. This leads to the establishment of... Figure 9 The diagram shows the isochronous transmission channel, interrupt transmission channel 1, interrupt transmission channel 2, and bulk transmission channel. The isochronous transmission channel and interrupt transmission channel 1 are specifically designed for clock synchronization between the display device and the Bluetooth device, while interrupt transmission channel 2 and bulk transmission channel are existing channels used for transmitting Bluetooth protocol data. Thus, by using dedicated data transmission channels, conflicts between clock synchronization data and Bluetooth protocol data transmission can be avoided, transmission latency can be reduced, clock synchronization timeliness can be improved, and clock synchronization can be performed on demand.
[0121] For example, the display device sends a synchronization beacon packet (data format not limited) containing the local clock counter value (CLK_SOC) via the USB isochronous transmission channel, and records the transmission timestamp T1. Upon receiving the beacon packet, the Bluetooth device records the local reception timestamp T2 (based on the Bluetooth device's internal free clock) and generates a response packet. The response packet carries T2, the local timestamp T3 from which the response packet was sent, and the Bluetooth module's local clock counter value CLK_LOCAL. It then returns a response packet via the USB interrupt channel (response packet data format not limited). After receiving the response packet, the display device calculates the bidirectional transmission delay Δt, Δt = (T4 - T1) - (T3 - T2) / 2, calculates the clock offset Offset, Offset = CLK_SOC - CLK_LOCAL + Δt × f_clk, where f_clk is the nominal clock frequency (e.g., 16MHz), and sends a clock compensation coefficient register (format not limited) to the Bluetooth module.
[0122] It should be noted that the acquisition of the first clock offset, the second clock offset, and the third clock offset are all achieved through the above process, which will not be repeated here.
[0123] In this embodiment of the disclosure, the clock offset between the display device and the Bluetooth device can be accurately obtained through the above-described process of obtaining the clock offset, and then clock synchronization between the devices can be achieved based on the clock offset.
[0124] See Figure 10 In some embodiments, the system is divided into four layers, from top to bottom: the Applications layer (referred to as the "Application Layer"), the Application Framework layer (referred to as the "Framework Layer"), the Android runtime and system library layer (referred to as the "System Runtime Layer"), and the kernel layer.
[0125] In some embodiments, at least one application runs in the application layer. These applications may be Windows programs, system settings programs, or clock programs that come with the operating system; they may also be applications developed by third-party developers. In specific implementations, the application packages in the application layer are not limited to the examples above.
[0126] The framework layer provides application programming interfaces (APIs) and a programming framework for applications. The application framework layer includes predefined functions. It acts as a central processing unit, determining the actions taken by applications within the application layer. Through the API, applications can access system resources and obtain system services during execution.
[0127] like Figure 10 As shown, in this embodiment of the disclosure, the application framework layer includes managers, content providers, etc., wherein the managers include at least one of the following modules: ActivityManager, which interacts with all activities running in the system; LocationManager, which provides access to system location services for system services or applications; PackageManager, which retrieves various information related to application packages currently installed on the device; NotificationManager, which controls the display and clearing of notification messages; and WindowManager, which manages icons, windows, toolbars, wallpapers, and desktop widgets on the user interface.
[0128] In some embodiments, the Activity Manager manages the lifecycle of individual applications and common navigation and back functions, such as controlling application exit, opening, and back actions. The Window Manager manages all window programs, such as obtaining the screen size, determining if a status bar is present, locking the screen, capturing the screen, and controlling display window changes (e.g., shrinking the display window, shaking the display, distorting the display, etc.).
[0129] In some embodiments, the system runtime library layer provides support for the upper layer, namely the framework layer. When the framework layer is used, the Android operating system runs the C / C++ libraries contained in the system runtime library layer to implement the functions that the framework layer needs to perform.
[0130] In some embodiments, the kernel layer is a layer between hardware and software. For example... Figure 10 As shown, the kernel layer includes at least one of the following drivers: audio driver, display driver, Bluetooth driver, camera driver, WIFI driver, USB driver, HDMI driver, sensor driver (such as fingerprint sensor, temperature sensor, pressure sensor, etc.), and power driver.
[0131] To illustrate this solution in more detail, the following will use examples to illustrate it. Figure 11 To explain, it is understandable that Figure 11 The steps involved may include more or fewer steps in actual implementation, and the order of these steps may also differ, as long as the device control method provided in the embodiments of this disclosure can be achieved. This device control method is applied to a display device controlled by a control device. The executing entity of the device control method can be the display device itself, or a functional module or entity within the display device capable of implementing the device control method; no limitation is made here. Furthermore, a detailed description of the device control method provided in the embodiments of this disclosure can be found in the relevant description of the aforementioned display device, and the same or similar technical effects can be achieved; further details are omitted here.
[0132] Figure 11 The flowchart illustrates the steps of implementing a device control method according to one or more embodiments of this disclosure. The device control method may include steps S1101 to S1108. In this method, a display device is connected to a Bluetooth device via a USB bus, and an audio data stream is transmitted to the Bluetooth device via the USB bus.
[0133] S1101. When the Bluetooth device detects that the fill rate of the target buffer is less than or equal to the first threshold, it sends a first control command.
[0134] S1102. When the display device writes an audio data stream through the first buffer at a first write rate, it receives a first control command.
[0135] The first control command is sent by the Bluetooth device when it detects that the fill rate of the target buffer is less than or equal to a first threshold.
[0136] S1103, The display device responds to the first control command and controls the writing of the audio data stream through the second buffer at the second write rate.
[0137] S1104, The display device stops writing audio data streams through the first buffer.
[0138] The second write rate is greater than the first write rate.
[0139] S1105. When the Bluetooth device detects that the fill rate of the target buffer is greater than or equal to the second threshold, it sends a second control command.
[0140] S1106, The display device receives the second control command.
[0141] The second control command is sent by the Bluetooth device when it detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold is greater than the first threshold.
[0142] S1107. The display device responds to the second control command and controls the writing of the audio data stream through the first buffer.
[0143] S1108, The display device stops writing audio data streams through the second buffer.
[0144] In some embodiments of this disclosure, before S1104 described above, the device control method provided in the embodiments of this disclosure may further include S1109 described below, and after S1104 described above, the device control method provided in the embodiments of this disclosure may further include S1110.
[0145] S1109. The display device transmits the audio data stream of the first buffer to the Bluetooth device via the USB bus.
[0146] S1110. After the audio data stream in the first buffer is transmitted, the display device transmits the audio data stream in the second buffer to the Bluetooth device through the USB bus.
[0147] In some embodiments of this disclosure, before S1108, the device control method provided in the embodiments of this disclosure may further include the following S1111 to S1113. The above-mentioned S1108 can be specifically implemented by the following S1108a. The device control method provided in the embodiments of this disclosure may further include the following S1114.
[0148] S1111 The display device responds to the second control command and controls the second buffer to write audio data stream at a third write rate.
[0149] S1112, The display device controls the writing of audio data stream through the first buffer.
[0150] The third write rate is less than the second write rate.
[0151] S1113. The display device transmits the audio data stream of the second buffer to the Bluetooth device via the USB bus;
[0152] S1108a. If the fill rate of the first buffer is greater than or equal to the third threshold, the display device stops writing audio data streams through the second buffer.
[0153] S1114. After the audio data stream in the second buffer is transmitted, the display device transmits the audio data stream in the first buffer to the Bluetooth device through the USB bus.
[0154] In some embodiments of this disclosure, the first control instruction carries a target field; the device control method provided in the embodiments of this disclosure may further include the following S1115 and S1116.
[0155] S1115. The display device obtains a first clock offset based on the target field. The first clock offset is used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device.
[0156] S1116. The display device sends a first clock offset so that the Bluetooth device adjusts its local clock to synchronize with the display device's local clock based on the first clock offset.
[0157] In some embodiments of this disclosure, the device control method provided in the embodiments of this disclosure may further include the following S1117 and S1118.
[0158] S1117. Before receiving an audio playback command, the display device obtains a second clock offset, which is used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device.
[0159] S1118. The display device sends a second clock offset so that the Bluetooth device adjusts its local clock to synchronize with the display device's local clock based on the second clock offset.
[0160] In some embodiments of this disclosure, the device control method provided in the embodiments of this disclosure may further include the following S1119 and S112.
[0161] S1119. Before receiving an audio playback command, the display device obtains a third clock offset, which is used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device.
[0162] S1120. If the third clock offset is greater than 0, the third clock offset is greater than or equal to the first clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to increase within a preset time period, the display device updates the fourth threshold to the first threshold.
[0163] The fourth threshold is less than the first threshold, and the fourth threshold is a preset fill rate threshold for the target buffer used to trigger the generation of the first control command.
[0164] S1121, The display device sends a first threshold to cause the Bluetooth device to send a first control command when it detects that the fill rate of the target buffer is less than or equal to the first threshold.
[0165] S1122. When the third clock offset is less than 0, the third clock offset is less than or equal to the second clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to decrease within a preset time period, the display device updates the fifth threshold to the second threshold.
[0166] The fifth threshold is greater than the second threshold, and the fifth threshold is a preset fill rate threshold for the target buffer used to trigger the generation of the second control command.
[0167] S1123, The display device sends a second threshold to cause the Bluetooth device to send a second control command if it detects that the fill rate of the target buffer is less than or equal to the second threshold.
[0168] In some embodiments of this disclosure, the process of obtaining the clock offset may include the following S1 to S5.
[0169] S1. The display device sends a synchronization beacon packet via the USB bus.
[0170] The synchronization beacon packet carries the local clock counter value of the display device.
[0171] S2. The display device obtains the timestamp of the synchronization beacon packet sent.
[0172] It is understandable that the display device records T1.
[0173] S3. The display device receives the response packet corresponding to the synchronization beacon packet through the USB bus.
[0174] The response packet carries the timestamp T2 of the Bluetooth device receiving the synchronization beacon packet, the timestamp T3 of the Bluetooth device sending the response packet, and the local clock counter value of the Bluetooth device.
[0175] S4. The display device obtains the timestamp T4 of receiving the response packet.
[0176] S5. The display device calculates the clock offset value based on T1, T2, T3, and T4, as well as the local clock counter value of the display device and the local clock counter value of the Bluetooth device.
[0177] The present invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described device control method and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0178] The computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0179] The present invention provides a computer program product, comprising: when the computer program product is run on a computer, causing the computer to implement the above-described device control method.
[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this disclosure.
[0181] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A display device, characterized in that, The display device is used to connect to a Bluetooth device via a USB bus and to transmit audio data streams to the Bluetooth device via the USB bus, including: The controller is configured to receive a first control instruction when writing an audio data stream through a first buffer at a first write rate, the first control instruction being sent by the Bluetooth device when it detects that the fill rate of the target buffer is less than or equal to a first threshold. In response to the first control command, control is exercised to write audio data stream through the second buffer at a second write rate, and to stop writing audio data stream through the first buffer; the second write rate is greater than the first write rate; The device receives a second control command, which is sent by the Bluetooth device when it detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold is greater than the first threshold. In response to the second control command, control the writing of audio data stream through the first buffer and stop writing audio data stream through the second buffer.
2. The display device according to claim 1, characterized in that, The controller is also configured to: Before stopping the writing of audio data stream through the first buffer, the audio data stream of the first buffer is transmitted to the Bluetooth device via the USB bus; After stopping the writing of audio data stream through the first buffer, and after the audio data stream in the first buffer has been transmitted completely, the audio data stream in the second buffer is transmitted to the Bluetooth device via the USB bus.
3. The display device according to claim 1, characterized in that, The controller is specifically configured as follows: In response to the second control command, the second buffer is controlled to write audio data stream at a third write rate, and the first buffer is controlled to write audio data stream, wherein the third write rate is less than the second write rate; The audio data stream of the second buffer is transmitted to the Bluetooth device via the USB bus; If the fill rate of the first buffer is greater than or equal to the third threshold, stop writing audio data streams through the second buffer; After the audio data stream in the second buffer is transmitted, the audio data stream in the first buffer is transmitted to the Bluetooth device via the USB bus.
4. The display device according to claim 1, characterized in that, The first control instruction carries a target field; the controller is further configured to: Based on the target field, a first clock offset is obtained, which is used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; Send the first clock offset so that the Bluetooth device adjusts its local clock to synchronize with the local clock of the display device based on the first clock offset.
5. The display device according to claim 1, characterized in that, The controller is also configured to: Before receiving an audio playback command, a second clock offset is obtained, which is used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; Send the second clock offset so that the Bluetooth device adjusts its local clock to synchronize with the local clock of the display device based on the second clock offset.
6. The display device according to claim 1, characterized in that, The controller is also configured to: Before receiving an audio playback command, a third clock offset is obtained, which is used to indicate the difference between the local clock of the Bluetooth device and the local clock of the display device; If the third clock offset is greater than 0, the third clock offset is greater than or equal to the first clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to increase within a preset time period, the fourth threshold is updated to the first threshold. The fourth threshold is less than the first threshold. The fourth threshold is a preset fill rate threshold for the target buffer used to trigger the generation of the first control command. Send the first threshold so that the Bluetooth device sends the first control command when it detects that the fill rate of the target buffer is less than or equal to the first threshold; If the third clock offset is less than 0, the third clock offset is less than or equal to the second clock threshold, and the difference between the local clock of the Bluetooth device and the local clock of the display device continues to decrease within a preset time period, the fifth threshold is updated to the second threshold. The fifth threshold is greater than the second threshold. The fifth threshold is a preset fill rate threshold for the target buffer used to trigger the generation of the second control command. Send the second threshold so that the Bluetooth device sends the second control command if it detects that the fill rate of the target buffer is less than or equal to the second threshold.
7. The display device according to any one of claims 4-6, characterized in that, The controller is also configured to: A synchronization beacon packet is sent via the USB bus, the synchronization beacon packet carrying the local clock counter value of the display device; Obtain the timestamp T1 of the time when the synchronization beacon packet was sent; The Bluetooth device receives a response packet corresponding to the synchronization beacon packet via the USB bus. The response packet carries the timestamp T2 of the Bluetooth device receiving the synchronization beacon packet, the timestamp T3 of the Bluetooth device sending the response packet, and the local clock counter value of the Bluetooth device. Obtain the timestamp T4 of the received response packet; The clock offset value is calculated based on T1, T2, T3, and T4, as well as the local clock counter value of the display device and the local clock counter value of the Bluetooth device.
8. A Bluetooth device, characterized in that, The Bluetooth device is used to connect to the display device via a USB bus and to receive audio data streams transmitted from the display device via the USB bus, including: The controller is configured to: upon detecting that the fill rate of the target buffer is less than or equal to a first threshold, send a first control instruction, the first control instruction being used by the display device to control the writing of an audio data stream through a second buffer at a second write rate while the display device is writing an audio data stream through a first buffer at a first write rate, and to stop writing an audio data stream through the first buffer; the second write rate is greater than the first write rate; If the fill rate of the target buffer is detected to be greater than or equal to a second threshold, a second control instruction is sent. The second control instruction is used by the display device to control the writing of audio data stream through the first buffer and to stop writing audio data stream through the second buffer; the second threshold is greater than the first threshold.
9. A device control method, characterized in that, A display device for connecting to a Bluetooth device via a USB bus and transmitting audio data streams to the Bluetooth device via the USB bus, comprising: When writing an audio data stream through a first buffer at a first write rate, a first control instruction is received, wherein the first control instruction is sent by the Bluetooth device when it detects that the fill rate of the target buffer is less than or equal to a first threshold. In response to the first control command, control is exercised to write audio data stream through the second buffer at a second write rate, and to stop writing audio data stream through the first buffer; the second write rate is greater than the first write rate; The device receives a second control command, which is sent by the Bluetooth device when it detects that the fill rate of the target buffer is greater than or equal to a second threshold; the second threshold is greater than the first threshold. In response to the second control command, control the writing of audio data stream through the first buffer and stop writing audio data stream through the second buffer.
10. A device control method, characterized in that, A Bluetooth device for connecting to a display device via a USB bus and receiving audio data streams transmitted from the display device via the USB bus, comprising: If the fill rate of the target buffer is detected to be less than or equal to a first threshold, a first control instruction is sent. The first control instruction is used to control the display device to write audio data stream through a second buffer at a second write rate while writing audio data stream through the first buffer at a first write rate, and to stop writing audio data stream through the first buffer; the second write rate is greater than the first write rate. If the fill rate of the target buffer is detected to be greater than or equal to a second threshold, a second control instruction is sent. The second control instruction is used by the display device to control the writing of audio data stream through the first buffer and to stop writing audio data stream through the second buffer; the second threshold is greater than the first threshold.