Synchronous playing system and method, and electronic device, storage medium and chip system
By adopting the timestamp synchronization mechanism and playback time difference calculation in distributed hardware technology, the problem of audio and video out-synchronization in cross-device playback scenarios is solved, audio and video synchronization is achieved, and user experience is improved.
Patent Information
- Application Number
- PCT/CN2024/095705
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-07
- Filing Date
- 2024-05-28
- Publication Date
- 2025-01-16
AI Technical Summary
In distributed hardware technology, audio and video playback may be out of synchronization due to the sampling rate of audio data and video data, differences in post-processing duration and network jitter in cross-device playback scenarios, affecting the user experience.
A synchronous playback system and method are provided, through a time stamp synchronization mechanism between the first device and the second device, a playback time difference is calculated, and a synchronous playback strategy is determined based on the difference value, ensuring synchronous playback of audio and video. Specific measures include: the first device obtains and transmits a time stamp, the second device reads the time stamp of the data frame, calculates the playback time difference, and adjusts the playback progress according to the difference value, and adopts a waiting, sending or catching-up strategy to achieve synchronization.
It effectively solves the problem of audio and video asynchronous in cross-device playback scenarios, improves user experience, ensures audio and video synchronization, and enhances playback consistency in distributed business scenarios.
Smart Images

Figure CN2024095705_16012025_PF_FP_ABST
Abstract
Description
Synchronous playback system and method, electronic device, storage medium and chip system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on July 7, 2023, with application number 202310838662.5 and application name “Synchronous playback system and method, electronic device, storage medium and chip system”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of distributed hardware technology, and in particular to a synchronous playback system and method, electronic equipment, storage medium, and chip system. Background Art
[0003] Distributed operating systems integrate the capabilities of various terminal devices, enabling hardware collaboration and resource sharing to provide users with a smooth, full-scenario experience. Based on distributed hardware, distributed operating systems can offer users a variety of distributed services, such as distributed cameras, distributed screens, and distributed audio. These distributed services typically include audio / video transmission capabilities. For example, in audio and video broadcasting scenarios, the source encodes and compresses the original audio / video stream, then sends it to the player through a transmission module for decoding, restoration, and playback.
[0004] In the audio and video broadcast scenario based on distributed hardware, due to differences in the sampling rate and post-processing time of audio and video data, as well as network jitter, audio and video playback may be out of sync when played across devices, affecting the user experience.
[0005] Summary of the Invention
[0006] The present application provides a synchronous playback system and method, electronic device, storage medium and chip system, which can realize synchronous playback of audio and video in distributed business scenarios with cross-device broadcasting.
[0007] In the first aspect, an embodiment of the present application provides a synchronous playback system, which includes a first device, a second device and a third device; the third device is used to transmit the first data stream to the first device for playback, and transmit the second data stream to the second device for playback; the first data stream and the second data stream are two data streams to be played synchronously; the first data stream includes multiple first data frames; the second data stream includes multiple second data frames; the first device is used to obtain a first timestamp and send the first timestamp to the third device; the third device is used to receive the first timestamp and forward it to the second device; the second device is used to receive the first timestamp, read the second timestamp corresponding to the second data frame to be played, and calculate the first playback time difference based on at least the first timestamp and the second timestamp, and determine the synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference.
[0008] In a feasible implementation, when executing the operation of reading the second timestamp corresponding to the second data frame to be played, the second device is specifically configured to: take out the next second data frame to be played from the cache queue at every predetermined time interval and read the second timestamp.
[0009] In a feasible implementation, the second device, when performing the operation of calculating the first playback time difference based on at least the first timestamp and the second timestamp, is specifically used to: determine that there is a mapping relationship between the next second data frame to be played and the m-th first data frame, and calculate the first playback time difference based on at least the first timestamp corresponding to the m-th first data frame and the second timestamp corresponding to the next second data frame to be played; wherein the mapping relationship is determined based on the serial number and / or the playback timestamp PTS.
[0010] In a feasible implementation, the second device is also used to identify the data type of the second data frame to be played and feed it back to the third device; the first device is also used to identify the data type of the first data frame to be played and feed it back to the third device; the third device is also used to receive the respective data types fed back by the first device and the second device, and determine the synchronization management strategy.
[0011] In a second aspect, an embodiment of the present application also provides a synchronous playback system, which includes a first device, a second device and a third device; the third device transmits the first data stream to the first device for playback, and transmits the second data stream to the second device for playback; the first data stream includes multiple first data frames; the second data stream includes multiple second data frames; the first device is used to determine delay information; the delay information includes transmission delay and decoding delay; wherein the transmission delay represents the duration of time for the first data frame to be transmitted from the third device to the first device; the decoding delay is the decoding duration occupied by a first data frame; the third device is used to receive the delay information, obtain the sending time of the first data frame, and obtain an estimated value of the playback time of the first data frame on the first device based on at least the sending time and the delay information; before sending the second data frame, the estimated value is added to the second data frame as a fifth timestamp; the second device is used to read the fifth timestamp of the second data frame to be played, calculate the difference between the fifth timestamp and the current time, and obtain a second playback time difference; based on the second playback time difference, determine the synchronous playback strategy to be executed for the second data frame to be played.
[0012] On the third aspect, an embodiment of the present application also provides a synchronous playback system, which includes a fourth device, a fifth device and a sixth device; the fourth device and the fifth device respectively transmit the fourth data stream and the fifth data stream to the sixth device for playback; the fourth device, the fifth device and the sixth device are all provided with a control center, and the control center reserves an interface for setting synchronization group information; the fourth device and the fifth device are used to set the synchronization group information to the local control center, and send the set synchronization group information to the sixth device respectively; the synchronization group information includes synchronization reference information and stream information, the synchronization reference information includes the source device identity information and the playback device identity information; the stream information includes the data type information of the data stream sent by each device on the source end; the sixth device is used to receive the synchronization group information sent by the fourth device and the fifth device respectively, and determine the synchronous playback strategy for the data stream to be played based at least on the synchronization group information.
[0013] In a fourth aspect, the technical solution of the present application provides a synchronous playback method, which is applied to a second device, the second device being configured to receive and play a second data stream sent by a third device; wherein the third device is further configured to transmit a first data stream to the first device for playback; the first data stream and the second data stream being two data streams to be played synchronously, the first data stream comprising a plurality of first data frames; and the second data stream comprising a plurality of second data frames; the method comprising: receiving a first timestamp; the first timestamp representing the actual playback time of the mth first data frame on the first device; m ≥ 1 and being an integer; reading a second timestamp corresponding to the second data frame to be played; the second timestamp representing the playback timing of each second data frame in the second data stream; calculating a first playback time difference based on at least the first timestamp and the second timestamp; and determining a synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference. The method uses the actual playback time of each data frame in the first data stream as a reference to calculate the playback time difference between the second data stream and the first data stream. The playback time difference can be used to determine whether the playback progress of the second data stream is ahead, behind, or synchronized with the first data stream, thereby adjusting the playback progress of the second data stream to achieve synchronous playback.
[0014] In one feasible implementation, receiving the first timestamp includes: receiving the first timestamp forwarded by a third device; and the first timestamp is generated by the first device and sent to the third device. Forwarding the first timestamp by the third device can reduce transmission pressure on the data link and reduce the delay in transmitting the critical first timestamp, compared to other information transmission methods, such as directly sending the first timestamp from the first device to the second device.
[0015] In one feasible implementation, reading the second timestamp corresponding to the second data frame to be played includes: at predetermined time intervals, retrieving the next second data frame to be played from a cache queue and reading the second timestamp. The trigger condition for reading the second timestamp is to trigger once at predetermined time intervals. The frequency of reading the second timestamp can be controlled by setting an adjustment time interval, thereby controlling the frequency of calculating the playback time difference. A higher frequency is equivalent to determining synchronization within a finer time granularity.
[0016] In one feasible implementation, calculating the first playback time difference based on at least the first timestamp and the second timestamp includes: determining that a mapping relationship exists between the next second data frame to be played and the mth first data frame, calculating the first playback time difference based on at least the first timestamp corresponding to the mth first data frame and the second timestamp corresponding to the next second data frame to be played; wherein the mapping relationship is determined based on the sequence number and / or the playback timestamp PTS. Calculating the playback time difference based on the first timestamp and the second timestamp can, to a certain extent, reflect the difference in playback progress between the first data stream and the second data stream.
[0017] In one feasible implementation, calculating the first playback time difference based on at least the first timestamp and the second timestamp includes: calculating the first playback time difference based on the first timestamp, the second timestamp, the first processing duration, and the second processing duration; wherein the first processing duration is an estimated value of the processing duration from the time a first data frame is retrieved from the cache queue to the time it is played; and the second processing duration is an estimated value of the processing duration from the time a second data frame is retrieved from the cache queue to the time it is played. Further introducing the first processing duration and the second processing duration as two parameters to calculate the playback time difference can more accurately reflect the difference in playback progress between the first data stream and the second data stream.
[0018] In a feasible implementation, the synchronous playback strategy includes at least one of waiting, displaying and catching up; based on the first playback time difference, determining the synchronous playback strategy to be executed for the second data frame to be played, including: comparing the first playback time difference with a predetermined first threshold interval; when the first playback time difference is less than the minimum value of the threshold interval, determining that the playback of the first data stream lags behind the second data stream, and determining that the synchronous playback strategy to be executed for the second data frame to be played is waiting; when the first playback time difference is greater than the maximum value of the threshold interval, determining that the playback of the first data stream is ahead of the second data stream, and determining that the synchronous playback strategy to be executed for the second data frame to be played is catching up; when the first playback time difference falls within the threshold interval, determining that the playback of the first data stream is relatively synchronized with the playback of the second data stream, and determining that the synchronous playback strategy to be executed for the second data frame to be played is displaying.
[0019] In a feasible implementation, waiting includes one or more of reducing the playback rate, waiting for a first predetermined time period, and dropping frames; wherein the first predetermined time period is determined based on the difference between the minimum value in the threshold interval and the first playback time difference; catching up includes increasing the playback rate and / or dropping frames.
[0020] In the fifth aspect, an embodiment of the present application also provides a synchronous playback method, which is applied to a third device, and the third device is used to transmit a first data stream to the first device for playback, and transmit a second data stream to the second device for playback; wherein the first data stream and the second data stream are two data streams to be played synchronously, the first data stream includes multiple first data frames; the second data stream includes multiple second data frames; the method includes: receiving delay information; the delay information includes transmission delay and decoding delay; wherein the transmission delay represents the duration of the mth first data frame being transmitted from the third device to the first device; the decoding delay is the decoding duration occupied by the mth first data frame; m≥1 and is an integer; obtaining the sending time of the mth first data frame; at least based on the sending time and delay information, obtaining an estimated value of the playback time of the mth first data frame on the first device; before sending the second data frame, adding the estimated value as a fifth timestamp to the second data frame; the fifth timestamp is used to perform a difference calculation with the current moment to obtain a second playback time difference, so as to determine the synchronous playback strategy to be executed for the second data frame to be played. This method estimates the playback time of each data frame in the first data stream based on the historical delay information of the first data stream. Using the estimated value as a reference, the second device can determine the difference in playback progress by comparing the estimated value with the current time, thereby achieving synchronous playback.
[0021] In a feasible implementation, an estimated value of the playback time of the first data frame on the first device is obtained based at least on the transmission time and delay information, including: obtaining an estimated value of the playback time of the mth first data frame on the first device based at least on the transmission time and delay information of the mth first data frame; adding the estimated value as a fifth timestamp to the second data frame, including: adding the estimated value as the fifth timestamp to the second data frame that has a mapping relationship with the mth first data frame, wherein the mapping relationship is determined based on the sequence number and / or the playback timestamp PTS. For two data frames that have a mapping relationship, that is, two data frames that should be played synchronously, adding the fifth timestamp to the second data frame that has a mapping relationship with the mth first data frame is equivalent to marking the estimated playback time of the mth first data frame on the corresponding second data frame. Before playback, the second device only needs to compare the fifth timestamp on each second data frame with the current time to determine the difference in playback progress, thereby achieving synchronous playback.
[0022] In one feasible implementation, an estimated playback time of a first data frame on a first device is obtained based at least on the transmission time and delay information, including: obtaining an estimated playback time of the first data frame on the first device based on the transmission time, delay information, a third timestamp, and a fourth timestamp; wherein the third timestamp is a playback timestamp (PTS) added to the first data frame, used to indicate the playback timing of each first data frame in the first data stream; and the fourth timestamp is a playback timestamp (PTS) added to the second data frame, used to indicate the playback timing of each second data frame in the second data stream. This method provides a feasible solution for calculating playback time estimates, and the calculated estimated value can relatively accurately reflect the difference in playback progress between the first and second data streams.
[0023] In the sixth aspect, an embodiment of the present application also provides a synchronous playback method, which is applied to a second device, and the second device is used to receive and play a second data stream sent by a third device; wherein the third device is also used to transmit the first data stream to the first device for playback; the first data stream and the second data stream are two data streams to be played synchronously, the first data stream includes multiple first data frames; the second data stream includes multiple second data frames; the method includes: reading the fifth timestamp corresponding to the second data frame to be played; wherein the fifth timestamp is an estimated value of the playback time of the first data frame on the first device, which is obtained at least based on the sending time and delay information; wherein the delay information includes transmission delay and decoding delay; the transmission delay indicates the duration of the first data frame being transmitted from the third device to the first device; the decoding delay is the decoding time occupied by a first data frame; the sending time is the time when the third device sends the first data frame; the difference between the fifth timestamp and the current time is calculated to obtain the second playback time difference; based on the second playback time difference, determine the synchronous playback strategy to be executed for the second data frame to be played.
[0024] In a feasible implementation, the synchronous playback strategy includes at least one of waiting, displaying and catching up; based on the second playback time difference, determining the synchronous playback strategy to be executed for the second data frame to be played, including: comparing the second playback time difference with a predetermined first threshold interval; when the second playback time difference is less than the minimum value of the threshold interval, determining that the playback of the first data stream lags behind the second data stream, and determining that the synchronous playback strategy to be executed for the second data frame to be played is waiting; when the second playback time difference is greater than the maximum value of the threshold interval, determining that the playback of the first data stream is ahead of the second data stream, and determining that the synchronous playback strategy to be executed for the second data frame to be played is catching up; when the second playback time difference falls within the threshold interval, determining that the playback of the first data stream is relatively synchronized with the playback of the second data stream, and determining that the synchronous playback strategy to be executed for the second data frame to be played is displaying.
[0025] In the seventh aspect, an embodiment of the present application also provides a synchronous playback method, which is applied to a sixth device, and the sixth device is used to receive a fourth data stream sent by a fourth device and a fifth data stream sent by a fifth device, and to synchronously play the fourth data stream and the fifth data stream; the method includes: receiving synchronization group information sent by the fourth device and the fifth device respectively; the synchronization group information includes synchronization reference information and stream information, the synchronization reference information includes the identity information of the source device and the identity information of the playback device; the stream information includes the data type information of the data stream sent by each device on the source end; at least based on the synchronization group information, determine the synchronous playback strategy for the data stream to be played.
[0026] In the eighth aspect, the technical solution of the present application also provides an electronic device for sending data through a data transmission interface, the electronic device comprising: one or more processors; a memory; at least one application; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to execute a method as described in any one of the fourth to seventh aspects above.
[0027] In the ninth aspect, the technical solution of the present application also provides a storage medium, including computer instructions, which, when executed on an electronic device, enables the electronic device to execute a method as described in any one of the above-mentioned fourth to seventh aspects.
[0028] In the tenth aspect, the technical solution of the present application also provides a chip system, including: a communication interface for inputting and / or outputting data; a processor for executing a computer executable program, so that a device equipped with the chip system executes a method as described in any one of the fourth to seventh aspects above. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a diagram showing an example of the system architecture for a one-to-one broadcast application scenario;
[0030] FIG2 is a schematic diagram of an audio and video data transmission process architecture based on WebRTC technology in related art;
[0031] FIG3 is an example of a feasible product hardware architecture of an electronic device provided in an embodiment of the present application;
[0032] Figures 4(a) to 4(e) are diagrams showing device architecture examples for a one-to-many broadcast application scenario.
[0033] Figures 5(a) to 5(d) are example diagrams of one-to-many broadcast application scenarios;
[0034] Figures 6(a) to 6(c) are diagrams showing device architecture examples for a many-to-one broadcast application scenario.
[0035] FIG7 is a diagram illustrating an example of a system architecture for a one-to-two broadcast application scenario;
[0036] FIG8 is a diagram illustrating an example of a system architecture in which an audio and video synchronization module is added in a one-to-many broadcasting application scenario;
[0037] 9 is a schematic diagram of a link for delay feedback between a video playback device and an audio playback device in a one-to-many broadcast application scenario;
[0038] FIG10 is a schematic diagram of a video frame processing strategy in a one-to-many broadcast application scenario;
[0039] FIG11 is a schematic diagram of multiple thread time nodes of the video post-processing process;
[0040] FIG12 is a diagram showing an example of a system architecture using the second solution in a one-to-many broadcasting application scenario;
[0041] FIG13 is a diagram illustrating an example of a system architecture for synchronized playback in a multi-to-multi broadcast application scenario;
[0042] FIG14 is a diagram illustrating a typical system architecture for a one-to-many broadcasting application scenario;
[0043] FIG15 is a schematic flow chart of an embodiment of a synchronous playback method;
[0044] FIG16 is a flow chart of another embodiment of a synchronous playback method;
[0045] FIG17 is a flow chart of another embodiment of a synchronous playback method;
[0046] FIG18 is a typical system architecture example diagram for a many-to-one broadcast application scenario;
[0047] FIG19 is a flow chart of another embodiment of a synchronous playback method;
[0048] FIG20 is a schematic diagram of the system architecture of the playback system in a one-to-many broadcast application scenario. DETAILED DESCRIPTION
[0049] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0050] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.
[0051] In audio and video and other data broadcasting application scenarios, the asynchronous playback of sound and picture will affect the viewing experience and reduce the user experience, so it is necessary to keep the audio and picture synchronized.
[0052] At present, in a one-to-one broadcast scenario, audio data and video data can be encoded, decoded, and transmitted in one channel to maintain playback synchronization. One-to-one broadcast means that both the source end and the playback end include only one device, and one device (source end) transmits data to another device (playback end) for playback. For example, as shown in Figure 1, the source end includes only one device A', and the playback end includes only one device B'. Device A' transmits audio and video to device B', and device B' plays the video and audio. In such a one-to-one broadcast scenario, the source end device encodes and transmits the video and audio in one channel, and the playback end decodes the video and audio and then broadcasts them. Since audio and video are encoded and transmitted in one channel, the corresponding relationship is one-to-one matching, that is, the playback timing of the audio frame and the corresponding image frame can be kept consistent, thereby eliminating the asynchrony caused by the audio and video transmission delay and the difference in audio and video frame processing time.
[0053] Web Real-Time Communication (WebRTC) is a technology that enables web browsers to conduct real-time voice or video chats. It provides solutions for real-time audio and video transmission, including audio and video acquisition, encoding and decoding, network transmission, and display. Audio and video acquisition is carried by distributed services. As shown in Figure 2, WebRTC provides functions including audio and video encoding and decoding, audio and video acquisition and rendering, transmission, flow control, and audio and video synchronization. The transmission protocol uses RTP / RTCP (Realtime Transport Protocol) / RTCP (Real-time Control Protocol). RTP packages media data, while RTCP provides QoS (Quality of Service) information feedback. The sender adds redundant information after encoding, and the receiver uses this redundant information to recover erroneous bits and mitigate bit errors during transmission. A flow control module is deployed on the sender. Based on QoS information fed back by the receiver, it calculates the appropriate sending rate and encoding bit rate for the sender. A jitter buffer is deployed on the receiver to mitigate jitter and out-of-order transmission of data packets.
[0054] As shown in Figure 2, in audio and video data transmission based on WebRTC technology, on the sending side, audio and video frames are encoded and then packaged using the RTP / RTCP protocol. After smoothing, the audio and video data packets are sent over a single transmission channel. On the receiving side, they are received over a single transmission channel and then decoded for audio and video, respectively. In this solution, audio and video data are transmitted over a single transmission channel.
[0055] In a one-to-one broadcast scenario, audio and video data can be transmitted between the source device and the playback device through a single transmission channel. Since there is only one device on the playback end, it is relatively easy to achieve synchronized audio and video playback. Therefore, the above-mentioned solution based on WebRTC can be applied to the one-to-one broadcast scenario.
[0056] However, distributed business scenarios often require cross-device broadcasting, such as one-to-many or many-to-one broadcasting. For example, if the playback end includes two or more devices, data transmission from one source device to two or more playback devices typically requires separate transmission channels. In this case, audio and video transmission solutions such as those based on WebRTC technology are unable to adapt to cross-device broadcasting or more complex distributed business scenarios.
[0057] In view of this, an embodiment of the present application proposes a synchronous playback method, which can achieve synchronous playback of streaming media data such as audio and video in cross-device broadcasting application scenarios, thereby solving the above problems.
[0058] The method provided in the embodiments of the present application can be applied to various application scenarios in which data is transmitted from a source end to a playback end for playback, such as video projection to a display device and / or audio projection to an audio playback device. For example, one typical application scenario of this method can be one-to-many broadcasting in a distributed business scenario. Furthermore, this method can also be applied to many-to-one broadcasting scenarios or many-to-many broadcasting scenarios.
[0059] In the embodiments of the present application, for clarity of description, the end that sends data is regarded as the source end, which includes at least one electronic device; the end that receives and plays data is regarded as the playback end, which includes at least one electronic device.
[0060] Among them, the device on the source side (such as the third device) can be an electronic device that can store data and support sending data, such as a mobile phone, a personal computer (PC) (such as a laptop), a tablet computer (Tablet Personal Computer, Tablet PC), a wearable electronic device (such as a smart watch, a bracelet, glasses, a collar), a smart speaker, a personal digital assistant (PDA), an augmented reality technology (AR) device, a virtual reality (VR) device, a robot, a smart toy, a learning machine, etc. The device on the playback side (such as the first device and the second device) can be an electronic device that supports playing at least one data format, such as supporting audio playback and / or video playback, and can specifically be a television, a smart screen, a set-top box, a mobile phone, a tablet computer, a personal computer, a wearable electronic device, an augmented reality technology device, a virtual reality device, a learning machine, a robot, and other products that support playing video, audio and other format data.
[0061] As shown in Figure 4, Figure 3 shows an example of a feasible product hardware architecture of an electronic device. Electronic device 300 may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an earphone interface 370D, a button 390, a motor 393, an indicator 392, a display 393, and a subscriber identification module (SIM) card interface 394.
[0062] It should be understood that the structure illustrated in the embodiment of the present invention is merely an example and does not limit the electronic device 300. The electronic device in the embodiment of the present application may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0063] For example, the electronic device on the source side may only include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, etc.
[0064] The electronic device on the playback side, taking an audio playback device as an example, may only include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a button 390, a display 394, etc. Taking a video playback device as an example, it may only include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, a display 394, etc. Optionally, it may also include an audio module 370, a speaker 370A, a button 390, etc.
[0065] Specifically, the processor 310 may include one or more processing units. For example, the processor 310 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors. The controller may generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0066] Processor 310 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 310 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 310. If processor 310 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 310 latency, and thus improves system efficiency.
[0067] In some embodiments, the processor 310 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0068] The USB interface 330 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 330 can be used to connect a charger to charge the electronic device 300, or to transfer data between the electronic device 300 and other devices, such as from a source device to a playback device. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.
[0069] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 300. In other embodiments of the present application, the electronic device 300 may also adopt a different interface connection method from the above embodiment, or a combination of multiple interface connection methods.
[0070] The charging management module 340 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 340 can receive charging input from the wired charger via the USB interface 330. In some wireless charging embodiments, the charging management module 340 can receive wireless charging input via the wireless charging coil of the electronic device 300. While charging the battery 342, the charging management module 340 can also provide power to the electronic device via the power management module 341.
[0071] The power management module 341 is used to connect the battery 342, the charging management module 340, and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340 and provides power to the processor 310, the internal memory 321, the display 394, the camera 393, and the wireless communication module 360. The power management module 341 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 341 can also be set in the processor 310. In other embodiments, the power management module 341 and the charging management module 340 can also be set in the same device.
[0072] The data transmission function of the electronic device 300 can be implemented through the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, the modem processor and the baseband processor.
[0073] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 300 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0074] The mobile communication module 350 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 300. The mobile communication module 350 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the processor 310. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the same device as at least some of the modules of the processor 310.
[0075] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 370A, the receiver 370B, etc.) or displays an image or video through the display screen 394. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 310 and be provided in the same device as the mobile communication module 350 or other functional modules.
[0076] The wireless communication module 360 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 300. The wireless communication module 360 can be one or more devices that integrate at least one communication processing module. The wireless communication module 360 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 310. The wireless communication module 360 can also receive the signal to be sent from the processor 310, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0077] In some embodiments, antenna 1 of electronic device 300 is coupled to mobile communication module 350, and antenna 2 is coupled to wireless communication module 360, so that electronic device 300 can communicate with a network and other devices via 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), wideband 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. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0078] Electronic device 300 implements display functionality through a GPU, display screen 393, and an application processor. The GPU is a microprocessor for image processing that connects display screen 393 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 310 may include one or more GPUs that execute program instructions to generate or modify display information.
[0079] Display screen 393 is used to display images, videos, etc. Display screen 393 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 (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 300 may include three or N display screens 393, where N is a positive integer greater than three.
[0080] The electronic device 300 can implement the video playback function through a video codec, a GPU, a display screen 393 and an application processor.
[0081] The 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 300 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0082] Video codecs are used to compress or decompress digital video. Electronic device 300 may support one or more video codecs. This allows electronic device 300 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 3, MPEG2, MPEG3, and MPEG4.
[0083] Optionally, the NPU is a neural network (NN) computing processor that rapidly processes input information and continuously self-learns by drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain. The NPU can enable applications such as intelligent cognition of the electronic device 300, such as intelligent identification of data types in a data stream.
[0084] The external memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 300. The external memory card communicates with the processor 310 via the external memory interface 320 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0085] The internal memory 321 can be used to store computer executable program codes, which include instructions. The internal memory 321 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 300 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 321 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 310 executes various functional applications and data processing of the electronic device 300 by running instructions stored in the internal memory 321 and / or instructions stored in a memory provided in the processor.
[0086] The electronic device 300 can implement audio functions, such as music playback, through the audio module 370 , the speaker 370A, the receiver 370B, the microphone 370C, the headphone jack 370D, and the application processor.
[0087] The audio module 370 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 370 can also be used to encode and decode audio signals. In some embodiments, the audio module 370 can be provided in the processor 310, or some functional modules of the audio module 370 can be provided in the processor 310.
[0088] The speaker 370A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 300 can listen to music or listen to hands-free calls through the speaker 370A.
[0089] The receiver 370B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 300 receives a call or a voice message, the user can place the receiver 370B close to the ear to hear the voice.
[0090] Microphone 370C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 370C to input the sound signal into the microphone 370C. The electronic device 300 can be provided with at least one microphone 370C. In other embodiments, the electronic device 300 can be provided with two microphones 370C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 300 can also be provided with three, four or more microphones 370C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.
[0091] The headphone jack 370D is used to connect a wired headphone. The headphone jack 370D can be a USB interface 330 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0092] The buttons 390 include a power button, a volume button, and the like. The buttons 390 may be mechanical buttons or touch buttons. The electronic device 300 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 300.
[0093] Motor 391 can generate vibration prompts. Motor 391 can be used to indicate successful data transmission or for playback feedback. For example, whether data transmission is successful can correspond to different vibration feedback effects. Different playback situations (for example: synchronous playback, video ahead of audio, audio ahead of video, etc.) can also correspond to different vibration feedback effects. Touch vibration feedback effects can also support customization.
[0094] Indicator 392 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0095] The SIM card interface 394 is used to connect a SIM card. The SIM card can be connected to and disconnected from the electronic device 300 by inserting it into or removing it from the SIM card interface 394. The electronic device 300 can support 3 or N SIM card interfaces, where N is a positive integer greater than 3. The SIM card interface 394 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 394 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 394 can also be compatible with different types of SIM cards. The SIM card interface 394 can also be compatible with external memory cards. The electronic device 300 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 300 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 300 and cannot be separated from the electronic device 300.
[0096] The following is an illustrative description of typical application scenarios involved in this application.
[0097] One-to-many broadcasting means that the source end includes only one device, while the playback end includes two or more devices. Data is transmitted from the source end to the two or more playback devices through two or more transmission channels, and then played separately. For example, as shown in Figure 4(a), device A is the source device, and devices B and C are the playback devices. Device A transmits audio data (sound) through one transmission channel to device B, which plays the audio. It transmits video data (image) through another transmission channel to device C, which plays the video.
[0098] The number of devices included in the playback end can be greater than 2. Figure 4(a) only shows the case where the number of devices is 2. In actual applications, the number of devices on the playback end can be 3 or more. For example, as shown in Figure 4(b), the playback end can include device B, device C, and device D. Device A transmits data to device B and device D through three transmission channels. Device B can be a speaker for playing audio; device C and device D are both display screens, respectively used to display different parts of the same picture, and the two display screens are spliced to display the complete image. For another example, as shown in Figure 4(c), the playback end can include device C, device D, device D, and device E. The data on the device A side is transmitted to device B and device E through four transmission channels. Device C and device D are both speakers, respectively used to play the left and right channels. Device D and device E are both display screens, used to splice and display the complete image in the video frame.
[0099] In addition, the data transmitted from the source end to the playback end through different transmission channels can be different types of data or the same type of data. For example, as shown in Figure 4(d), both transmission channels transmit video data (images). For example, device B and device C are both display screens, and the two are used to splice and display a complete image; or the two are used to independently display the same complete image, but are placed in different positions within the application scenario for multi-perspective viewing. As shown in Figure 4(e), both transmission channels transmit audio data (sound). Device B and device C are both speakers. One transmission channel transmits left channel data, and the other transmission channel transmits right channel data. Similarly, the number of devices on the playback end can be more than 3, and is not limited to 2.
[0100] In practical application scenarios, as shown in Figure 5(a), in a distributed business scenario, a one-to-many broadcast can be performed. The source device can be a mobile terminal device 501, such as a mobile phone or tablet computer. The playback end includes a display screen 502 and an audio playback device 503, such as a smart screen or TV. The audio playback device can be a speaker, smart assistant, or a robot with audio playback function. For example, the phone transmits audio to the speaker for audio playback and transmits video to the display screen for video playback.
[0101] For example, as shown in Figure 5(b), one-to-many broadcasting can also involve mobile terminal 504 transmitting images to display devices 5051-5054 via four transmission channels. Display devices 5051-5054 each display a portion of the image, and the four display devices are spliced together to display the complete image on a large screen. The relative delay between audio and video playback is only noticeable when it exceeds a certain level. For example, a relative delay of -185 to 90 milliseconds is allowed for the synchronous playback of audio and video. When a large, complete image is displayed through four display devices, since the image played on each device is compared with the images of the other three devices, the asynchrony between the images is more obvious through comparison. Therefore, the accuracy of synchronization control in this scenario needs to be higher than that of synchronous playback control in the audio and video scenarios. In this scenario where multiple images are spliced together to complete the image, the allowable delay time is shorter. For example, the relative delay time may need to be controlled below the inter-frame interval, such as within 33ms or 16.7ms.
[0102] For another example, as shown in the one-to-many broadcast scenario in Figure 5(c), it can also be a smart wearable device 506 that transmits audio to the left channel 507 and right channel 508 of the car audio system respectively. For example, the smart wearable device is a smart watch, which transmits audio to different channel devices of the car audio system based on the streaming media transmission protocol. This application scenario can be that during the driving of a car, motorcycle, or electric car, a function key or button for one-click broadcasting is set on the smart watch, and the driver can broadcast audio with one click and play music through the car speakers. It should be noted that the method provided in the embodiment of the present application does not limit the data transmission channel, and can therefore be used to solve various distributed business scenarios in which smart terminals (such as watches, mobile phones, etc.) broadcast audio to car audio systems. In comparison, in related solutions, taking Bluetooth transmission as an example, in the connected working mode, multiple CIS (Connected Isochronous Streams) need to belong to the same channel group CIG (Connected Isochronous Groups). In order to achieve synchronous processing, the CIG will give each CIS different delay parameters, allowing them to be processed synchronously after their respective time periods. Among them, the CISs within the same CIG have the same timestamp. In the non-connected working mode, multiple BIS (Broadcast Isochronous Streams) must belong to the same broadcast group (BIG). This shows that the relevant scheme requires that data streams belong to the same channel group or the same broadcast group, which places restrictions on the channels for data transmission. However, the method provided in the embodiment of the application is not subject to this restriction.
[0103] For another example, as shown in Figure 5(d), in a one-to-many broadcast scenario, the source device may be a smart wearable device 509, and the playback device may include a mobile terminal 512, such as a smartphone, in addition to the car audio system 510 and 511. For example, the smart wearable device is a smartwatch. While the user is driving, the smartwatch monitors the user's heart rate and other data, generates a video format file that can dynamically display the heart rate data and supports display on the mobile terminal. It also generates a voice prompt accompanying the heart rate data, transmits the video format data in real time to the bound mobile phone for display, and transmits the voice prompt to the car audio system for playback. For example, when the video displays an abnormal heart rate, the car audio system will play a voice announcement, such as "Your heart rate has been detected to be abnormal. It is recommended that you stop and rest or seek help as soon as possible." The synchronization in this scenario has lower control accuracy for synchronized playback than the scenario shown in Figure 5(a), and the playback delay of the voice relative to the video can be less than 2s.
[0104] Many-to-one broadcasting scenario, that is, the source end includes different devices, and the playback end includes only one device, and the data is transmitted from different devices on the source end to the playback end through two or more transmission channels for playback. For example, as shown in Figure 6(a)-Figure 6(c), device B and device C transmit video data (image) and audio data (sound) to device A respectively through different transmission channels, and play through device A. Alternatively, device B and device C transmit the image to device A respectively through two transmission channels for playback. Alternatively, device B and device C transmit the left channel and right channel of the sound to device A respectively through two transmission channels for playback. Similarly, the number of devices included in the source end can be greater than 2, and is not limited to 2.
[0105] Optionally, the software environment for implementing the method provided in the embodiments of the present application can be a distributed operating system, such as one implemented based on the distributed operating system HarmonyOS. For example, a distributed hardware management framework can be deployed in the distributed operating system, and the distributed hardware management framework can be used to provide information management capabilities for distributed hardware subsystems.
[0106] In an embodiment of the present application, the transmission channel may be one or more of various channels that can realize point-to-point data transmission based on a transmission medium. For example, optionally, the transmission channel may be a channel, a data link, etc.
[0107] Exemplarily, data transmission between devices can be implemented based on one or more wireless projection protocols such as Miracast, DNLA (Digital Living Network Alliance), WiDi (Intel WirelessDisplay, wireless high-definition technology), and AirPlay.
[0108] It should be noted that, in the embodiments of the present application, the data to be broadcast may be in various data formats that support playback on a playback device, for example, streaming media data mainly composed of audio and video data, and the streaming media data may include one or more data streams such as sound streams, video streams, text streams, picture streams, and animation streams. For example, in some embodiments, the data to be broadcast may be audio and / or video data, for example, broadcasting two or more audio channels, or broadcasting two or more video channels, or broadcasting at least one audio channel and at least one video channel.
[0109] The video data may be in one or more video formats such as MPEG (Moving Pictures Experts Group), AVI (Audio Video Interleave), WMV (Windows Media Video), QuickTime, RealVideo, Flash, Mpeg-4, and newAVI. The audio data may be in one or more audio formats such as MP3 (Moving Picture Experts Group Audio Layer III), WMA (Windows Media Audio), AAC (Advanced Audio Coding), WAV (WAVE form audio format Sound), and APE (Monkey's Audio).
[0110] The data to be broadcast can also be a media file, which is not limited to containing only one stream type, and may contain video, audio, subtitles, or even multi-channel video, multi-channel audio (multi-channel), dual subtitles, etc.
[0111] In other embodiments, it is not excluded that the broadcast data may be a combination of audio data and / or video data and data in formats such as documents and pictures. The following explanation will be given using audio data and video data as examples.
[0112] The synchronous playback method provided by the embodiment of the present application, in a one-to-many broadcast scenario, uses the playback time of the streaming media on one of the multiple devices at the playback end (the first device) as a reference to control the playback of the streaming media on other devices at the playback end, thereby achieving playback synchronization between multiple devices at the playback end. The playback time used as a reference can be the actual playback time, or it can be an estimated playback time estimated by combining the transmission delay and decoding delay corresponding to the first device. For example, a playback time difference can be obtained based on at least the actual playback time of each data frame on one of the devices at the playback end and the playback timestamp of each data frame to be played by other devices, and the playback of the data frames to be played on other devices can be adjusted based on the playback time difference to achieve synchronization. Alternatively, the estimated playback time of each data frame on one of the devices at the playback end is used as a reference to obtain the estimated playback time of the data frames to be played on other devices when synchronization is possible, and a timestamp corresponding to the estimated playback time is added to each data frame before transmitting the data, thereby guiding other devices at the playback end to perform playback control according to the estimated playback time to achieve synchronization.
[0113] In a many-to-one scenario, after clock synchronization between multiple devices on the source side and one device on the playback side, the synchronization information is set in the frame header through the business layer settings and reserved in the control center to achieve synchronization in the many-to-one scenario.
[0114] The following describes how to achieve synchronized playback between different devices in a one-to-many broadcast scenario.
[0115] In the embodiment of the present application, for a one-to-many broadcast scenario, at least two solutions are proposed to achieve playback synchronization between different devices at the playback end. These two solutions can be implemented independently or in combination.
[0116] In the first solution, the actual playback time of one of the devices on the playback end is used as a reference time to control the playback time of other devices to achieve synchronization.
[0117] In the second solution, before sending data, the source end will obtain an estimated playback timestamp based on information such as transmission delay and decoding delay feedback from one of the playback devices. Other devices on the playback end can directly compare the estimated playback timestamp with the current time to control playback and achieve synchronization.
[0118] For example, taking a one-to-two broadcast scenario as an example, Figure 7 shows the system architecture under the one-to-two broadcast scenario. The system architecture includes a source end and a playback end. Device A at the source end performs video encoding on the image frame data stream and audio encoding on the audio frame data stream in two ways, and then transmits them to devices B and C at the playback end through two transmission channels respectively. After device B performs video decoding, it is sent to the image display module, and the video image is displayed through a distributed screen. After device C performs audio decoding, it is sent to the sound playback module, and the sound is played through distributed audio.
[0119] In this scenario, audio and video are encoded and transmitted separately through different transmission channels. On the one hand, the data processing processes such as audio and video encoding and decoding take different amounts of time. On the other hand, the communication status may vary when transmitted through different transmission channels, and network jitter may cause the start time to become more random. Therefore, when audio and video are separated, it is more difficult to synchronize the playback timestamps between different devices.
[0120] For example, the first solution is described using the system architecture shown in FIG7 :
[0121] The PTS (Presentation Time Stamp) corresponding to the audio or video frame obtained after decoding on the playback end is the original timestamp generated by the source encoder, not the actual playback time. Therefore, it is necessary to know the actual playback time of each frame data on one of the devices and achieve synchronization between multiple devices based on the actual playback time.
[0122] Taking the example of two transmission channels transmitting data streams, namely audio data stream and video data stream, in this case, considering that people have different sensitivities to images and sounds, and are often more sensitive to audio than video, after the audio playback device at the playback end receives the audio data stream and the cache reaches a certain length, the audio frame can be played normally first, and then the actual playback time of the audio frame is used as a reference to adjust the playback of the video frame on the video playback device to achieve synchronization of audio and video.
[0123] Specifically, as shown in FIG8 , the audio and video synchronization modules are deployed in the distributed hardware subsystems of the source device and the playback device respectively, and the audio and video synchronization modules on different devices play different roles.
[0124] In some embodiments, the source device A is added with a first audio-visual synchronization module, which includes at least a multi-channel management module; the playback device B is added with a second audio-visual synchronization module, which includes at least a frame rate control module; and the playback device C is added with a third audio-visual synchronization module, which includes at least a delay feedback module.
[0125] Optionally, since the video and audio processing processes take different amounts of time, a data cache module can be added to the audio and video synchronization module on the playback end to ensure smooth playback and offset the impact of uneven packet transmission and reception caused by network jitter. In some embodiments, the data cache module may not be set.
[0126] Exemplarily, the second audio-visual synchronization module includes a first state feedback module, a first data buffer module, and a frame rate control module. The third audio-visual synchronization module includes a second state feedback module, a second data buffer module, and a delay feedback module.
[0127] In other embodiments, the second audio-visual synchronization module and the third audio-visual synchronization module may not be provided with a data cache module, or the first state feedback module and the frame rate control module may be integrated into the same module, or the second state feedback module and the delay feedback module may be integrated into the same module. On the premise of realizing the corresponding functions, a variety of specific module settings can be obtained through formal changes, which are not listed one by one in this application specification.
[0128] Similarly, in a specific implementation, the synchronization policy management, multi-channel management module and status monitoring module in the source device can also be integrated into the same module or into two modules for implementation. For example, the synchronization policy management and multi-channel management are integrated into a management module, or the status monitoring module and the synchronization policy management are integrated into the same module, or the synchronization policy management, multi-channel management and status monitoring modules are integrated into the same module, and so on. Other specific implementation methods will not be described in detail in this application specification.
[0129] The synchronization strategy management module determines the synchronization strategy based on the type of data to be played.
[0130] The synchronization policy management module can deploy a policy library or set up an interface to access the policy library. The policy library stores synchronization policies corresponding to various data types. Data types include information about the data formats to be played on different devices. For example, the data to be played may contain only audio data, only video data, both audio and video data, or other formats in addition to audio and video data.
[0131] Human hearing is more sensitive than vision to delays and freezes, and generally, normal audio output is maintained as much as possible. In some embodiments, for data types containing audio data and video data, the synchronization strategy adopted is to prioritize audio and subordinate video, that is, the audio frame playback is used as a reference, and the video frame playback progress follows the audio frame.
[0132] In the case where two or more data streams are both video, or two or more data streams are both audio, one device can be selected from multiple devices on the playback end as the master, and the other devices as slaves.
[0133] The following mainly uses one channel of audio data and one channel of video data as an example for exemplary description. For other data types, the corresponding synchronization strategies can be adaptively obtained by referring to the exemplary description.
[0134] The video playback device (Device B) uses the first status feedback module to identify that the data type of the data stream currently being played is video, monitors the connection status of the transmission channel between Device A and Device B, and feeds the data type and connection status information back to the status monitoring module in Source Device A. Similarly, the audio playback device (Device C) uses the second status feedback module to identify that the data type of the data stream currently being played is audio, monitors the current connection status of the transmission channel, and feeds the data type and connection status information back to the status monitoring module in Source Device A.
[0135] The status monitoring module in device A first determines whether to continue data transmission based on the transmission channel connection status information provided by devices B and C. The transmission channel connection status refers to the communication status of the transmission channel, specifically whether data can be sent normally. For example, if the connection status information indicates that communication is disconnected, then synchronous playback of subsequent data is obviously impossible. In this case, the system can wait for communication to resume, pausing playback on each device and notifying the user of the network disconnection or playback failure. After the transmission channel resumes normal communication, the corresponding synchronization strategy can be implemented.
[0136] When the connection status shows that the communication is normal, the status monitoring module updates the data type information of the current data to be played in real time based on the data type information of the two data streams fed back by device B and device C, and inputs it into the synchronization strategy management module.
[0137] Different data types may require different synchronization strategies. For example, if one channel is audio and the other is video, the specific synchronization strategy may differ from if both channels are video. Therefore, the source device must first understand the type of data to be played, and then use the synchronization strategy management module to determine the synchronization strategy that corresponds to the data type.
[0138] After the synchronization strategy is determined, the synchronization strategy management module triggers the corresponding synchronization strategy, for example, triggering the multi-channel management module to receive the actual playback time information of each audio frame sent by device C.
[0139] To reduce the number of information transmissions between the playback device and the source device, device C can proactively provide feedback on the actual playback time of audio frames to device A through the latency feedback module. For example, the actual playback time of the mth audio frame just played is recorded as m_clock and sent to device A.
[0140] After receiving m_clock, device A immediately forwards it to device B.
[0141] Device B uses the frame rate control module to compare the actual playback time m_clock of the received audio frame with at least the playback timestamp (Vpts) of the corresponding video frame, and controls the playback progress of the video frame according to the comparison result.
[0142] Optionally, a first data cache module is used to cache video data, smoothing out codec latency and network jitter. The video frames in the queue serve as input to the frame rate control module. A second data cache module caches audio data, smoothing out the effects of codec latency and network jitter on playback time.
[0143] As shown in Figure 8, the audio playback device (device C) obtains the actual playback time m_clock of the audio frame through the delay feedback module, and feeds the actual playback time back to the multi-channel management module of the source device A. The multi-channel management module then feeds back m_clock to the frame rate control module of the video playback device (device A).
[0144] As shown in Figure 10, as an implementation method, in the audio playback device, each time an audio frame is played, the delay feedback module writes the actual playback time of the played frame into the master clock m_clock. Of course, in other embodiments, the actual playback time of each audio frame in these audio frames can be written at once after playing several audio frames to reduce the delay caused by frequent writing. Or, the actual playback time of only one audio frame is written after every few audio frames. For example, the actual playback time of only one audio frame is written in every two audio frames.
[0145] As shown in Figure 9, in a distributed business scenario, there is no transmission channel for direct communication between different devices on the playback end. It is difficult for the video playback device to obtain the actual playback time information of the audio frame on the audio playback device. If the audio playback device and the video playback device are directly allowed to directly perform delay feedback, it is necessary to establish a corresponding transmission channel, or to forward twice through the source end. For example, the video playback device first needs to send a request, which is a single forwarding, and then the audio playback device feeds back the playback time information, which generates a secondary forwarding. New links or secondary forwarding will cause greater link pressure. Therefore, in some embodiments of the present application, the delay feedback module of the audio playback device actively sends audio playback time information to the source end, and the source end forwards the audio playback time information to other devices. After one forwarding, other devices can obtain the audio playback time information of the audio playback device, thereby reducing link pressure.
[0146] It should be noted that in other embodiments, it is not excluded to establish a transmission channel between the video playback device and the audio playback device or to forward the information twice by the source end so that the video playback device and other devices can obtain the audio playback information.
[0147] After the video playback device obtains the actual playback time of the audio frame, the frame rate control module takes an image frame from the cache queue, reads the playback timestamp Vpts of the image frame, and calculates the playback time difference diff based on at least Vpts and m_clock.
[0148] As shown in FIG10 , after the frame rate control module calculates the diff, it determines a processing strategy for the current video frame to be played based on the diff, such as whether to continue waiting, perform frame drop processing, or directly display the video frame.
[0149] Optionally, in some embodiments, the frame rate control module takes out a frame of image from the cache queue, which may be a frame of image taken out at fixed intervals according to the set frame rate (Frame Rate). The interval time t0 is determined according to the frame rate Fr, t0 = n*1 / Fr, n is an integer equal to or greater than 1, and n is used to control the proportion of video frames taken out from the cache queue. If n = 1, it is equivalent to taking out frame by frame from the cache queue, and each video frame in the cache queue must calculate the playback time difference diff to determine whether to send it for display, whether to drop the frame, etc.; n = 2, which means taking out one frame from every two frames in the cache queue to calculate the playback time difference diff; n = 3, which means taking out one frame from every three frames in the cache queue to calculate the playback time difference diff. The larger n is, the lower the synchronization control accuracy, and the synchronization effect may decrease as the value of n increases. In some embodiments, n ≤ 3.
[0150] For example, if n = 1 and the frame rate is 30 fps (frames per second), then t0 = 1*1 / 30 ≈ 0.033s ≈ 33ms. This means that a frame is retrieved from the cache queue every 33ms, effectively taking it out frame by frame. The time difference between each frame and the audio frame is calculated to determine whether to display it. If the frame rate is 60 fps, then t0 = 1*1 / 60 ≈ 0.017s ≈ 16.7ms, meaning a frame is retrieved from the cache queue every 16.7ms.
[0151] It should be noted that the next video frame currently retrieved may not be two data frames that need to be played synchronously with the currently received m-th audio frame. Therefore, the difference calculation for the purpose of obtaining the playback time difference should be based on the audio frame and video frame with a mapping relationship. Video frames and audio frames with a mapping relationship refer to audio frames and video frames that present a synchronous playback effect in the playback timing, and are considered to have a mapping relationship. Specifically, the mapping relationship can be determined based on at least one of the playback timestamp PTS and the sequence number.
[0152] Because video and audio frame rates are generally different, for example, if device C writes a clock signal for each audio frame played, the frequency of the clock signals sent may be the same as or similar to the frame rate. For example, if the audio frame rate is 50 fps, a clock signal is sent every 20 ms. For example, the actual playback time of the m+1th audio frame is m+1_clock. On a video playback device, for example, if the video frame rate is 30 fps, a frame is retrieved from the cache queue every 33 ms. Therefore, the frequency of video frame retrieval and the frequency of clock reception are different.
[0153] The comparison operation to determine whether a mapping relationship exists can be triggered by extracting a video frame. That is, each video frame is extracted and the mapping relationship is identified with the most recently received clock. For example, the serial number is read and the mapping relationship is determined based on the serial number. This requires the source device to add not only the PTS but also the serial number.
[0154] As an implementable embodiment, in addition to adding a serial number or PTS, a serial number or PTS having a mapping relationship with the current audio and video frame or audio frame can also be recorded. That is, in some embodiments, the serial number or PTS of other data frames having a mapping relationship with the current data frame can be recorded for each data frame or every few data frames. In this way, there is no need to perform difference calculation on the playback end, and the serial number or PTS with a mapping relationship can be directly read to know whether there is a mapping relationship.
[0155] For example, before sending the video data stream, device A adds a serial number in addition to Vpts to each video frame, and adds information about other serial numbers that are mapped to it. This information can be added in the form of an array. For example, if the serial number of the current video frame is 80, and the serial numbers of at least one audio frame that is mapped to it are 98 and 99, respectively, then the added serial number array can be [80:98,99], where 80 represents the serial number of the video frame itself, and 98 and 99 represent the serial numbers of the two audio frames that are mapped to the video frame. On the playback end, after the audio data stream packet and the video data stream packet are decoded, the serial number or serial number array corresponding to each data frame can be read.
[0156] In addition, as another possible implementation method, PTS is used to indicate the playback timing, which is actually a kind of sequence information itself. Therefore, it is not ruled out that the mapping relationship between audio frames and video frames can be determined by the playback timestamp PTS. The source end will encode before sending data. Most encoders will generate a playback timestamp PTS for each frame during encoding. This timestamp is used to mark the playback order of each frame. Based on this playback order, the mapping relationship between video frames and audio frames can be determined. That is, the mapping relationship is determined based on Vpts and Apts (Audio Presentation Time Stamp, audio playback timestamp).
[0157] For example, before sending data, the source device adds a playback timestamp (PTS) to each data frame. Generally, due to the different sampling rates of video and audio frames, video frames and audio frames do not have a one-to-one mapping relationship. Assuming that audio is sampled at 20ms per frame and the video frame rate is 30fps, that is, one frame is generated every 33ms, and assuming that the timestamp at the start of audio acquisition is 80, then the PTS of video and audio frames generally increase in the following order: video frame VPTS: 109, 142, 175, 208, 241, 274...; audio frame APTS: 80, 100, 120, 140, 160, 180... On the playback end, if it can be determined that the PTS clock frequency is consistent with the time reference standard (such as Greenwich Mean Time), the mapping relationship between audio frames and video frames can be directly determined by calculating the difference in timestamps. Alternatively, the desired playback time information can be obtained based on the playback order represented by the playback timestamp, combined with information such as the time base time_base or clock frequency (crystal frequency). Based on the desired playback time information, the mapping relationship between the audio frame and the video frame can also be determined.
[0158] For example, audio frames and video frames whose PTS difference is less than a predetermined mapping threshold are considered to have a mapping relationship. For example, the specified threshold can be 33. For example, in the above sequence, the PTS of the first audio frame is 80, and the PTS of the first video frame is 109. If the difference is less than 33, then the two are considered to have a mapping relationship. The mapping threshold is not unique. For example, if the video frame rate is 60 fps, the mapping threshold can be 20.
[0159] It should be noted that in this embodiment, device C is required to feedback the original Apts of the audio frame at the same time as the actual playback time clock. That is, the information used to send the clock includes Apts. In this way, the video playback device can first read the Apts of the audio frame and compare Vpts with Apts. If the difference between VPts and Apts is less than 33ms after conversion to time information, it is considered that the two are mapped.
[0160] In actual applications, it's possible that the next video frame currently retrieved from the cache queue doesn't map to the most recently received m_clock. In this case, the sequence number or PTS can be used to determine the order of the audio frame mapped to the currently retrieved video frame relative to the currently received m_clock. Both sequence numbers and PTSs convey playback order information. Therefore, even if the mapping can't be determined, comparing the sequence numbers or PTSs of video and audio frames can still identify the order. If the mth audio frame currently received should be played before the currently retrieved video frame, meaning the audio frame that should have played synchronously with the current video frame is after the mth audio frame, the video playback device can wait for the next audio frame. If the mth audio frame should be played after the currently retrieved video frame, the device can search multiple received clocks for an audio frame mapped to the current video frame, read its actual playback time, and then calculate the difference.
[0161] It should be noted that PTS is added by the source end to indicate the relative order of the playback timing of each data frame, but it is not the actual playback time. Therefore, Vpts and Apts can be used to determine the mapping relationship, but cannot be directly used for synchronization control.
[0162] It should be noted that the above serial number is different from the presentation time stamp PTS (Presentation Time Stamp) and cannot be understood as an equivalent technical concept of the presentation time stamp PTS.
[0163] Assuming a mapping relationship exists between the nth video frame and the mth audio frame retrieved from the cache queue, the following describes how to calculate the playback time difference diff. The following calculations are all performed based on the mapped audio and video frames, and for the sake of brevity, they will not be repeated.
[0164] Optionally, as a feasible implementation, in some embodiments, the play time difference diff can be determined based on Vpts and m_clock, for example: diff = Vpts - m_clock
[0165] Where m_clock represents the actual playback time of the mth audio frame. Each time an audio frame is played, the timestamp of the playback frame is written to the master clock. Vpts is the playback timestamp of the nth frame retrieved from the video cache queue.
[0166] Optionally, as another feasible implementation, in another part of the embodiments, factors such as post-processing duration may be introduced into the determination of the playback time difference diff.
[0167] For example, diff can be calculated as follows: diff = Vpts - m_clock + (Y3 - X3)
[0168] Among them, X3 is the post-processing duration corresponding to the video (second processing duration), and Y3 is the post-processing duration corresponding to the audio (first processing duration).
[0169] For example, X3 can represent the time corresponding to the process of drawing, rendering, composing and displaying a frame of image, that is, the total execution time of multiple threads such as drawing, rendering, image frame composition and image frame display corresponding to a frame of image. This time can be obtained by calculating the time consumed by each thread node. For example, X3 = T1 + T2 + T3 + T4, where T1 is the drawing time, T2 is the rendering time, T3 is the image frame composition time, and T4 is the image frame display time. An image frame is a video frame.
[0170] In an embodiment where video playback is performed through WMS (Window Manager Service), WMS is used to provide image rendering services, etc., and X3 can be understood as the time from image drawing and rendering to final display after the image is sent to WMS. X3 can be obtained by accessing WMS.
[0171] Exemplarily, Y3 can be understood as the time from when the audio data is sent to the audio framework, through the audio driver to when it is finally played out, which can be obtained by calculating the time consumed by each thread during the audio playback process. Specifically, as an implementable method, Y3 can be obtained by accessing the audio framework.
[0172] For example, Y3=T5+T6+T7+T8+T9+T10, where T6 to T10 represent the duration of mixing processing, sound effect processing, volume processing, sending to the driver, sending to the DSP (Digital Signal Processor), and speaker playback, respectively.
[0173] Exemplarily, the duration of a single thread can be obtained as follows: when the thread starts running, the system time is obtained as the start time. After the thread finishes running, the system time is obtained again at the end of the thread. This time minus the start time is the operation time. Record a start time and an end time. The subtraction of the two is the program running time. In an embodiment of the present application, the post-processing process of video and audio may include multiple threads. Optionally, the start time of the first thread to perform the corresponding operation can be used as the start time. After the last thread finishes executing, the system time is obtained again. The two are subtracted to obtain the running time of multiple threads as the post-processing duration. For example, when the drawing thread starts to execute the drawing action, the system time is recorded as the start time, and then when the image frame starts to be displayed, it is recorded as the end time. The two are subtracted to obtain X3. For example, as shown in Figure 11, X3=t3-t1.
[0174] It should be noted that due to differences in operating systems and hardware devices, the audio and video post-processing processes may differ. The above descriptions are merely illustrative. For example, rendering is not a necessary step in video post-processing and is unnecessary if the device hardware is sufficiently powerful. Similarly, sound effects processing and volume control are optional in actual applications.
[0175] In application scenarios where the processing flow differs from the above example, the post-processing duration can be understood as the length of time from when a video or audio frame is confirmed to be sent for broadcast to when it is actually played. As an implementation method, the system time can be recorded when the broadcast is confirmed as the start time, and the start time of playback can be used as the end time to obtain Y3 or X3.
[0176] When the delivery time is difficult to determine, a more universal method for determining the post-processing duration is to extract the video or audio frame from the cache queue as the starting time and the actual playback of the video or audio frame as the ending time, thereby obtaining X3 or Y3. In other words, the post-processing duration (such as the first processing duration or the second processing duration) can be an estimate of the processing time from the time a data frame is extracted from the cache queue to the time it is played.
[0177] It should be noted that Y3 and X3 can be constants determined by statistically averaging multiple played video or audio frames. They can be written into the program as fixed parameters, and there is no need to calculate the post-processing duration before each frame is played. For example, in the SRS (simple Rtmp Server) 4.0 code architecture, Y3 = 40ms. When calculating diff, Y3 is a fixed constant of 40ms.
[0178] It should be noted that the above-mentioned implementation method for determining X3 and Y3 is only an example. More generally, X3 can be the time length determined by taking out the video frame from the cache queue as the starting moment and playing it as the end moment, and Y3 can be the time length determined by taking out the audio frame from the cache queue as the starting moment and playing the audio frame as the end moment.
[0179] In the embodiments of the present application, the timestamps used to calculate the diff, such as Vpts or Apts, can be converted to time. Due to differences in encoding and decoding formats, in some encoding and decoding formats, the timestamps Vpts or Apts may be represented as a series of numerical values to inform the playback end of the relative playback order of each frame, and cannot directly represent time. Therefore, it is necessary to convert the timestamp to time and then use the above calculation formula to calculate the diff.
[0180] For example, the PTS values for multiple video frames in a video are: 480 640 560 520 600 800 720 680 760 960. These values do not represent time. In FFmpeg, the PTS values must be converted into time information based on the respective time bases (time_base) of the audio and video, and then calculated using the above formula. For example, the playback time of an audio frame, Tv, = time_base * PTS, where time_base represents the time scale corresponding to the value 1 in the PTS.
[0181] After obtaining the diff, the playback control strategy for the currently retrieved video frame is determined based on the diff. The playback control strategy may include sending to display, waiting, dropping frames, reducing the playback rate, increasing the playback rate, etc.
[0182] When playing video and audio together, if the playback time difference is within a certain threshold, the human senses will not noticeably detect the asynchrony, so the sense of lag is not obvious and does not reduce the audio-visual experience. However, if the playback time difference exceeds a certain threshold, more noticeable lag may occur, reducing the audio-visual experience. In the embodiment of the present application, a certain delay can be allowed for the synchronization of audio and video playback, and the delay must be within an acceptable range.
[0183] In the embodiment of the present application, the playback control strategy for the current video frame is determined by comparing diff with a predetermined threshold range (first threshold interval).
[0184] For example, min is set as the maximum threshold for audio to lag behind video, and max is set as the maximum threshold for audio to lead video. Optionally, a feasible playback control strategy may be:
[0185] If diff < min, it means the video frame is faster than the audio frame. At this time, the video frame needs to wait for a few milliseconds to wait for the master clock. For example, the waiting time can be (min - diff) milliseconds.
[0186] If diff > max, it means the video frame is slower than the audio frame. At this time, the video frame needs to catch up. The catching-up strategy can be discarding video frames, or increasing the playback rate, etc.
[0187] If min ≤ diff ≤ max, it means within the synchronization threshold range, no obvious asynchrony will occur, and the video frame can be directly sent for display.
[0188] Optionally, the value of min can specifically be -190 ms to -180 ms, and the value of max can be 85 ms to 95 ms.
[0189] The following lists a specific embodiment to exemplarily illustrate how to achieve playback synchronization between different devices at the playback end in a one-to-many casting scenario by adopting the first solution.
[0190] As shown in combination with FIGS. 10 and 8, device B and device C at the playback end respectively feedback the data type information to be played to the status monitoring module in the source device A through the first status feedback module and the second status feedback module. For example, the data type feedback by device B is video, and the data type feedback by device C is audio.
[0191] The status monitoring module in device A inputs this data type information into the synchronization policy management module, and the synchronization policy management module selects the corresponding synchronization policy from the policy library according to this data type information.
[0192] In an actual distributed service scenario, due to the increase in the number of devices at the playback end and the source end, the combination of data types is diverse. The setting of the synchronization policy management module can implement the selection of different synchronization policies for different data types, and thus can be applied to more complex application scenarios.
[0193] Optionally, when the data types of multiple transmission channels include at least one audio channel and at least one video channel, one of the audio channels is taken as the master, and the other channels are taken as slaves. Exemplarily, when the data types to be played currently are one audio channel and another video channel, the adopted synchronization policy is to perform master-slave setting, set the audio as the master, the video as the slave, and the video performs frame rate control with reference to the audio playback time.
[0194] Optionally, when the data types of multiple transmission channels include multiple data of the same type, such as both two channels of data are video or both are audio, then any one of them can be taken as the master, which is equivalent to arbitrarily selecting one of the devices at the playback end as the master, and the other devices as slaves.
[0195] Optionally, when multiple devices are playing, the audio frames are automatically played after caching a fixed number of frames, eliminating the need for video and audio to wait for each other. In this embodiment, the audio frame cache time can be set to be longer than the cache time in a single-device scenario, that is, longer than the cache time in a one-to-one broadcast application scenario. For example, if the cache time for a single device is 2 minutes, the cache time of the data cache module in a one-to-many broadcast scenario can be set to be longer than 2 minutes.
[0196] After determining the synchronization strategy, the multi-channel management module monitors the actual playback time information m_clock sent by the delay feedback module of device C, and forwards the actual playback time information to the frame rate control module of device B as the input of the video playback frame rate control.
[0197] In this embodiment, the video frame rate is 30 frames per second. The frame rate control module takes out a frame of image corresponding to the current audio frame from the cache queue every 33ms, reads its playback timestamp Vpts, for example, reads the playback timestamp Vpts of the mth video frame from the cache queue, and then calculates diff based on the following formula: diff = Vpts - m_clock + (Y3 - X3)
[0198] After calculating the play time difference diff, the diff is compared with a predetermined threshold range to determine whether the current video frame should be displayed.
[0199] The more frequently images are retrieved from the cache queue, the more accurate the synchronization control. Calculating the diff value on a frame-by-frame basis can improve synchronization accuracy. A smaller diff value results in less relative latency and better synchronization. By controlling the frequency of image frame retrieval from the cache queue, synchronization accuracy can be controlled. A diff value less than the inter-frame interval, or even close to zero, allows for inter-frame synchronization.
[0200] In this embodiment, the minimum value is -185ms and the maximum value is 90ms.
[0201] If diff is less than min, wait. For example, if diff is -205ms, wait for -185ms-(-205)ms=20ms before displaying.
[0202] If -185ms≤diff≤90ms, the image is sent directly to the display. Sending means passing the extracted image frame to the display driver for display on the monitor.
[0203] If diff>90ms, the video needs to catch up with the audio. The control strategy adopted at this time can be to drop frames or increase the video playback rate.
[0204] Optionally, to ensure the continuity of playback data and avoid problems such as audio swallowing or screen jumps, try not to use frame dropping for synchronization. Instead, consider using a playback rate change for synchronization.
[0205] For example, optionally, if the video frame arrives too late (greater than 90ms) and the delayed frame arrives at the same time, the frame can be dropped and the next frame can be displayed directly; or, if the video frame is ahead of time by more than 185ms, waiting for the next scheduling may cause the buffer to be full, so the frame needs to be dropped, and the frame dropping priority is P frames (predictive-frame, forward predictive coding frame) and B frames (bi-directional interpolated prediction frame, bidirectional predictive interpolated coding frame).
[0206] When the audio frame arrival is delayed or the audio is played slowly, the video frame is allowed to be displayed in advance, with a maximum advance margin of 185ms.
[0207] Alternatively, if the audio arrives too late and all audio frames in the queue have been sent, audio interruptions are inevitable. To ensure a smooth user experience and prevent interruptions, the audio playback rate is reduced and the waiting time for audio frames is increased when the audio queue data volume is less than a certain value. Normal playback speed is restored after the sending queue exceeds a certain value, minimizing frame loss. Slow playback is performed without significantly affecting user perception, and the specific slowdown ratio is determined by the specific value of diff.
[0208] Drop-frame processing loses information, so using fast or slow playback to achieve synchronization can retain more information and reduce data loss compared to drop-frame processing. However, in some cases, drop-frame processing is the only option.
[0209] Optionally, if the audio buffer queue is full and the first video frame has not arrived, the audio frame can only be dropped or the playback failure is returned.
[0210] The above solution uses the actual playback time of the audio player on the playback end as a reference to control the playback time of other devices such as the video player. The following describes another solution that can achieve multi-device synchronous playback in a one-to-many broadcast application scenario.
[0211] The synchronization of video frames to audio frames requires the video playback device to accurately know the time when the audio frames are played, and then adjust its own playback timing. If the playback end is in a single-device scenario, the video playback module can easily obtain the audio playback time information of the same device. However, in a scenario where audio and video are separated, the video playback device cannot obtain the playback time of the audio frame in real time. If the video frame obtains the playback time of the audio frame across devices, it needs to be forwarded across devices twice at the source end, which has a large delay and is unreliable. In the first solution mentioned above, the source end needs to forward once, while in the second solution in the one-to-many scenario provided in the embodiment of the present application, the source end does not need to forward, but the audio playback device can provide a time delay feedback to the source end, and the source end does not need to feed back the delay to the video playback device.
[0212] Specifically, the system architecture shown in Figure 7 is also used as an example for illustration. This solution can be implemented based on control centers deployed on the source and playback devices. Specifically, as shown in Figure 12, for clarity, source device A is deployed with a first control center, audio playback device C is deployed with a second control center, and video playback device B is deployed with a third control center.
[0213] Devices A, B, and C first need to synchronize their clocks.
[0214] Performing clock synchronization first can offset or reduce asynchrony caused by different device clocks.
[0215] The audio playback device (device C) determines the audio frame delay information and feeds it back to device A. The delay information can be the transmission delay and decoding delay of the last audio frame played, or the average transmission delay and decoding delay of multiple audio frames played, which is fed back to the first control center in source device A.
[0216] In source device A, before encoding the video stream, a serial number and a playback timestamp Vpts are added to each frame. After encoding by the encoder, the first control center estimates the playback time of the video frame based on the delay information of the audio frame to obtain the estimated playback time Vcts' of the video frame. The estimated playback time is used to replace the original playback timestamp Vpts to offset the delay difference between the video frame and the audio frame, thereby achieving synchronous playback.
[0217] It should be noted that the video playback timestamp Vpts or audio playback timestamp Apts is used to guide the playback end to play in sequence according to the timing indicated by the timestamp. It is generated by the source device and is generally added to each frame of data by the source device before or during encoding.
[0218] The first control center first calculates Vcts' based on the delay information fed back by the second control center, and then updates the playback timestamp of each video frame in the video stream to be transmitted to Vcts' before sending the video stream.
[0219] A specific embodiment is listed below to illustrate the present invention.
[0220] When the playback end is a single device, the video is synchronized with the audio on the same device, and the audio playback time (Acts) can be obtained. However, when the audio and video are played on different devices, the video playback device cannot obtain the audio playback device's Acts. The audio playback time (Acts) can be understood as an estimate of the playback time.
[0221] Multiple devices in a distributed scenario first synchronize their clocks. Source device A transmits the video and audio data to be transmitted to playback devices B and C, respectively.
[0222] After the audio frame is buffered for a certain number of frames, it is played at the set frame rate.
[0223] In some embodiments, the audio playback device C determines the delay information Tasd and then feeds it back to the device A.
[0224] Ignoring other negligible factors, the audio transmission and decoding delay Tasd, the audio playback time Acts, and the audio sending time have the following relationship: Tasd = Acts - Tas.
[0225] When the video playback device at the playback end cannot obtain Acts, the source device A can obtain the sending time point Tas of the audio frame at the source end. Then, based on Tas and Tasd, the estimated value of Acts can be obtained.
[0226] Acts=Tas+Tasd
[0227] Acts is the estimated audio frame playback time at the source end, Tas is the audio frame transmission time at the source end, and Tasd is the audio frame transmission delay.
[0228] Exemplarily, in this embodiment, the audio frame transmission delay Tasd includes transmission delay and decoding delay, and the sum of the transmission delay and decoding delay of multiple audio frames played by the audio playback device within a period of time can be used to calculate the average.
[0229] In other embodiments, the audio playback device may not need to feed back the delay information to the source device. Instead, after determining the delay Tasd, it obtains Tas, then calculates Acts on the audio playback device C, and then device C directly feeds back Acts to device A.
[0230] Tasd is a historical result and may not be completely consistent with the latency generated by the current network conditions. Therefore, its reliability is not 100%, which may result in some errors in audio and video synchronization. Optionally, the source device can filter the Tasd values of multiple acquired audio frames to obtain the smoothest value, thereby reducing significant errors caused by local fluctuations.
[0231] The play time difference between the video frame and the audio frame with a mapping relationship can be calculated by the following formula: diff = (Vcts–Acts)–(Vpts–Apts)
[0232] Vcts is the video frame transmission time, which can be understood as an estimated value of the video frame playback time. Apts and Vpts are the playback timestamps added to the audio and video respectively by device A before encoding.
[0233] There is a mapping relationship, that is, the video frame and the audio frame have the same or similar sequence number. Alternatively, according to the playback timestamp, it can be determined that the two are audio frames and video frames played at the same time sequence, and the corresponding audio frames and video frames have a mapping relationship.
[0234] The goal of synchronous playback is: min≤diff≤max. In this embodiment, the min value is -186ms and the max value is 88ms.
[0235] Source device A obtains the sending time of the current audio frame and video frame as Tas and Tvs respectively;
[0236] Ignoring the error introduced by the current frame information, Acts = Tas + Tasd, and substituting it into the above calculation formula, the target of synchronous playback is: min ≤ Vcts - (Tas + Tasd) - (Vpts - Apts) ≤ max
[0237] Assuming that diff = 0, Vcts = Vcts', that is, Vcts'-(Tas + Tasd)-(Vpts-Apts) = 0ms, then Vcts' = Tas + Tasd + Vpts-Apts;
[0238] Among them, Apts and Vpts can be obtained by source device A.
[0239] Vcts' is the estimated video playback time when diff=0.
[0240] In some embodiments, before device A sends a video frame, the playback timestamp Vpts of the current frame may be updated to Vcts'.
[0241] In another embodiment, before device A sends a video frame, Vcts' can be added to the original playback timestamp Vpts, so as not to replace the original Vpts but to add an estimated value. This can avoid a series of problems caused by deleting the original Vpts.
[0242] After decoding, the video player (device B) only needs to compare Vcts' with the current time to decide whether to display the video. For example, if the current time is Tn, diff' = Vcts' - Tn. Then, by comparing diff' with [-186ms, 88ms], the corresponding processing strategy can be determined. For details, please refer to the above embodiment and will not be repeated here.
[0243] Optionally, in the second solution, X3 and Y3 can also be introduced to determine the play time difference. The corresponding calculation formula is as follows: diff = (Vcts – Acts) – (Vpts – Apts) + (Y3 – X3)
[0244] Then Vcts'=Tas+Tasd+Vpts-Apts+(X3-Y3).
[0245] Similarly, in this embodiment, when the playback end is multiple devices, the audio frame is automatically played after caching a fixed number of frames, and the video and audio no longer wait for each other. The cache time can be set to be longer than the single-device scenario.
[0246] The above descriptions are mostly exemplified by at least one channel being audio and at least one channel being video. Based on the above descriptions, those skilled in the art can adaptively obtain solutions for the case where the multiple channels of data to be transmitted in a one-to-many broadcast scenario are all audio, or the multiple channels of data to be transmitted are all video. For example, as shown in FIG4(d), in an application scenario where both channels of data are images, the playback time of the playback device of one of the images can be used as a reference to control the playback time of the other device. For example, according to the above solution one, the actual playback time of each image frame on device C is used as a reference time to control the playback time of the corresponding image frame on device B; or, according to the above solution two, based on the transmission and decoding delay of device C, the playback time of the image frame on device B is estimated, and the playback timestamp is updated to control the playback time of the image on device B and achieve synchronization between device B and device C. By analogy, for the situation shown in FIG4(e), corresponding solutions can also be adaptively obtained, and this application specification does not elaborate on them one by one.
[0247] The above describes the synchronous playback control solution in a one-to-many scenario. The following describes the synchronous playback control solution in a many-to-one scenario.
[0248] In a scenario where the source is multiple devices and the player is a single device, as shown in Figure 13, device A sends audio, device B sends video, and the player is only device C. The video receiver on device C can accurately obtain the audio playback time, but the source is located on two devices, and synchronization information between them cannot be easily obtained, requiring cross-device interaction.
[0249] In the many-to-one scenario, the audio and video synchronization process requires the distributed hardware framework to first set the synchronization group information, and then synchronize the synchronization group information between multiple devices through the control center, and then perform data transmission and playback.
[0250] First, the clocks of the three devices need to be synchronized. That is, device A and device B must synchronize to device C. After the clocks are synchronized, device A and device B add Apts and Vpts to the frame header information.
[0251] Adding the timestamp after clock synchronization can reduce asynchrony caused by inconsistent device clocks.
[0252] Whether the audio and video on different devices need to be synchronized cannot be determined by each device individually, and requires business layer settings.
[0253] A control center is set up at the service layer, and interfaces are reserved in the control centers corresponding to devices A, B, and C, respectively, for receiving synchronization group information. The synchronization group information may include at least one of synchronization reference information and flow information.
[0254] Optionally, the synchronization reference information may include the identity information of each source device and the destination (playing) device, for example, the identity information of source device A, device B and the identity information of playing device C.
[0255] The identity information may be a code or symbol that can uniquely identify the device. For example, the identity information may be the device ID of the device, such as the device ID of a mobile phone, which is also the IMEI (International Mobile Equipment Identity) code of the mobile phone.
[0256] Optionally, the stream information may include information about the type of data currently being transmitted, for example, whether the type of data currently being transmitted is audio or video.
[0257] After the source generates the synchronization group information, at least two devices on the source set the synchronization group information to the local control center, and the source device synchronizes the synchronization group information to the control center of the playback device.
[0258] Here, it is sufficient to synchronize the synchronization group information between multiple devices on the source end and the devices on the playback end. There is no clear order in the timing of synchronization between the devices on the source end and synchronization between the source end and the playback end.
[0259] Next, the playback device selects and retains the data content that is consistent with its own device identity information based on the identity information of the receiving (playing) device in the synchronization group information. Secondly, it filters out the data type sent by each device, determines the data type sent by each device on the source end, and then groups the different devices on the source end according to the data type, and then performs audio and video synchronization.
[0260] A specific embodiment of a many-to-one broadcast scenario is listed below.
[0261] For example, in a distributed business scenario, the control center of each device on the source side and the playback side reserves the interface SetSyncGroup(vector <pair<deviceIDs,streamInfo> >) to receive sync group information.
[0262] Optionally, synchronization group information can be set in the frame header.
[0263] The first member of the vector is the synchronization reference, which is used to notify the control center of the device ID of the current sending end (ie, the source end) and the device ID of the player end after determining the device ID of the source end and the device ID of the player end.
[0264] The second member is the stream information, which is used to inform the control center whether the data type currently being sent is audio data or video data.
[0265] Next, device A and device B set the synchronization group information to the local control center, and then device A and device B synchronize the synchronization group information to the control center of device C.
[0266] The synchronization of synchronization group information enables multiple devices at the source end to interact with each other before sending data to obtain information such as the type of data that each other needs to send, establish a mapping relationship between audio frames and video frames, and synchronize the synchronization group information with the playback end device so that the playback end device can achieve synchronization of audio frames and image frames.
[0267] Device C identifies the device ID of the receiving end (playing end) based on the synchronization reference information in the synchronization group information. If it matches its own device ID, it determines that the data is received by itself and retains it.
[0268] Device C filters out the data type sent by each device based on the stream information in the synchronization group information. For example, as shown in Figure 13, device C determines that device A sends audio data and device B sends video data, so it groups device A and device B and synchronizes the audio and video of the two.
[0269] Optionally, since the receiving end only includes device C, device C can directly obtain Acts. In this case, the video data can be processed with reference to the audio data according to min≤Vcts-Acts-(Vpts-Apts)≤max.
[0270] Similar to the one-to-many broadcast scenario, technical personnel in this field can, based on the above description, adaptively obtain solutions for the situation where the multiple channels of data to be transmitted in the many-to-one broadcast scenario are all audio, or the multiple channels of data to be transmitted are all video. This application specification does not go into details one by one.
[0271] According to the implementation plans for the above-mentioned one-to-many scenario and many-to-one scenario, an implementation plan for the many-to-many scenario can be adaptively obtained. For example, in a case where the source end is multiple devices and the playback end is multiple devices, the transmission time difference Δt between the multiple devices on the source end can be determined first, and Δt can be introduced for correction when calculating the diff or estimating the video frame playback time, thereby offsetting or reducing the impact of the asynchronous transmission time of the source device on the playback end.
[0272] According to the description of the above embodiments, it can be known that the embodiments of the present application provide a synchronous playback method in a distributed business scenario, which can be applied to a one-to-many broadcast scenario. As shown in Figure 14, in a one-to-many broadcast scenario, the playback end includes two or more devices, the two or more devices include a first device and a second device, and the source end includes a third device; the third device transmits the first data stream to the first device for playback, and transmits the second data stream to the second device for playback; the first data stream includes multiple first data frames; the second data stream includes multiple second data frames.
[0273] As shown in FIG15 , from the perspective of the second device, the method includes the following steps:
[0274] S141, receiving a first timestamp;
[0275] S142, reading a second timestamp corresponding to a second data frame to be played;
[0276] It should be noted that the step numbers are only used to distinguish different steps and do not limit the execution order. For example, there is no clear order in which S141 and S142 are executed. In actual applications, S142 may be executed before S141.
[0277] S143, calculating a first playback time difference based at least on the first timestamp and the second timestamp;
[0278] S144: Determine a synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference.
[0279] It should be noted that the first timestamp represents the actual playback time of the mth first data frame on the first device, where m≥1 and is an integer; the second timestamp is the playback timestamp PTS generated by the third device at the source end, which is used to represent the playback timing of each second data frame in the second data stream.
[0280] As can be seen from the above description, the first data stream and the second data stream can be of the same data type or different types. For example, the first data stream can be an audio data stream, and the second data stream can be a video data stream. Alternatively, the first data stream and the second data stream can both be video data streams, for example, the first data stream and the second data stream are different parts of the same image. Alternatively, the first data stream and the second data stream can both be audio data streams, for example, the first data stream is the left channel data, and the second data stream is the right channel data, and so on.
[0281] Furthermore, the number of playback devices can be three or more, and the number of data streams is not limited to two. The processing method for more than three data streams can refer to the processing method for two data streams. For example, in the case of two data streams, the second data stream refers to the first data stream. However, for multiple data streams with more than three channels, the playback time of all data streams except the first data stream can refer to the playback time of the first data stream.
[0282] Optionally, receiving the first timestamp may include receiving the first timestamp forwarded by a third device; the first timestamp is generated by the first device and sent to the third device. Forwarding the timestamp once by the third device reduces link communication pressure and conserves communication resources, compared to establishing a data link between the second device and the first device or forwarding the timestamp twice by the source device.
[0283] Optionally, the second timestamp corresponding to the second data frame to be played can be read by retrieving the next second data frame to be played from the cache queue at predetermined time intervals and reading the second timestamp. The predetermined time interval is described in the above embodiment and should be determined based on the frame rate and be a multiple of the inverse ratio of the frame rate.
[0284] Optionally, the first playback time difference is calculated based on at least the first timestamp and the second timestamp. When it is determined that there is a mapping relationship between the next second data frame to be played and the mth first data frame, the first playback time difference can be calculated based on at least the first timestamp corresponding to the mth first data frame and the second timestamp corresponding to the next second data frame to be played.
[0285] Optionally, the first playback time difference is calculated based on at least the first timestamp and the second timestamp, and the first playback time difference can also be calculated based on the first timestamp, the second timestamp, the first processing time and the second processing time; wherein the first processing time is an estimated value of the processing time taken from the time a first data frame is taken out of the cache queue to the time it is played; the second processing time is an estimated value of the processing time taken from the time a second data frame is taken out of the cache queue to the time it is played.
[0286] Optionally, the synchronous playback strategy includes at least one of waiting, displaying, and catching up. Based on the first playback time difference, the synchronous playback strategy to be executed for the second data frame to be played is determined, which can be to compare the first playback time difference with a predetermined first threshold interval; when the first playback time difference is less than the minimum value of the threshold interval, it is determined that the playback of the first data stream lags behind the second data stream, and the synchronous playback strategy to be executed for the second data frame to be played is determined to be waiting; when the first playback time difference is greater than the maximum value of the threshold interval, it is determined that the playback of the first data stream is ahead of the second data stream, and the synchronous playback strategy to be executed for the second data frame to be played is determined to be catching up; when the first playback time difference falls within the threshold interval, it is determined that the playback of the first data stream is relatively synchronized with the playback of the second data stream, and the synchronous playback strategy to be executed for the second data frame to be played is determined to be displaying.
[0287] Optionally, waiting includes one or more of reducing the playback rate, waiting for a first predetermined time period, and dropping frames; wherein the first predetermined time period is determined based on the difference between the minimum value in the threshold interval and the first playback time difference; catching up includes increasing the playback rate and / or dropping frames.
[0288] An embodiment of the present application also provides a synchronous playback method in a distributed business scenario. This method can be applied to a one-to-many broadcast scenario. The introduction of the one-to-many broadcast scenario refers to the above description and will not be repeated here.
[0289] This method can be executed based on the third device. Referring to FIG16 , the specific process can be as follows:
[0290] S151, receiving delay information;
[0291] The delay information includes transmission delay and decoding delay; wherein the transmission delay represents the time duration for the mth first data frame to be transmitted from the third device to the first device; the decoding delay represents the decoding time duration for the mth first data frame; m ≥ 1 and is an integer;
[0292] S152, obtaining the sending time of the mth first data frame;
[0293] S153, obtaining an estimated value of the playback time of the mth first data frame on the first device based at least on the transmission time and delay information;
[0294] S154 , before sending the second data frame, add the estimated value as a fifth timestamp to the second data frame.
[0295] The fifth timestamp is used to perform a difference calculation with the current time to obtain a second playback time difference, so as to determine a synchronous playback strategy to be executed for the second data frame to be played.
[0296] Adding the fifth timestamp to the second data frame may be replacing the original video playback timestamp Vpts with the fifth timestamp, or may not replace the original playback timestamp but add another fifth timestamp.
[0297] The step numbers in the embodiments of the present application are only used to distinguish different steps and do not limit the execution sequence.
[0298] Optionally, an estimated value of the playback time of the first data frame on the first device is obtained at least based on the sending time and delay information, and an estimated value of the playback time of the mth first data frame on the first device can be obtained at least based on the sending time and delay information of the mth first data frame; wherein, m≥1 and is an integer; the mapping relationship is determined based on the serial number and / or the playback timestamp PTS; and the estimated value is added to the second data frame as the fifth timestamp, which can be adding the estimated value as the fifth timestamp to the second data frame having a mapping relationship with the mth first data frame.
[0299] Optionally, obtaining an estimated value of the playback time of the first data frame on the first device based at least on the transmission time and the delay information may be obtaining an estimated value of the playback time of the first data frame on the first device based on the transmission time, the delay information, a third timestamp, and a fourth timestamp. The third timestamp is a PTS (playback timestamp) added to the first data frame, used to indicate the playback timing of each first data frame in the first data stream; and the fourth timestamp is a PTS (playback timestamp) added to the second data frame, used to indicate the playback timing of each second data frame in the second data stream.
[0300] The present application also provides a method for synchronous playback in a distributed service scenario. The method is applied to a one-to-many broadcast scenario. The method can be executed based on a second device. As shown in FIG17 , the method may include the following process:
[0301] S161, reading a fifth timestamp corresponding to a second data frame to be played;
[0302] The fifth timestamp is an estimate of the playback time of the first data frame on the first device, obtained based on at least the transmission time and latency information. The latency information includes transmission latency and decoding latency. The transmission latency represents the duration of transmission of the first data frame from the third device to the first device; the decoding latency represents the duration of decoding of one first data frame; and the transmission time represents the time it takes the third device to transmit the first data frame.
[0303] S162: Calculate the difference between the fifth timestamp and the current time to obtain a second playback time difference.
[0304] S163: Determine a synchronous playback strategy to be executed for the second data frame to be played based on the second playback time difference.
[0305] Optionally, the synchronous play strategy includes at least one of waiting, sending and displaying, and catching up. The specific synchronous play strategy is described above and will not be repeated here.
[0306] The embodiment of the present application also provides a synchronous playback method in a distributed business scenario, which is applied to a many-to-one broadcast scenario. Referring to the description of the many-to-one broadcast scenario, as shown in Figure 18, in the many-to-one broadcast scenario, the source end includes two or more devices, the two or more devices include a fourth device and a fifth device, and the playback end includes a sixth device; the fourth device and the fifth device respectively transmit the fourth data stream and the fifth data stream to the sixth device for playback; the fourth device, the fifth device, and the sixth device are all equipped with a control center, and the control center reserves an interface for setting synchronization group information.
[0307] The method may be executed based on the sixth device. As shown in FIG19 , the method may include the following process:
[0308] S181, receiving synchronization group information respectively sent by the fourth device and the fifth device;
[0309] The synchronization group information includes synchronization reference information and stream information. The synchronization reference information includes the source device identity information and the playback device identity information; the stream information includes the data type information of the data stream sent by each source device.
[0310] S182: Determine a synchronous playback strategy for the data stream to be played based at least on the synchronization group information.
[0311] For specific implementation, please refer to the description of the embodiments under the corresponding scenarios above, which will not be repeated here.
[0312] The embodiment of the present application also provides a playback device in a distributed service scenario, which is used as a second device in a one-to-many broadcast scenario. In the one-to-many broadcast scenario, the second device shown in FIG20 includes a frame rate control module for performing the following operations:
[0313] Receive a first timestamp, read a second timestamp corresponding to a second data frame to be played, and calculate a first playback time difference based on at least the first timestamp and the second timestamp, and determine a synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference.
[0314] Optionally, the second device also includes: a second state feedback module and / or a second data cache module; the second state feedback module is at least used to identify the data type of the second data frame to be played and feed it back to the third device; the second data cache module is at least used to cache at least one second data frame in the second data stream.
[0315] The embodiment of the present application also provides a playback device in a distributed service scenario, where the playback device is used as a first device in a one-to-many broadcast scenario. In the one-to-many broadcast scenario, the first device shown in FIG20 includes a delay feedback module for performing the following operations:
[0316] Obtain a first timestamp, and send the first timestamp to a third device.
[0317] Among them, the first timestamp represents the actual playback time of the mth first data frame on the first device; the first timestamp is used to calculate the first playback time difference with the second timestamp, so as to determine the synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference; the second timestamp is used to represent the playback timing of each second data frame in the second data stream.
[0318] Optionally, the first device further includes: a first state feedback module and / or a first data cache module; the first state feedback module is at least used to identify the data type of the first data frame to be played and feed it back to the third device; the first data cache module is at least used to cache at least one first data frame in the first data stream.
[0319] The embodiment of the present application also provides a source device in a distributed business scenario, which is used as a third device in a one-to-many broadcast scenario. As shown in Figure 20, the third device includes a multi-channel management module for performing the following operations:
[0320] The first timestamp is received and forwarded to the second device; the first timestamp is acquired and sent by the first device.
[0321] Optionally, the third device also includes: a synchronization policy management module and / or a status monitoring module; the status monitoring module is used to receive the respective data types respectively fed back by more than two devices and input them into the synchronization policy management module; the synchronization policy management module is used to determine the synchronization management policy based on the respective data types respectively fed back by more than two devices.
[0322] An embodiment of the present application also provides a playback system in a distributed business scenario, as shown in Figure 20. The playback system is applied to a one-to-many broadcast scenario, and the first device includes a delay feedback module for obtaining a first timestamp and sending the first timestamp to a third device; the third device includes a multi-channel management module for receiving the first timestamp and forwarding it to the second device; the second device includes a frame rate control module for receiving the first timestamp, reading the second timestamp corresponding to the second data frame to be played, and calculating the first playback time difference based on at least the first timestamp and the second timestamp, and determining the synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference.
[0323] The embodiment of the present application also provides a playback system in a distributed business scenario, which is applied to a one-to-many broadcast scenario. Among them, the first device is used to determine the delay information; the delay information includes transmission delay and decoding delay; wherein the transmission delay represents the time length of the first data frame transmitted from the third device to the first device; the decoding delay is the decoding time length occupied by a first data frame; the third device is used to receive the delay information, obtain the sending time of the first data frame, and obtain an estimated value of the playback time of the first data frame on the first device based on at least the sending time and the delay information; before sending the second data frame, the estimated value is added to the second data frame as the fifth timestamp; the second device is used to read the fifth timestamp of the second data frame to be played, calculate the difference between the fifth timestamp and the current time, and obtain the second playback time difference; based on the second playback time difference, determine the synchronous playback strategy to be executed for the second data frame to be played.
[0324] An embodiment of the present application also provides a playback system in a distributed business scenario, and the playback system is applied to a many-to-one broadcast scenario, as shown in Figure 18. In the many-to-one broadcast scenario, the source end includes more than two devices, the more than two devices include a fourth device and a fifth device, and the playback end includes a sixth device; the fourth device and the fifth device respectively transmit the fourth data stream and the fifth data stream to the sixth device for playback; the fourth device, the fifth device and the sixth device are all provided with a control center, and the control center reserves an interface for setting synchronization group information; the fourth device and the fifth device are used to set the synchronization group information to the local control center, and send the set synchronization group information to the sixth device respectively; the synchronization group information includes synchronization reference information and stream information, the synchronization reference information includes source device identity information and playback device identity information; the stream information includes data type information of the data stream sent by each device on the source end; the sixth device is used to receive the synchronization group information sent by the fourth device and the fifth device, and determine the synchronization playback strategy for the data stream to be played based on at least the synchronization group information.
[0325] An embodiment of the present application also provides an electronic device, which includes: one or more processors; a memory; at least one application; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to execute a method as described in any of the above embodiments.
[0326] An embodiment of the present application further provides a storage medium including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in any of the above embodiments.
[0327] An embodiment of the present application also provides a chip system, including a communication interface for inputting and / or outputting data; and a processor for executing a computer executable program so that a device equipped with the chip system executes a method as described in any of the above embodiments.
[0328] It should be noted that the solutions provided in the embodiments of the present application include any one or more of a synchronous playback system and method, an electronic device, a storage medium, and a chip system, or may also be other forms of software products, hardware products, or virtual service products based on the technical concept of the method described in the specification of this application.
[0329] In the description of the device in the embodiment of the present application, various modules for implementing the method process functions are constructed in the device. The division of modules is merely a division of logical functions. When implementing the embodiment of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0330] Specifically, in actual implementation, each functional module can be fully or partially integrated into one physical entity, or physically separated. Moreover, these modules can all be implemented in the form of software called through processing elements; or all can be implemented in the form of hardware; or some modules can be implemented in the form of software called through processing elements, and some modules can be implemented in the form of hardware. For example, the detection module can be a separately established processing element, or it can be integrated into a chip of an electronic device. The implementation of other modules is similar. In addition, these modules can all or partly be integrated together, or they can be implemented independently. During the implementation process, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or by instructions in the form of software.
[0331] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0332] Specifically, in one embodiment of the present application, the above-mentioned one or more computer programs are stored in the above-mentioned memory, and the above-mentioned one or more computer programs include instructions. When the above-mentioned instructions are executed by the above-mentioned device, the above-mentioned device executes the method steps described in the embodiment of the present application.
[0333] Specifically, in one embodiment of the present application, the processor of the electronic device may be a SOC, which may include a central processing unit (CPU) and may further include other types of processors, such as a graphics processing unit (GPU). Specifically, in one embodiment of the present application, the processor of the electronic device may be a PWM control chip.
[0334] Specifically, in one embodiment of the present application, the processor involved may include, for example, a CPU, a DSP, a microcontroller, or a digital signal processor, and may also include a GPU, an embedded neural network processor (NPU), and an image signal processor (ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASICs, or one or more integrated circuits for controlling the execution of the program of the technical solution of the present application. In addition, the processor may have the function of operating one or more software programs, and the software programs may be stored in a storage medium.
[0335] Specifically, in one embodiment of the present application, the memory of the electronic device may be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any computer-readable medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer.
[0336] Specifically, in one embodiment of the present application, the processor and the memory may be combined into a processing device, or more commonly, they may be independent components, with the processor being configured to execute program code stored in the memory to implement the method described in the embodiment of the present application. In a specific implementation, the memory may also be integrated into the processor or independent of the processor.
[0337] Furthermore, the devices, apparatuses, and modules described in the embodiments of the present application may be implemented by computer chips or entities, or by products having certain functions.
[0338] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, apparatus, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0339] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of this application.
[0340] The embodiment description in this application is described with reference to the flow chart and / or block diagram according to the method, equipment (device) and computer program product of embodiment of the present application.It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of general-purpose computer, special-purpose computer, embedded processing machine or other programmable data processing equipment to produce a machine, so that the instruction executed by the processor of computer or other programmable data processing equipment produces the device for realizing the function specified in one flow chart flow chart or multiple flow charts and / or one block or multiple blocks of block diagram.
[0341] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0342] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0343] It should also be noted that, in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.
[0344] In the embodiments of the present application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, commodity, or apparatus comprising the element.
[0345] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0346] The various embodiments in this application are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the partial description of the method embodiments.
[0347] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments of the present application can be implemented using a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0348] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0349] The above description is merely a specific embodiment of the present application. Any person skilled in the art may easily conceive of variations or substitutions within the technical scope disclosed in this application, and such variations or substitutions shall be within the scope of protection of this application. The scope of protection of this application shall be subject to the scope of protection of the claims.
Claims
1. A synchronous playback system, characterized in that: The playback system includes a first device, a second device and a third device; wherein the third device is used to transmit a first data stream to the first device for playback, and transmit a second data stream to the second device for playback; the first data stream and the second data stream are two data streams to be played synchronously; the first data stream includes a plurality of first data frames; the second data stream includes a plurality of second data frames; The first device is used to obtain a first timestamp and send the first timestamp to the third device; The third device is used to receive the first timestamp and forward it to the second device; The second device is used to receive the first timestamp, read the second timestamp corresponding to the second data frame to be played, and calculate the first playback time difference based on at least the first timestamp and the second timestamp, and determine the synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference.
2. The system according to claim 1, characterized in that The second device, when performing the operation of reading the second timestamp corresponding to the second data frame to be played, is specifically used to: At every predetermined time interval, the next second data frame to be played is taken out from the cache queue and the second timestamp is read.
3. The system according to claim 1, characterized in that The second device, when performing the operation of calculating the first playback time difference based on at least the first timestamp and the second timestamp, is specifically used to: determine that when there is a mapping relationship between the next second data frame to be played and the m-th first data frame, calculate the first playback time difference based on at least the first timestamp corresponding to the m-th first data frame and the second timestamp corresponding to the next second data frame to be played; wherein the mapping relationship is determined based on the serial number and / or the playback timestamp PTS.
4. The system according to any one of claims 1 to 3, characterized in that: The second device is further used to identify data type information of the second data frame to be played, and feed back the information to the third device; The first device is further used to identify data type information of the first data frame to be played, and feed back the information to the third device; The third device is further used to receive data type information fed back by the first device and the second device respectively, and determine a synchronization management strategy.
5. A synchronous playback method, characterized in that: The method is applied to a second device, the second device is used to receive and play a second data stream sent by a third device; wherein the third device is also used to transmit a first data stream to the first device for playing; the first data stream and the second data stream are two data streams to be played synchronously, the first data stream includes a plurality of first data frames; the second data stream includes a plurality of second data frames; The method comprises: Receive a first timestamp; the first timestamp indicates the actual playback time of the mth first data frame on the first device; m≥1 and is an integer; Reading a second timestamp corresponding to a second data frame to be played; the second timestamp is used to indicate a playback timing of each second data frame in the second data stream; Calculating a first playback time difference based at least on the first timestamp and the second timestamp; Based on the first playback time difference, a synchronous playback strategy to be executed for the second data frame to be played is determined.
6. The method according to claim 5, characterized in that Receive a first timestamp, including: The first timestamp forwarded by the third device is received; the first timestamp is generated by the first device and sent to the third device.
7. The method according to claim 5, characterized in that Reading a second timestamp corresponding to a second data frame to be played includes: At every predetermined time interval, the next second data frame to be played is taken out from the cache queue and the second timestamp is read.
8. The method according to any one of claims 5 to 7, characterized in that Calculating a first playback time difference at least according to the first timestamp and the second timestamp includes: When it is determined that there is a mapping relationship between the next second data frame to be played and the m-th first data frame, the first playback time difference is calculated at least based on the first timestamp corresponding to the m-th first data frame and the second timestamp corresponding to the next second data frame to be played; wherein the mapping relationship is determined based on the serial number and / or the playback timestamp PTS.
9. The method according to any one of claims 5 to 7, characterized in that Calculating a first playback time difference at least according to the first timestamp and the second timestamp includes: Calculating a first playback time difference according to the first timestamp, the second timestamp, the first processing duration, and the second processing duration; Among them, the first processing time is an estimated value of the processing time taken from the fetching of a first data frame from the cache queue to the playback; the second processing time is an estimated value of the processing time taken from the fetching of a second data frame from the cache queue to the playback.
10. The method according to any one of claims 5 to 9, characterized in that The synchronous playback strategy includes at least one of waiting, sending and displaying, and catching up; Determining a synchronous playback strategy to be executed for the second data frame to be played based on the first playback time difference includes: comparing the first playback time difference with a predetermined first threshold interval; When the first play time difference is less than the minimum value of the first threshold interval, determining that the play of the first data stream lags behind the play of the second data stream, and determining that the synchronous play strategy to be executed for the second data frame to be played is waiting; When the first playback time difference is greater than the maximum value of the first threshold interval, it is determined that the playback of the first data stream is ahead of the second data stream, and the synchronous playback strategy executed for the second data frame to be played is determined to be catch-up; When the first playback time difference belongs to the first threshold interval, it is determined that the playback of the first data stream is relatively synchronized with the playback of the second data stream, and the synchronous playback strategy executed for the second data frame to be played is determined to be display.
11. A synchronous playback method, characterized in that: The method is applied to a third device, the third device is used to transmit a first data stream to the first device for playback, and transmit a second data stream to the second device for playback; wherein the first data stream and the second data stream are two data streams to be played synchronously, the first data stream includes a plurality of first data frames; the second data stream includes a plurality of second data frames; The method comprises: receiving delay information; the delay information includes transmission delay and decoding delay; wherein the transmission delay represents the duration of the mth first data frame being transmitted from the third device to the first device; the decoding delay is the decoding duration occupied by the mth first data frame; m≥1 and is an integer; Obtaining the sending time of the mth first data frame; Obtaining an estimated value of the playback time of the mth first data frame on the first device at least according to the sending time and the delay information; Before sending the second data frame, the estimated value is added to the second data frame as a fifth timestamp; the fifth timestamp is used to calculate the difference with the current time to obtain a second playback time difference, so as to determine the synchronous playback strategy to be executed for the second data frame to be played.
12. The method according to claim 11, characterized in that Obtaining an estimated value of the play time of the first data frame on the first device at least according to the sending time and the delay information, including: Obtaining an estimated value of the playback time of the mth first data frame on the first device at least according to the sending time of the mth first data frame and the delay information; Adding the estimated value as a fifth timestamp to the second data frame comprises: The estimated value is added as a fifth timestamp to the second data frame having a mapping relationship with the mth first data frame; wherein the mapping relationship is determined based on a sequence number and / or a playback timestamp PTS.
13. The method according to claim 11 or 12, characterized in that Obtaining an estimated value of the play time of the first data frame on the first device at least according to the sending time and the delay information, including: Obtaining an estimated value of a play time of the first data frame on the first device according to the sending time, the delay information, the third timestamp, and the fourth timestamp; The third timestamp is a playback timestamp PTS added to the first data frame, and is used to indicate the playback timing of each first data frame in the first data stream; The fourth timestamp is a playback timestamp PTS added to the second data frame, and is used to indicate the playback timestamp of each second data stream. The playback timing of the two data frames.
14. A synchronous playback method, characterized in that: The method is applied to a sixth device, the sixth device being used to receive a fourth data stream sent by a fourth device and a fifth data stream sent by a fifth device, and synchronously play the fourth data stream and the fifth data stream; The method comprises: Receive synchronization group information respectively sent by the fourth device and the fifth device; the synchronization group information includes synchronization reference information and stream information, the synchronization reference information includes source device identity information and playback device identity information; the stream information includes data type information of the data stream sent by each source device; A synchronous playback strategy for the data stream to be played is determined based at least on the synchronization group information.
15. An electronic device, characterized in that: The electronic device comprises: One or more processors; a memory; at least one application; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to perform a method as described in any one of claims 5-14.
16. A storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 5 to 14.
17. A chip system, characterized in that: include: A communication interface for inputting and / or outputting data; A processor, used to execute a computer executable program so that a device equipped with the chip system executes a method as described in any one of claims 5 to 14.
Citation Information
Patent Citations
Synchronous playing system and method, electronic equipment, storage medium and chip system
CN119277139A
Method and apparatus for cooperative playing of media on multi devices, and terminal
CN105721920A
Audio and video synchronization method, audio and video synchronization apparatus and audio and video synchronization device
CN107801080A
Method, device and system for transmitting video and audio
CN111954051A
Source device, sink devices, methods and computer programs
CN113273221A
Cited By
Cross-device audio playing method, system and device and storage medium
CN120499456A
Animation scene real-time rendering and audio synchronization system
CN120711215A
Entertainment information transmission system and method fusing multi-terminal real-time interactive pushing
CN121334431A
Synchronization in cloud-based user interface (UI) streaming
WO2026176259A1
