This application relates to the field of short-range communication technologies, and in particular, to a data transmission method and apparatus.
Currently, short-distance wireless communication technologies are widely applied to fields such as smart vehicles, smart transportation, smart terminals, smart homes, and smart manufacturing. In streaming media application scenarios such as vehicle-mounted panoramic surround view and wireless projection (for example, vehicle-mounted projection and home theater projection), inter-stream synchronization (namely, play time synchronization between different data streams) between different data streams (for example, audio data streams and/or video data streams) needs to be implemented. For example, in a vehicle-mounted projection scenario, a mobile phone generates an audio data stream and a video data stream. The mobile phone sends the audio data stream to a vehicle-mounted speaker, and sends the video data stream to a vehicle-mounted central display screen. Time at which the vehicle-mounted speaker plays the audio data stream needs to be synchronized with time at which the vehicle-mounted central display screen plays the video data stream, to meet a requirement of audio-to-image synchronization in the vehicle-mounted projection scenario.
Therefore, how to implement inter-stream synchronization between different data streams in the streaming media application scenario is an urgent technical problem that needs to be resolved in this field.
This application provides a data transmission method and apparatus, to implement inter-stream synchronization between different data streams.
According to a first aspect, a data transmission method is provided. The method is applicable to a scenario of inter-stream synchronization between different data streams between a plurality of source end devices and one sink end device. An example in which the source end device is a first device is used, and the sink end device is a second device and a third device is used. The method includes: A first device sends a first packet to a second device, where the first packet includes a first data stream and a sampling time sequence of the first data stream; the first device sends a second packet to a third device, where the second packet includes a second data stream and a sampling time sequence of the second data stream, the first packet and the second packet correspond to a first communication protocol, and the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device; and the first device sends third packets to the second device and the third device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec, and the third packet corresponds to a second communication protocol.
It may be understood that the first device may periodically send the first packet to the second device, and the first device may periodically send the second packet to the third device. It can be learned from the foregoing that the first packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the first device to the second device, includes the first data stream and the sampling time sequence of the first data stream, and corresponds to the first communication protocol. The second packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the first device to the third device, includes the second data stream and the sampling time sequence of the second data stream, and corresponds to the first communication protocol. The first data stream and the second data stream may be audio streams or video streams. For example, the first data stream and the second data stream are audio streams of different sound channels. For another example, the first data stream is a video stream, and the second data stream is an audio stream.
In the foregoing solution, the first device sends the first packet to the second device, sends the second packet to the third device, and sends the third packets to the second device and the third device, where the third packet includes the first time stamp and the second time stamp, the first time stamp indicates the device time information of the first device, and the second time stamp indicates the time sequence value corresponding to the system clock of the codec of the first device. The device time information of the first device and the time sequence value that corresponds to the system clock of the codec of the first device meet a first mapping relationship. Therefore, when receiving the third packet, the second device may map, based on the device time information of the first device and the time sequence value that corresponds to the system clock of the codec of the first device, the sampling time sequence of the first data stream to a first moment on a time axis on which the device time information is located. Similarly, after receiving the third packet, the third device may map, based on the device time information of the first device and the time sequence value that corresponds to the system clock of the codec of the first device, the sampling time sequence of the second data stream to a third moment on the time axis on which the device time information of the first device is located. In this way, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are mapped to a same time axis, so that actual sending moments and/or processing moments of the first packet and the second packet are correspondingly adjusted, to implement inter-stream synchronization between the first data stream in the first packet and the second data stream in the second packet.
In an embodiment, the device time information of the first device represents air interface time of the first device. In this way, a reference time axis of the first packet and the second packet is a time axis of the air interface time of the first device.
In an embodiment, the method further includes: The first device sends a system message, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first orthogonal frequency division multiplexing (OFDM) symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector; or the first device sends data link layer control plane data to the second device and the third device, where the data link layer control plane data includes clock information, where the clock information is associated with the device time information, and the clock information is used by the second device and the third device to perform clock synchronization with the first device. The antenna connector is a connection unit that is in the first device and that connects a radio frequency analog circuit of a transceiver and an antenna.
In an embodiment, when the first device, the second device, and the third device belong to a SparkLink Basic (SLB) system, the first device sends the system message.
In an embodiment, when the first device, the second device, and the third device belong to a SparkLink Low Energy (SLE) system, the first device sends the data link layer control plane data to the second device and the third device.
In an embodiment, the second device and the third device perform clock synchronization with the first device by using the clock information carried in the system message, or the second device and the third device perform clock synchronization with the first device by using the clock information carried in the data link layer control plane data.
In an embodiment, the method further includes: The first device obtains the device time information of the first device before sending the third packets to the second device and the third device.
In an embodiment, that the first device obtains the device time information of the first device includes: The first device obtains the device time information of the first device by using an inter-layer primitive of a protocol stack. In an embodiment, the first device obtains the device time information of the first device by using the inter-layer primitive of the protocol stack, so that it is easy to obtain the device time information of the first device, thereby improving efficiency of subsequent inter-stream synchronization between different data streams. In addition, this manner does not depend on a protocol. This effectively reduces complexity and costs of the solution.
In an embodiment, the protocol stack includes a first protocol layer, a second protocol layer, and a third protocol layer; and correspondingly, that the first device obtains the device time information by using an inter-layer primitive of a protocol stack includes: The first protocol layer sends a first inter-layer primitive to the second protocol layer, where the first inter-layer primitive is used by the first protocol layer to request the second protocol layer to query the device time information; the second protocol layer sends a second inter-layer primitive to the third protocol layer, where the second inter-layer primitive is used by the second protocol layer to request the third protocol layer to query the device time information; the second protocol layer receives a third inter-layer primitive from the third protocol layer, where the third inter-layer primitive is used by the third protocol layer to indicate the device time information to the second protocol layer; and the first protocol layer receives a fourth inter-layer primitive from the second protocol layer, where the fourth inter-layer primitive is used by the second protocol layer to indicate the device time information to the first protocol layer.
In an embodiment, the method further includes: The first device receives first information from the second device, and receives second information from the third device, where the first information indicates a transmission delay of the first packet, and the second information indicates a transmission delay of the second packet; the first device determines a first delay difference between the transmission delay of the first packet and the transmission delay of the second packet based on the transmission delay of the first packet and the transmission delay of the second packet; and the first device adjusts an actual sending moment of the first packet or an actual sending moment of the second packet based on the first delay difference; or the first device sends third information to the second device or the third device, where the third information indicates the first delay difference.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the second device receives the any packet, and the sending time of the first packet is time at which the first device sends the any packet to the second device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the first packet based on the first delay difference” may be understood as that the first device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the third device receives the any packet, and the sending time of the any packet is time at which the first device sends the any packet to the third device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the second packet based on the first delay difference” may be understood as that the first device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
In an embodiment, the first device (the source end device) may calculate a relative transmission delay difference (namely, the first delay difference) between the first packet and the second packet based on the transmission delay of the first packet and the transmission delay of the second packet, and the first device adjusts the actual sending moment of the first packet or the actual sending moment of the second packet based on the first delay difference; or the first device sends the third information to the second device, where the third information indicates the first delay difference, so that the second device adjusts a processing moment of the first packet; or the first device sends the third information to the third device, where the third information indicates the first delay difference, so that the third device adjusts a processing moment of the second packet. In this way, after the first packet and the second packet each are processed by a corresponding sink end device, play time of the first data stream in the first packet is synchronized with play time of the second data stream in the second packet.
It may be understood that the processing moment of the first packet is a start moment at which the second device processes the first packet. The processing moment of the second packet is a start moment at which the third device processes the second packet.
In an embodiment, the method further includes: The first device obtains a processing delay of the first packet and a processing delay of the second packet; the first device determines a second delay difference based on the processing delay of the first packet and the processing delay of the second packet; and the first device adjusts the actual sending moment of the first packet or the actual sending moment of the second packet based on the second delay difference; or the first device sends fourth information to the second device or the third device, where the fourth information indicates the second delay difference.
It may be understood that the processing delay of the first packet is time required for the second device to perform one or more processes such as decapsulating the first packet, decoding or rendering the first data stream in the first packet, or the like. The processing delay of the second packet is time required for the third device to perform one or more processes such as decapsulating the second packet, decoding or rendering the second data stream in the second packet, or the like.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the second device receives the any packet, and the sending time of the first packet is time at which the first device sends the any packet to the second device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the first packet based on the second delay difference” may be understood as that the first device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the third device receives the any packet, and the sending time of the any packet is time at which the first device sends the any packet to the third device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the second packet based on the second delay difference” may be understood as that the first device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
In an embodiment, the first device (the source end device) may obtain the processing delay of the first packet and the processing delay of the second packet, and determine the second delay difference based on the processing delay of the first packet and the processing delay of the second packet; and the first device adjusts the actual sending moment of the first packet or the actual sending moment of the second packet based on the second delay difference; or the first device sends the fourth information to the second device, where the fourth information indicates the second delay difference, so that the second device adjusts the processing moment of the first packet; or the first device sends the fourth information to the third device, where the fourth information indicates the second delay difference, so that the third device adjusts a processing moment of the second packet. In this way, after the first packet and the second packet each are processed by a corresponding sink end device, play time of the first data stream in the first packet is synchronized with play time of the second data stream in the second packet.
It may be understood that the foregoing two implementations may be implemented separately or may be implemented in combination.
In an embodiment, that the first device obtains a processing delay of the first packet and a processing delay of the second packet includes: The first device receives first indication information from the second device, where the first indication information indicates the processing delay of the first packet; and the first device receives second indication information from the third device, where the second indication information indicates the processing delay of the second packet.
In an embodiment, the first indication information is carried in first signaling, and the second indication information is carried in second signaling. The first signaling and the second signaling may be implemented in a plurality of manners, for example, may be implemented by using any one of a real-time transport control protocol (RTCP), a real-time streaming protocol (RTSP), or a source service access protocol (SSAP).
In an embodiment, the first indication information and the first indication information are carried in the communication signaling, so that the first device can flexibly obtain the processing delay of the first packet and the processing delay of the second packet.
In an embodiment, the method further includes: The first device sends first acknowledgment information to the second device after receiving the first indication information, where the first acknowledgment information indicates that the first indication information has been successfully received; and the first device sends second acknowledgment information to the third device after receiving the second indication information, where the second acknowledgment information indicates that the second indication information has been successfully received.
In an embodiment, the first device may further send the first acknowledgment information to the second device after receiving the first indication information, where the first acknowledgment information indicates that the first indication information has been successfully received; and the first device may further send the second acknowledgment information to the third device after receiving the second indication information, where the second acknowledgment information indicates that the second indication information has been successfully received. In this way, the second device and the third device can learn a receiving status of the related indication information, so that the second device can send the first indication information again when the first indication information is not successfully received, and the third device can send the second indication information again when the second indication information is not successfully received. This effectively improves communication reliability.
According to a second aspect, an embodiment of this application further provides a data transmission method. The method includes: A second device receives a first packet from a first device, where the first packet includes a first data stream and a sampling time sequence of the first data stream, the first packet corresponds to a first communication protocol, and the sampling time sequence of the first data stream is a time sequence whose value is in a unit of a system clock of a codec of the first device; the second device receives a third packet from the first device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec of the first device, and the third packet corresponds to a second communication protocol; and the second device maps, based on the device time information and the time sequence value that corresponds to the system clock of the codec, the sampling time sequence of the first data stream to a first moment on a time axis on which the device time information of the first device is located, where the device time information of the first device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship.
In an embodiment, the device time information of the first device represents air interface time of the first device.
In an embodiment, the method further includes: The second device receives a system message from the first device, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first OFDM symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector; or the second device receives data link layer control plane data from the first device, where the data link layer control plane data includes clock information, and the clock information is associated with device time information; and the second device performs clock synchronization with the first device based on the clock information.
In an embodiment, the method further includes: The second device determines a transmission delay of the first packet based on the first moment and a second moment; and the second device sends first information to the first device, where the first information indicates the transmission delay of the first packet; and receiving time of the first packet and the second moment meet the first mapping relationship.
In an embodiment, the second device determines the transmission delay of the first packet based on the first moment obtained after the sampling time sequence of the first data stream is mapped and the second moment obtained after the receiving time of the first packet is mapped, so that the determined transmission delay of the first packet is more accurate.
In an embodiment, the method further includes: The second device receives third information from the first device, where the third information indicates a first delay difference, the first delay difference is a difference between the transmission delay of the first packet and a transmission delay of a second packet, and the second packet is sent by the first device to a third device; and the second device adjusts a processing moment of the first packet based on the first delay difference.
In an embodiment, the method further includes: The second device receives fourth information from the first device, where the fourth information indicates a second delay difference, the second delay difference is a difference between a processing delay of the first packet and a processing delay of the second packet, and the second packet is sent by the first device to the third device; and the second device adjusts the processing moment of the first packet based on the second delay difference.
In an embodiment, the method further includes: The second device sends first indication information to the first device, where the first indication information indicates the processing delay of the first packet.
In an embodiment, the first indication information is carried in first signaling.
In an embodiment, the method further includes: The second device receives first acknowledgment information from the second device after sending the first indication information, where the first acknowledgment information indicates that the first indication information has been successfully received.
According to a third aspect, an embodiment of this application provides a data transmission method. The method is applicable to a scenario of inter-stream synchronization between different data streams between a plurality of source end devices and one sink end device.
An example in which the source end devices are a second device and a third device, and the sink end device is a first device is used. The method includes: A first device receives a first packet from a second device, where the first packet includes a first data stream and a sampling time sequence of the first data stream; the first device receives a second packet from a third device, where the second packet includes a second data stream and a sampling time sequence of the second data stream, the first packet and the second packet correspond to a first communication protocol, and the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device; the first device receives a third packet from the second device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the second device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec, the device time information of the second device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship, and the third packet corresponds to a second communication protocol; the first device receives a fourth packet from the third device, where the fourth packet includes a third time stamp and a fourth time stamp, the third time stamp indicates device time information of the third device, the fourth time stamp indicates a time sequence value corresponding to the system clock of the codec, the device time information of the third device and the time sequence value that corresponds to the system clock of the codec meet a second mapping relationship, and the fourth packet corresponds to the second communication protocol; and the first device maps, based on device time information of the first device, the device time information of the second device, the device time information of the third device, and the time sequence value corresponding to the system clock of the codec, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream to a time axis on which the device time information of the first device is located, or a time axis on which the device time information of the second device is located, or a time axis on which the device time information of the third device is located.
In an embodiment of the application, the time axis on which the device time information of the first device is located, the time axis on which the device time information of the second device is located, and the time axis on which the device time information of the third device is located are mutually synchronized.
In embodiments of this application, the first device may periodically receive the first packet from the second device, and the first device may periodically receive the second packet from the third device.
It can be learned from the foregoing that the first packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the second device to the first device, includes the first data stream and the sampling time sequence of the first data stream, and corresponds to the first communication protocol.
The second packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the third device to the first device, includes the second data stream and the sampling time sequence of the second data stream, and corresponds to the first communication protocol. The first data stream and the second data stream may be audio streams or video streams. For example, the first data stream and the second data stream are different video streams. For another example, the first data stream is a video stream, and the second data stream is an audio stream.
In addition, in embodiments of this application, the first device may periodically receive the third packet from the second device, and the first device may periodically receive the fourth packet from the third device.
It can be learned from the foregoing that the third packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the second device to the first device, includes a first time stamp and a second time stamp, where the first time stamp indicates the device time information of the second device, and the second time stamp indicates the time sequence value corresponding to the system clock of the codec, and corresponds to the second communication protocol.
The fourth packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the third device to the first device, includes a third time stamp and a fourth time stamp, where the third time stamp indicates the device time information of the third device, and the fourth time stamp indicates the time sequence value corresponding to the system clock of the codec, and corresponds to the second communication protocol.
In this solution, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are converted to a same time axis, so that actual sending moments and/or processing moments of the first packet and the second packet are subsequently correspondingly adjusted, to implement inter-stream synchronization between the first data stream in the first packet and the second data stream in the second packet.
In an embodiment, the device time information of the second device represents air interface time of the second device, and the device time information of the third device represents air interface time of the third device.
In an embodiment, the device time information of the first device represents air interface time of the first device.
In an embodiment, the method further includes: The first device sends a system message, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first OFDM symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector; or the first device sends data link layer control plane data to the second device and the third device, where the data link layer control plane data includes clock information, where the clock information is associated with the device time information of the first device, and the clock information is used by the second device and the third device to perform clock synchronization with the first device.
In an embodiment, when the first device, the second device, and the third device belong to an SLB system, the first device sends the system message.
In an embodiment, when the first device, the second device, and the third device belong to an SLE system, the first device sends the data link layer control plane data to the second device and the third device.
In an embodiment, the method further includes: The first device determines a transmission delay of the first packet based on a first moment and a second moment, where the sampling time sequence of the first data stream and the first moment meet the first mapping relationship, and receiving time of the first packet and the second moment meet the first mapping relationship; the first device determines a transmission delay of the second packet based on a third moment and a fourth moment, where the sampling time sequence of the second data stream and the third moment meet the second mapping relationship, and receiving time of the second packet and the fourth moment meet the second mapping relationship; the first device determines a first delay difference between the transmission delay of the first packet and the transmission delay of the second packet based on the transmission delay of the first packet and the transmission delay of the second packet; and the first device adjusts a processing moment of the first packet or a processing moment of the second packet based on the first delay difference; or the first device sends first information to the second device or the third device, where the first information indicates the first delay difference.
In an embodiment, the first device (the sink end device) may determine the transmission delay of the first packet based on the first moment and the second moment, and determine the transmission delay of the second packet based on the third moment and the fourth moment. Further, the first device calculates a relative transmission delay difference (namely, the first delay difference) between the first packet and the second packet based on the transmission delay of the first packet and the transmission delay of the second packet, and the first device adjusts the processing moment of the first packet or the processing moment of the second packet based on the first delay difference. Alternatively, the first device sends third information to the second device, where the third information indicates the first delay difference, so that the second device adjusts the actual sending moment of the first packet based on the first delay difference; or the first device sends third information to the third device, where the third information indicates the first delay difference, so that the third device adjusts the actual sending moment of the second packet based on the first delay difference. In this way, after the first packet and the second packet are processed by the first device (the sink end device), play time of the first data stream in the first packet is synchronized with play time of the second data stream in the second packet.
It may be understood that the processing moment of the first packet is a start moment at which the first device processes the first packet. The processing moment of the second packet is a start moment at which the first device processes the second packet.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the first device receives the any packet, and the sending time of the first packet is time at which the second device sends the any packet to the first device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the second device adjusts the actual sending moment of the first packet based on the first delay difference” may be understood as that the second device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the first device receives the any packet, and the sending time of the any packet is time at which the third device sends the any packet to the first device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the third device adjusts the actual sending moment of the first packet based on the first delay difference” may be understood as the third device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
In an embodiment, the method further includes: The first device determines a second delay difference based on a processing delay of the first packet and a processing delay of the second packet; and the first device adjusts the processing moment of the first packet or the processing moment of the second packet based on the second delay difference; or the first device sends second information to the second device or the third device, where the second information indicates the second delay difference.
It may be understood that the processing delay of the first packet is time required for the first device to perform one or more processes such as decapsulating the first packet, decoding or rendering the first data stream in the first packet, or the like. The processing delay of the second packet is time required for the first device to perform one or more processes such as decapsulating the second packet, decoding or rendering the second data stream in the second packet, or the like.
In an embodiment, the first device (the sink end device) may determine the second delay difference based on the processing delay of the first packet and the processing delay of the second packet; and the first device adjusts the processing moment of the first packet or the processing moment of the second packet based on the second delay difference; or the first device sends fourth information to the second device, where the fourth information indicates the second delay difference, so that the second device adjusts the actual sending moment of the first packet; or the first device sends fourth information to the third device, where the fourth information indicates the second delay difference, so that the third device adjusts the actual sending moment of the second packet. In this way, after the first packet and the second packet are processed by the first device (the sink end device), the play time of the first data stream in the first packet is synchronized with the play time of the second data stream in the second packet.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the second device receives the any packet, and the sending time of the first packet is time at which the first device sends the any packet to the second device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the second device adjusts the actual sending moment of the first packet based on the second delay difference” may be understood as that the second device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the third device receives the any packet, and the sending time of the any packet is time at which the first device sends the any packet to the third device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the third device adjusts the actual sending moment of the second packet based on the second delay difference” may be understood as that the third device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
According to a fourth aspect, an embodiment of this application provides a data transmission method. The method includes: A second device sends a first packet to a first device, where the first packet includes a first data stream and a sampling time sequence of the first data stream, and the first packet corresponds to a first communication protocol; and the second device sends a third packet to the first device, where the third packet includes device time information of the second device and a time sequence value that corresponds to a system clock of a codec of the first device, and the third packet corresponds to a second communication protocol.
In an embodiment, the device time information of the second device represents air interface time of the second device.
In an embodiment, the method further includes: The second device receives a system message from the first device, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first OFDM symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector; or the second device receives data link layer control plane data from the first device, where the data link layer control plane data includes clock information, and the clock information is associated with the device time information of the first device; and the second device performs clock synchronization with the first device based on the clock information, for the device time information of the second device to be consistent with the device time information of the first device.
In an embodiment, before the second device sends the third packet to the first device, the method further includes: The second device obtains the device time information of the second device.
In an embodiment, that the second device obtains the device time information of the second device includes: The second device obtains the device time information of the second device by using an inter-layer primitive of a protocol stack.
In an embodiment, the protocol stack includes a first protocol layer, a second protocol layer, and a third protocol layer; and correspondingly, that the second device obtains the device time information of the second device by using an inter-layer primitive of a protocol stack includes: The first protocol layer sends a first inter-layer primitive to the second protocol layer, where the first inter-layer primitive is used by the first protocol layer to request the second protocol layer to query the device time information of the second device; the second protocol layer sends a second inter-layer primitive to the third protocol layer, where the second inter-layer primitive is used by the second protocol layer to request the third protocol layer to query the device time information of the second device; the second protocol layer receives a third inter-layer primitive from the third protocol layer, where the third inter-layer primitive is used by the third protocol layer to indicate the device time information of the second device to the second protocol layer; and the first protocol layer receives a fourth inter-layer primitive from the second protocol layer, where the fourth inter-layer primitive is used by the second protocol layer to indicate the device time information of the second device to the first protocol layer.
In an embodiment, the method further includes: The second device receives first information from the first device, where the first information indicates a first delay difference, the first delay difference is a difference between a transmission delay of the first packet and a transmission delay of a second packet, and the second packet is sent by a third device to the first device; and the second device adjusts an actual sending moment of the first packet based on the first delay difference.
In an embodiment, the method further includes: The second device receives second information from the first device, where the second information indicates a second delay difference, the second delay difference is a difference between a processing delay of the first packet and a processing delay of the second packet, and the second packet is sent by the third device to the first device; and the second device adjusts the actual sending moment of the first packet based on the second delay difference.
According to a fifth aspect, an embodiment of this application further provides a communication apparatus, including a unit configured to implement the method according to any one of the first aspect and the possible implementations of the first aspect, or including a unit configured to implement the method according to any one of the second aspect and the possible implementations of the second aspect, or including a unit configured to implement the method according to any one of the third aspect and the possible implementations of the third aspect, or including a unit configured to implement the method according to any one of the fourth aspect and the possible implementations of the fourth aspect.
According to a sixth aspect, an embodiment of this application further provides a chip system, including at least one processor and an interface circuit. The processor is configured to execute instructions and/or data exchange through the interface circuit, so that the chip system performs the method according to any one of the first aspect and the possible implementations of the first aspect, or performs the method according to any one of the second aspect and the possible implementations of the second aspect, or performs the method according to any one of the third aspect and the possible implementations of the third aspect; or performs the method according to any one of the fourth aspect or the possible implementations of the fourth aspect.
According to a seventh aspect, an embodiment of this application further provides a terminal, including the apparatus according to the fifth aspect or the chip system according to the sixth aspect.
According to an eighth aspect, an embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are run on a computer, the computer is enabled to perform the method according to any one of the first aspect or the possible implementations of the first aspect, or perform the method according to any one of the second aspect or the possible implementations of the second aspect, or perform the method according to any one of the third aspect or the possible implementations of the third aspect; or perform the method according to any one of the fourth aspect or the possible implementations of the fourth aspect.
According to a ninth aspect, an embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are run on a computer, the computer is enabled to perform the method according to any one of the first aspect or the possible implementations of the first aspect, or perform the method according to any one of the second aspect or the possible implementations of the second aspect, or perform the method according to any one of the third aspect or the possible implementations of the third aspect; or perform the method according to any one of the fourth aspect or the possible implementations of the fourth aspect.
For effect corresponding to the second aspect, the fourth aspect, and the ninth aspect, refer to related descriptions of the first aspect or the third aspect. Details are not described herein again.
To make objectives, technical solution, and advantages of embodiments of this application clearer, the following further describes embodiments of this application in detail with reference to accompanying drawings.
The following describes some terms in embodiments of this application, to facilitate understanding of one of ordinary skilled in the art.
Intra-stream synchronization means that a receiver does not decode and play a frame of data immediately after receiving the frame of data. Instead, the receiver plays the frame of data when the inter-frame interval arrives. Each frame of data sent from a transmitter has a time stamp, and the time stamp indicates a time point at which the first sampling point of the frame is collected. When encapsulating the frame of data into a data packet, the transmitter writes the time stamp into a packet header of the data packet. Therefore, the receiver may determine a time interval between two adjacent frames based on a difference between time stamps of two adjacent frames, and after receiving a frame of data, the receiver calculates play time of the current frame based on play time of the previous frame and the time interval. The receiving end does not play the frame data quickly or slowly, that is, intra-stream synchronization between the frame data is implemented.
Inter-stream synchronization means that play time of different data streams is synchronized. For example, the inter-stream synchronization may mean that play time of two different audio streams is synchronized. For another example, the inter-stream synchronization may mean that play time of two different video streams is synchronized. For another example, the inter-stream synchronization may mean that play time of an audio stream and a video stream is synchronized, and is also referred to as audio-to-image synchronization. In a case of audio-to-image synchronization, each frame of image being rendered by the video player one-to-one corresponds to each segment of sound being played by the audio player, and there is no deviation that can be distinguished by human ears and human eyes.
In a case of audio-to-image asynchronization, a user perceives that an image and a sound are not synchronized. As shown in
The time stamp carried in each data stream is determined based on an encoder system clock of a source device to which the data stream belongs. An audio stream and a video stream are used as an example of a data stream. A source device to which the audio stream belongs may record, based on a sampling frequency and a frame rate of the audio, a sampling time stamp of each audio frame in the audio stream and a time stamp interval between each audio frame and an adjacent audio frame. For example, the sampling frequency of the audio frame is 8000 Hz, the frame rate is 50 fps, and the time stamp interval of the audio frame is 160. Audio frame time stamps may form an audio time axis shown in
In an embodiment of the application, the RTCP SR packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the source end device, the second time stamp indicates a time sequence value corresponding to a system clock of a codec of the source end device, and the device time information of the source end device and the time sequence value that corresponds to the system clock of the codec of the source end device meet a first mapping relationship. In this way, after receiving the RTCP SR packet, the sink end device may map a sending time sequence of the data packet received by the sink end device to a time axis on which the device time information of the source end device is located.
In some embodiments of this application, the RTCP RR packet includes capability information of the sink end device, and the capability information of the sink end device carries a processing capability of the sink end device (that is, a delay required for performing some or more of processes such as decapsulation, decoding, and rendering on an RTP packet). In some other embodiments of this application, the RTCP RR packet may include the processing capability of the sink end device (that is, a delay required for performing processing such as encoding, decoding, and/or rendering on an RTP packet).
The following describes a communication system provided in an embodiment of the application with reference to accompanying drawings.
Similarly, the encoder in the source end device encodes the data stream 2 to obtain an encoding stream ES2; and the PES packetizer packages the encoding stream ES2 and the system clock of the codec to obtain a corresponding PES2 packet, where the PES2 packet includes the TS2. After encapsulating the PES2 packet based on the streaming media transmission related protocol (for example, the RTP), the transmitter Tx sends the encapsulated PES2 packet to the sink end device 2. The decapsulator in the sink end device 2 decapsulates the encapsulated PES2 packet to obtain the TS2. The decoder in the sink end device 2 decodes the TS2 to obtain the data stream 2 and plays the data stream 2. Time at which the sink end device 1 plays the data stream 1 needs to be synchronized with time at which the sink end device 2 plays the data stream 2, to implement inter-stream synchronization between the data stream 1 and the data stream 2.
For example, as shown in
Similarly, the source end device 2 generates a data stream 2, the encoder in the source end device 2 encodes the data stream 2 to obtain an encoding stream ES2, and the PES packetizer packs the encoding stream ES2 and the system clock of the codec to obtain a corresponding PES2 packet, where the PES2 packet includes a TS2. After encapsulating the PES2 packet based on a streaming media transmission related protocol (for example, the RTP), the transmitter Tx sends the encapsulated PES2 packet to the sink end device. The decapsulator in the sink end device decapsulates the encapsulated PES2 packet to obtain the TS2. The decoder in the sink end device decodes the TS2 to obtain the data stream 2 and plays the data stream 2. Time at which the sink end device plays the data stream 1 needs to be synchronized with time at which the sink end device plays the data stream 2, to implement inter-stream synchronization between the data stream 1 and the data stream 2.
For example, as shown in
Therefore, how to implement inter-stream synchronization between different data streams is an urgent technical problem that needs to be resolved by one of ordinary skilled in the art.
As shown in
The decapsulator in the WFD Rx1 may obtain local clock information of the WFD Rx1, and use the clock information as a slave clock. The decapsulator in the WFD Rx1 may correct the slave clock based on the received grandmaster clock, to implement synchronization (that is, phase synchronization and frequency synchronization) between the slave clock and the grandmaster clock. Similarly, the decapsulator in the WFD Rx2 may obtain local clock information of the WFD Rx2, and use the clock information as a slave clock. The decapsulator in the WFD Rx2 may correct the slave clock based on the received grandmaster clock, to implement synchronization between the slave clock and the grandmaster clock.
After the grandmaster clock and the slave clock are synchronized, the decapsulator in the WFD Rx1 decapsulates the video packet to obtain a video stream, and the decoder in the WFD Rx1 may decode and output the video stream. After the grandmaster clock and the slave clock are synchronized, the decapsulator in the WFD Rx2 decapsulates the audio packet to obtain an audio stream, and the decoder in the WFD Rx1 may decode and output the audio stream. In this way, the video stream and the audio stream can be played synchronously, thereby implementing audio-to-image synchronization.
The foregoing technical solution depends on gPTP hardware implementation, a synchronization protocol, and protocol implementation precision. For a device that does not support gPTP, inter-stream synchronization between different data streams cannot be implemented. In addition, gPTP needs to be implemented by using a dedicated chip, and consequently, costs and complexity of inter-stream synchronization are high.
In view of this, an embodiment of this application provides a data transmission method, to implement inter-stream synchronization between different data streams of separated sink end devices. The method includes: A first device sends a first packet to a second device, sends a second packet to a third device, and sends third packets to the second device and the third device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, and the second time stamp indicates time sequence value corresponding to a system clock of a codec of the first device. The device time information of the first device and the time sequence value that corresponds to the system clock of the codec of the first device meet a first mapping relationship. After receiving the third packet, the second device may map, based on the device time information of the first device and the time sequence value that corresponds to the system clock of the codec of the first device, a sampling time sequence of a first data stream to a first moment on a time axis on which the device time information is located. Similarly, after receiving the third packet, the third device may map, based on the device time information of the first device and the time sequence value that corresponds to the system clock of the codec of the first device, a sampling time sequence of a second data stream to a third moment on the time axis on which the device time information of the first device is located. In this way, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are converted to a same time axis, so that actual sending moments and/or processing moments of the first packet and the second packet are correspondingly adjusted, to implement inter-stream synchronization between the first data stream in the first packet and the second data stream in the second packet.
Embodiments of this application is applied to various wireless communication scenarios, especially a short-range wireless communication scenario, including but not limited to a scenario, for example, a smart car, smart transportation, a smart terminal, a smart home, and smart manufacturing. The short-range wireless communication technology may include a conventional short-range wireless communication technology, for example, a Bluetooth technology, a Bluetooth low energy (BLE) technology, a wireless fidelity (Wi-Fi) technology, a near field communication (NFC) technology, an ultra-wideband (UWB) technology, a universal short-range communication technology, or the like, and may also include an evolving communication technology or another communication technology that may emerge in the future, for example, a short-range wireless communication technology (briefly referred to as SparkLink technology) specified by the SparkLink Alliance. The SparkLink technology includes a SparkLink basic (SparkLink Basic, SLB) technology, a SparkLink Low Energy (SparkLink Basic, SLE) technology, and the like. This is not limited in this application.
S501: The first device sends a first packet to the second device. Correspondingly, the second device receives the first packet. The first packet includes a first data stream and a sampling time sequence of the first data stream.
S502: The first device sends a second packet to the third device. Correspondingly, the third device receives the second packet. The second packet includes a second data stream and a sampling time sequence of the second data stream.
In an embodiment of the application, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device. In other words, the sampling time sequence of the first data stream is a sampling time stamp obtained by sampling the first data stream at a preset frame rate by using the system clock of the codec of the first device as reference time; and the sampling time sequence of the second data stream is a sampling time stamp obtained by sampling the second data stream at a preset frame rate by using the system clock of the codec of the first device as reference time.
It may be understood that the first device may periodically send the first packet to the second device, and the first device may periodically send the second packet to the third device. It can be learned from the foregoing that the first packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the first device to the second device, includes the first data stream and the sampling time sequence of the first data stream, and corresponds to a first communication protocol. The second packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the first device to the third device, includes the second data stream and the sampling time sequence of the second data stream, and corresponds to the first communication protocol. The first data stream and the second data stream may be audio streams or video streams. For example, the first data stream and the second data stream are audio streams of different sound channels. For another example, the first data stream is a video stream, and the second data stream is an audio stream.
In an embodiment of the application, the first packet and the second packet correspond to the first communication protocol, and the first communication protocol may be, for example, RTP. “The first packet and the second packet correspond to the first communication protocol” may be understood as that the first packet and the second packet are encapsulated according to the first communication protocol.
For example, when the first packet is an RTP packet, a format of the first packet is shown in
S503: The first device sends a third packet to the second device. Correspondingly, the second device receives the third packet.
The third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec, and the device time information and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship.
The device time information of the first device represents air interface time of the first device. For example, the device time information of the first device may be a clock that is based on a 48 KHz sampling sequence value and that is exported through air interface synchronization of the first device.
In an embodiment of the application, the third packet corresponds to a second communication protocol, and the second communication protocol may be, for example, the RTCP. In other words, the third packet is encapsulated according to the second communication protocol.
For example, when the third packet is an RTCP SR packet, a packet header format of the third packet is shown in
In an embodiment of the application, the first device periodically sends the third packet to the second device.
In an embodiment of the application, before separately sending the third packet to the second device and the third device, the first device needs to obtain the device time information of the first device. In an embodiment, the first device may obtain the device time information by using an inter-layer primitive of a protocol stack. In this way, it is easy to obtain the device time information of the first device. This improves efficiency of subsequent inter-stream synchronization between different data streams. In addition, this manner does not depend on a protocol. This effectively reduces complexity and costs of the solution.
In an embodiment, the protocol stack includes a first protocol layer, a second protocol layer, and a third protocol layer; and correspondingly, that the first device obtains the device time information includes: The first protocol layer sends a first inter-layer primitive to the second protocol layer, where the first inter-layer primitive is used by the first protocol layer to request the second protocol layer to query the device time information; the second protocol layer sends a second inter-layer primitive to the third protocol layer, where the second inter-layer primitive is used by the second protocol layer to request the third protocol layer to query the device time information; the second protocol layer receives a third inter-layer primitive from the third protocol layer, where the third inter-layer primitive is used by the third protocol layer to indicate the device time information to the second protocol layer; and the first protocol layer receives a fourth inter-layer primitive from the second protocol layer, where the fourth inter-layer primitive is used by the second protocol layer to indicate the device time information to the first protocol layer.
For example,
It may be understood that the several functional units of the control plane are only examples rather than limitations, and there may be other functional units actually. In addition to providing the related functions of the control plane, the basic service layer may further provide a function of a data plane (or referred to as a user plane). For example, the basic service layer may query local time of the access layer by using an inter-layer primitive.
It should be understood that the protocol layers are only framework structure division. Different communication systems may have respective layer division manners, or may have more lower-level layer division. This is not specifically limited herein. In addition, a name of each protocol layer is only an example, and may alternatively be another name in actual application. A protocol layer may be considered as a protocol layer in an embodiment of the application provided that a function of the protocol layer is the same as or similar to a function of the protocol layer in an embodiment of the application.
Therefore, the application layer sends the first inter-layer primitive to the basic service layer, where the first inter-layer primitive is used by the application layer to request the basic service layer to query the device time information; the basic service layer sends the second inter-layer primitive to the third protocol layer, where the second inter-layer primitive is used by the basic service layer to request the access layer to query the device time information; the basic service layer receives the third inter-layer primitive from the access layer, where the third inter-layer primitive is used by the access layer to indicate device time information to the basic service layer; and the application layer receives the fourth inter-layer primitive from the basic service layer, where the fourth inter-layer primitive is used by the basic service layer to indicate the device time information to the application layer.
For example, the first inter-layer primitive may be a LocalTime.request inter-layer primitive, and the LocalTime.request inter-layer primitive is used by the application layer to request the basic service layer to query the device time information of the access layer. A definition of the LocalTime.request primitive is as follows. For details, refer to related descriptions in Table 1.
The second inter-layer primitive may be a SparkLink VirtualLocalTime.inquiry primitive that is used by the basic service layer to request the access layer to query device time information. A definition of the SparkLink VirtualLocalTime.inquiry primitive is as follows. For details, refer to related descriptions in Table 2.
The third inter-layer primitive may be an SparkLinkASParametersInquiry.response primitive that is used by the access layer to reply the device time information requested the basic service layer to query. A definition of the SparkLinkASParametersInquiry.response primitive is as follows. For details, refer to related descriptions in Table 3.
The fourth inter-layer primitive is LocalTime.response, and LocalTime.response is used by the basic service layer to reply the local time information requested the application layer to query. A definition of the LocalTime.response primitive is as follows. For details, refer to related descriptions in Table 4.
S504: The second device establishes a mapping relationship based on the device time information and the time sequence value that corresponds to the system clock of the codec.
For example, the second device may obtain the following mapping relationship by performing linear regression on the device time information and the time sequence value that corresponds to the system clock of the codec: TSFN=f(S_TSFN)=k*S_TSFN+b.
TSFN is the device time information, and S_TSFN is the time sequence value corresponding to the system clock of the codec.
For example, the device time information may be, for example, a clock that is exported through local air interface synchronization of the source end device based on a 48 kHz sampling sequence value, and the time sequence value corresponding to the system clock of the codec may be, for example, a time sequence value generated based on a 48 kHz system clock.
S505: The second device maps the sampling time sequence of the first data stream to a time axis on which the device time information is located.
It may be understood that the second device maps the sampling time sequence of the first data stream to the time axis on which the device time information is located, in other words, the second device converts the sampling time sequence of the first data stream to the time axis on which the device time information is located, so that the converted sampling time sequence of the first data stream and the device time information are on a same time axis.
S506: The first device sends the third packet to the third device. Correspondingly, the third device receives the third packet.
S507: The third device establishes the first mapping relationship based on the device time information and the time sequence value that corresponds to the system clock of the codec. This operation is optional, and the first mapping relationship is implicit, and there may be no independent establishment process.
S508: The third device maps the sampling time sequence of the second data stream to the time axis on which the device time information is located.
In the embodiment shown in
It may be understood that, the sink end device needs to perform decoding and rendering based on frame rates of the first data stream and the second data stream, to ensure smooth play. On this basis, a relative delay between the first data stream and the second data stream needs to be calculated, and related processing moments of the first data stream and the second data stream need to be adjusted correspondingly, to implement inter-stream synchronization between the first data stream and the second data stream. There are transmission delays for the first packet and the second packet, and a transmission delay of the first packet may be different from a transmission delay of the second packet. To implement inter-stream synchronization between the first data stream in the first packet and the second data stream in the second packet, the transmission delay of the first packet and the transmission delay of the second packet need to be considered.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the second device receives the any packet, and the sending time of the first packet is time at which the first device sends the any packet to the second device. Correspondingly, an actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the first packet based on a first delay difference” may be understood as that the first device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the third device receives the any packet, and the sending time of the any packet is time at which the first device sends the any packet to the third device. Correspondingly, an actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the first packet based on the first delay difference” may be understood as that the first device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
In an embodiment, the second device maps, based on the device time information and the time sequence value that corresponds to the system clock of the codec, the sampling time sequence of the first data stream to a first moment on the time axis on which the device time information is located, where the sampling time sequence of the first data stream and the first moment meet the first mapping relationship; the second device maps, based on the device time information and the time sequence value that corresponds to the system clock of the codec, receiving time of the first packet to a second moment on the time axis on which the device time information is located, where the receiving time of the first packet and the second moment meet the first mapping relationship; the second device determines the transmission delay of the first packet based on the first moment and the second moment; and the second device sends first information to the first device, where the first information indicates the transmission delay of the first packet. Similarly, the third device maps, based on the device time information and the time sequence value that corresponds to the system clock of the codec, the sampling time sequence of the second data stream to a third moment on the time axis on which the device time information is located, where the sampling time sequence of the second data stream and the third moment meet the first mapping relationship; the third device maps, based on the device time information and the time sequence value that corresponds to the system clock of the codec, receiving time of the second packet to a fourth moment on the time axis on which the device time information is located and the receiving time of the second packet and the fourth moment meet the first mapping relationship; and the third device determines the transmission delay of the second packet based on the third moment and the fourth moment, and sends second information to the first device, where the second information indicates the transmission delay of the second packet. Correspondingly, the first device may receive the first information and the second information, and determine the first delay difference between the transmission delay of the first packet and the transmission delay of the second packet based on the transmission delay of the first packet and the transmission delay of the second packet.
First delay difference=Transmission delay of the first packet-Transmission delay of the second packet. For example, the first packet is a video packet, and the second packet is an audio packet. As shown in
In an embodiment, the first device may adjust, based on the first delay difference, the actual sending moment of the first packet or the actual sending moment of the second packet, so that time at which the second device plays the first data stream is synchronized with time at which the third device plays the second data stream.
It may be understood that, it is assumed that the sending time of the first packet is the same as the sending time of the second packet, and the first delay difference is positive, the transmission delay of the first packet is greater than the transmission delay of the second packet, that is, the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is later than the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Therefore, the first device needs to adjust the actual sending moment of the first packet to a moment that is the first delay difference earlier than the actual sending moment of the second packet, so that the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is the same as the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Alternatively, the first device needs to adjust the actual sending moment of the second packet to a moment that is the delay difference later than the actual sending moment of the second packet, so that the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is the same as the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Example 1: If the first delay difference is 50 ms, the first device may adjust the actual sending moment of the first packet to a moment that is 50 ms earlier than the actual sending moment of the second packet, so that the time at which the first packet is received by the second device is the same as the time at which the second packet is received by the third device, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 2: If the first delay difference is 20 ms, the first device may adjust the actual sending moment of the second packet to a moment that is 20 ms later than the actual sending moment of the first packet, so that the time at which the first packet is received by the second device is the same as the time at which the second packet is received by the third device, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device.
It may be understood that, it is assumed that the sending time of the first packet is the same as the sending time of the second packet, and the first delay difference is negative, the transmission delay of the first packet is less than the transmission delay of the second packet, that is, the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is earlier than the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Therefore, the first device needs to adjust the actual sending moment of the first packet to a moment that is the first delay difference later than the actual sending moment of the second packet, so that the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is the same as the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Alternatively, the first device needs to adjust the actual sending moment of the second packet to a moment that is the delay difference earlier than the actual sending moment of the second packet, so that the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is the same as the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Example 1: If the first delay difference is −50 ms, the first device may adjust the actual sending moment of the first packet to a time sequence that is 50 ms later than the actual sending moment of the second packet, so that the time at which the first packet is received by the second device is the same as the time at which the second packet is received by the third device, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 2: If the first delay difference is −20 ms, the first device may adjust the actual sending moment of the second packet to a time sequence that is 20 ms earlier than the actual sending moment of the first packet, so that the time at which the first packet is received by the second device is the same as the time at which the second packet is received by the third device, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device.
It may be understood that, it is assumed that the sending time of the first packet is the same as the sending time of the second packet, and the first delay difference is 0, the transmission delay of the first packet is equal to the transmission delay of the second packet, that is, the time at which the first packet is received by the sink end device (namely, the second device) corresponding to the first packet is the same as the time at which the second packet is received by the sink end device (namely, the third device) corresponding to the second packet. Therefore, the first device does not need to adjust the actual sending moment of the first packet and the actual sending moment of the second packet.
In an embodiment, the first device sends third information to the second device or the third device, where the third information indicates the first delay difference; and the second device may adjust the processing moment of the first packet based on the first delay difference, or the third device may adjust the processing moment of the second packet based on the first delay difference, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream.
It may be understood that the processing moment of the first packet is a start moment at which the second device processes the first packet. The processing moment of the second packet is a start moment at which the third device processes the second packet. In an embodiment, it is assumed that the processing delays of the first packet and the second packet are the same. Therefore, when the first delay difference is not zero, the second device may adjust the processing moment of the first packet based on the moment of the first delay difference; or the third device may adjust the processing moment of the second packet based on the moment of the first delay difference. In this way, a moment at which the sink end device (namely, the second device) corresponding to the first packet finishes processing the first packet is the same as a moment at which the sink end device (namely, the third device) corresponding to the second packet finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device.
When the first delay difference is positive, the second device adjusts the processing moment of the first packet to a moment that is the first delay difference earlier than the processing moment of the second packet; or when the first delay difference is positive, the third device adjusts the processing moment of the second packet to a moment that is the first delay difference later than the processing moment of the first packet. Example 1: If the first delay difference is 50 ms, the second device may adjust the processing moment of the first packet to a moment that is 50 ms earlier than the processing moment of the second packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 2: If the first delay difference is 20 ms, the third device may adjust the processing moment of the second packet to a moment that is 20 ms later than the processing moment of the second packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device.
When the first delay difference is negative, the second device adjusts the processing moment of the first packet to a moment that is the first delay difference later than the processing moment of the second packet; or when the first delay difference is negative, the third device adjusts the processing moment of the second packet to a moment that is the first delay difference earlier than the processing moment of the first packet. Example 1: If the first delay difference is −50 ms, the second device may adjust the processing moment of the first packet to a moment that is 50 ms later than the processing moment of the second packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 2: If the first delay difference is −20 ms, the third device may adjust the processing moment of the second packet to a moment that is 20 ms earlier than the processing moment of the second packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device.
To achieve inter-stream synchronization between different data streams, the first device needs to consider the processing delay of the first packet and the processing delay of the second packet. The processing delay of the first packet may include but is not limited to time required for the second device to perform one or more processes such as decapsulating the first packet, or decoding or rendering the first data stream in the first packet. The processing delay of the second packet includes but is not limited to one or more processes, performed by the third device, such as decapsulating the second packet, or decoding or rendering the first data stream in the second packet.
In an embodiment, the first device may obtain the processing delay of the first packet and the processing delay of the second packet; and the first device determines a second delay difference based on the processing delay of the first packet and the processing delay of the second packet.
It may be understood that the processing delay of the first packet may include but is not limited to time required for the second device to perform one or more processes such as decapsulating the first packet, or decoding or rendering the first data stream in the first packet. The processing delay of the second packet may include but is not limited to time required for the third device to perform one or more processes such as decapsulating the second packet, or decoding or rendering the second data stream in the second packet.
Further, in an embodiment, the first device may adjust the actual sending moment of the first packet or the actual sending moment of the second packet based on the second delay difference, to implement inter-stream synchronization between the first data stream and the second data stream. It may be understood that, in an embodiment, it is assumed that the transmission delay of the first packet is the same as the transmission delay of the second packet, and it is assumed that the second device starts to process the first packet after receiving the first packet, and the third device starts to process the second packet after receiving the second packet.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the second device receives the any packet, and the sending time of the first packet is time at which the first device sends the any packet to the second device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the first packet based on the second delay difference” may be understood as that the first device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the third device receives the any packet, and the sending time of the any packet is time at which the first device sends the any packet to the third device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the first device adjusts the actual sending moment of the second packet based on the second delay difference” may be understood as that the first device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
If the second delay difference is positive, the processing delay of the first packet is greater than the processing delay of the second packet, that is, a moment at which the sink end device (namely, the second device) corresponding to the first packet finishes processing the first packet is later than a moment at which the sink end device (namely, the third device) corresponding to the second packet finishes processing the second packet. Therefore, a start moment at which the second device processes the first packet needs to be earlier than a start moment at which the third device processes the second packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet. Herein, the first device adjusts the actual sending moment of the first packet to a moment that is the first delay difference earlier than the actual sending moment of the second packet, or the first device adjusts the actual sending moment of the second packet to a moment that is the first delay difference later than the actual sending moment of the first packet, so that the start moment at which the second device processes the first packet is earlier than the start moment at which the third device processes the second packet, and a moment at which the second device finishes processing the first packet is the same as a moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 1: If the second delay difference is 30 ms, the first device may adjust the actual sending moment of the first packet to a moment that is 30 ms earlier than the actual sending moment of the second packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream. Example 2: If the second delay difference is 20 ms, the first device may adjust the actual sending moment of the second packet to a time sequence that is 20 ms later than the actual sending moment of the first packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream.
If the second delay difference is negative, the processing delay of the first packet is less than the processing delay of the second packet, that is, a moment at which the sink end device (namely, the second device) corresponding to the first packet finishes processing the first packet is earlier than a moment at which the sink end device (namely, the third device) corresponding to the second packet finishes processing the second packet. Therefore, a start moment at which the second device processes the first packet needs to be later than a start moment at which the third device processes the second packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet. Herein, the first device adjusts the actual sending moment of the first packet to a moment that is the first delay difference later than the actual sending moment of the second packet, or the first device adjusts the actual sending moment of the second packet to a moment that is the first delay difference earlier than the actual sending moment of the first packet, so that the start moment at which the second device processes the first packet is earlier than the start moment at which the third device processes the second packet, and a moment at which the second device finishes processing the first packet is the same as a moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 1: If the second delay difference is-30 ms, the first device may adjust the actual sending moment of the first packet to a moment that is 30 ms later than the actual sending moment of the second packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream. Example 2: If the second delay difference is-20 ms, the first device may adjust the actual sending moment of the second packet to a time sequence that is 20 ms earlier than the actual sending moment of the first packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream.
In an embodiment, the first device may send fourth information to the second device or the third device, where the fourth information indicates the second delay difference, so that the second device may adjust the processing moment of the first packet based on the second delay difference after receiving the fourth information. Alternatively, after receiving the fourth information, the third device may adjust the processing moment of the second packet based on the second delay difference, so that time at which the second device plays the first data stream is synchronized with time at which the third device plays the second data stream, to implement inter-stream synchronization between the first data stream and the second data stream. It may be understood that, in an embodiment, the processing moment of the first packet is the start moment at which the second device processes the first packet. The processing moment of the second packet is the start moment at which the third device processes the second packet.
If the second delay difference is positive, the processing delay of the first packet is greater than the processing delay of the second packet, that is, a moment at which the sink end device (namely, the second device) corresponding to the first packet finishes processing the first packet is later than a moment at which the sink end device (namely, the third device) corresponding to the second packet finishes processing the second packet. Therefore, the second device needs to adjust the processing moment of the first packet to be earlier than the processing moment of the second packet, or the third device needs to adjust the processing moment of the second packet to be later than the processing moment of the first packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 1: If the second delay difference is 10 ms, the second device may adjust the processing moment of the first packet to a time sequence that is 10 ms earlier than the processing moment of the second packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream. Example 2: If the first delay difference is 20 ms, the third device may adjust the processing moment of the second packet to a time sequence that is 20 ms later than the processing moment of the second packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream.
If the second delay difference is positive, the processing delay of the first packet is less than the processing delay of the second packet, that is, a moment at which the sink end device (namely, the second device) corresponding to the first packet finishes processing the first packet is earlier than a moment at which the sink end device (namely, the third device) corresponding to the second packet finishes processing the second packet. Therefore, the second device needs to adjust the processing moment of the first packet to be later than the processing moment of the second packet, or the third device needs to adjust the processing moment of the second packet to be earlier than the processing moment of the first packet, so that the moment at which the second device finishes processing the first packet is the same as the moment at which the third device finishes processing the second packet, thereby implementing time synchronization between playing the first data stream by the second device and playing the second data stream by the third device. Example 1: If the second delay difference is −10 ms, the second device may adjust the processing moment of the first packet to a time sequence that is 10 ms later than the processing moment of the second packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream. Example 2: If the first delay difference is −20 ms, the third device may adjust the processing moment of the second packet to a time sequence that is 20 ms earlier than the processing moment of the second packet, so that the time at which the second device plays the first data stream is synchronized with the time at which the third device plays the second data stream.
S601: The first device receives first indication information from a second device, where the first indication information indicates the processing delay of the first packet. Correspondingly, the second device sends the first indication information.
S602: The first device receives second indication information from a third device, where the second indication information indicates the processing delay of the second packet. Correspondingly, the third device sends the second indication information.
In an embodiment, the procedure further includes the following operations.
S603: The first device sends first acknowledgment information to the second device, where the first acknowledgment information indicates that the first indication information has been successfully received. Correspondingly, the second device receives the first acknowledgment information.
S604: The first device sends second acknowledgment information to the third device, where the second acknowledgment information indicates that the second indication information has been successfully received. Correspondingly, the third device receives the second acknowledgment information.
In this way, the first device may further send the first acknowledgment information to the second device after receiving the first indication information, where the first acknowledgment information indicates that the first indication information has been successfully received; and the first device may further send the second acknowledgment information to the third device after receiving the second indication information, where the second acknowledgment information indicates that the second indication information has been successfully received. In this way, the second device and the third device can learn a receiving status of the related indication information, so that the second device can send the first indication information again when the first indication information is not successfully received, and the third device can send the second indication information again when the second indication information is not successfully received. This effectively improves communication reliability.
In an embodiment of the application, the first indication information is carried in first signaling, and the second indication information is carried in second signaling. The first signaling and the second signaling may be implemented in a plurality of manners, for example, may be implemented by using any one of an RTCP, a real-time streaming protocol (RTSP), or a source service access protocol (SSAP). In this way, the first indication information and the first indication information are carried in communication signaling, so that the first device can flexibly obtain the processing delay of the first packet and the processing delay of the second packet.
Implementation 1: The first signaling is carried in a fourth packet, and the second signaling is carried in a fifth packet. The fourth packet and the fifth packet correspond to a second communication protocol. For example, when the second communication protocol is the RTCP, the fourth packet and the fifth packet may be RTCP receiver report (RR) packets, that is, the fourth packet may be an RTCP RR packet sent by the second device to the first device, and the fifth packet may be an RTCP RR packet sent by the third device to the first device.
Correspondingly, the second device sends the fourth packet to the first device, where the fourth packet includes the processing delay of the first packet; and the third device sends the fifth packet to the first device, where the fifth packet includes the processing delay of the second packet.
In an embodiment, a format of the fourth packet or the fifth packet may be shown in
Implementation 2: The first signaling and the second signaling are generated based on the RTSP or the SSAP.
Example 1: In an embodiment of the application, in the RTSP, for a case in which a video codec capability is extended as a definition parameter, and an audio codec capability is extended as a definition parameter, encoding/decoding processing capability information of the source end device and the sink end device may be obtained by using request signaling GET_PARAMETER in the RTSP, where the capability information of the sink end device includes an encoding/decoding processing delay and the like.
A data format of the video-codecs-capability parameter is defined as follows:
Correspondingly, when a third communication protocol is the RTSP, the first signaling may be reply signaling of the GET_PARAMETER signaling. In other words, the first device may send the GET_PARAMETER signaling to the second device, and receive the reply signaling of the GET_PARAMETER signaling, where the reply signaling carries the first indication information, so that the first device can obtain the processing delay of the first packet.
Similarly, the first device may send the GET_PARAMETER signaling to the third device, and receive the reply signaling of the GET_PARAMETER signaling, where the reply signaling carries the second indication information. In this way, the first device may obtain the processing delay of the first packet.
Example 2: When the third communication protocol is the SSAP, information exchange may be performed between the source end device (namely, the first device) and the sink end device (namely, the second device and the third device) in the following three manners, so that the source end device obtains the processing delay of the first packet and the processing delay of the second packet.
Manner 1: Obtained by using an SSAP PDU request-response message A processing capability request message (codec_cap_REQ) in the SSAP PDU is shown in
In Manner 1, the first device sends the processing capability request message to the second device. After receiving the processing capability request message, the second device sends the processing capability response message to the first device. In this way, the first device may know the processing delay of the first packet after receiving the processing capability response message. Similarly, the first device sends the processing capability request message to the third device. After receiving the processing capability request message, the third device sends the processing capability response message to the first device. In this way, the first device may know the processing delay of the second packet after receiving the processing capability response message.
Manner 2: Obtained by using an SSAP PDU indication-acknowledgment message A processing capability indication information (codec_cap_IND) in the SSAP PDU is shown in
In Manner 2, the second device sends the processing capability indication information to the first device, so that the first device may know the processing delay of the first packet after receiving the processing capability indication information. Similarly, the third device sends the processing capability indication information to the first device, so that the first device may know the processing delay of the second packet after receiving the processing capability indication information.
Manner 3: Obtained by using an SSAP PDU notification message A processing capability notification information (codec_cap_NTF PDU) in the SSAP PDU is shown in
In Manner 3, the second device sends the processing capability notification information, so that the first device may know the processing delay of the first packet after receiving the processing capability notification information. Similarly, the third device sends the processing capability notification information, so that the first device may know the processing delay of the second packet after receiving the processing capability notification information.
In an embodiment, when the first device performs the preliminary clock synchronization with the second device, the first device may send the GET_PARAMETER signaling to the second device, and receive the reply signaling of the GET_PARAMETER signaling, where the reply signaling carries the first indication information, so that the first device may obtain the processing delay of the first packet. Then, in a process in which the first device and the second device continuously run a related streaming media application, the first device may receive the RTCP RR packet from the second device, where the RTCP RR packet carries the processing delay of the first packet. In this way, the first device may dynamically adjust the processing delay of the first packet, and implement dynamic update, so that subsequently, processing moments and/or actual sending moments of the first packet and the second packet are adjusted more accurately based on the processing delay of the first packet.
In an embodiment of the application, before the first device sends the first packet to the second device, the first device and the second device need to perform clock synchronization, that is, device time information of the second device needs to be synchronized with device time information of the first device. Similarly, before the first device sends the second packet to the third device, the first device and the third device need to perform clock synchronization, that is, device time information of the third device needs to be synchronized with the device time information of the first device.
In an embodiment, the first device sends a system message, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first orthogonal frequency division multiplexing (OFDM) symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector; and the clock information is associated with the device time information of the first device. Therefore, the second device and the third device receive the system message, and perform clock synchronization with the first device based on the clock information in the system message. The antenna connector is a connection unit that is in the first device and that connects a radio frequency analog circuit of a transceiver and an antenna.
In an embodiment, the first device sends data link layer control plane data to the second device and the third device, where the data link layer control plane data includes clock information; and the second device and the third device receive the data link layer control plane data, and perform clock synchronization with the first device based on the clock information.
The clock information is associated with the device time information of the first device. After the second device and the third device perform clock synchronization with the first device, the device time information of the second device is consistent with the device time information of the first device, and the device time information of the third device is consistent with the device time information of the first device.
Example 1: A first device, a second device, and a third device belong to an SLB system, where the first device is used as a G node in the SLB system, and the second device and the third device are used as T nodes in the SLB system.
S701: A first device sends a system message. Correspondingly, a second device receives the system message, and a third device receives the system message.
The system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first orthogonal frequency division multiplexing OFDM symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector.
S702: The second device performs clock synchronization with the first device based on the clock information.
S703: The third device performs clock synchronization with the first device based on the clock information.
The clock information is associated with device time information of the first device, and after the second device performs clock synchronization with the first device, device time information of the second device is consistent with the device time information of the first device; and after the third device performs clock synchronization with the first device, device time information of the third device is consistent with the device time information of the first device.
Example 2: A first device, a second device, and a third device belong to an SLE system, where the first device is used as a G node in the SLE system, and the second device and the third device are used as T nodes in the SLE system.
S801: A first device sends data link layer control plane data to a second device. The data link layer control plane data includes clock information. Correspondingly, the second device receives the data link layer control plane data from the first device.
The clock information is used by the second device to perform clock synchronization with the first device, and is used by a third device to perform clock synchronization with the first device.
S802: The second device performs clock synchronization with the first device based on the clock information.
It may be understood that, after the second device performs clock synchronization with the first device, device time information of the second device is consistent with device time information of the first device.
S803: The first device sends the data link layer control plane data to the third device. The data link layer control plane data includes clock information. Correspondingly, the third device receives the data link layer control plane data from the first device.
S804: The third device performs clock synchronization with the first device based on the clock information.
It may be understood that, after the third device performs clock synchronization with the first device, device time information of the third device is consistent with the device time information of the first device.
In an embodiment of the application, it is assumed that a plurality of data streams that need to be synchronously played are collected and encapsulated at a same moment on the source end device.
An embodiment of this application provides another data transmission method, to implement inter-stream synchronization between different data streams of different separated source end devices. The method is applicable to a scenario of inter-stream synchronization between different data streams between a plurality of source end devices and one sink end device. An example in which the source end devices are a second device and a third device, and the sink end device is a first device is used. The method includes: A first device receives a first packet from a second device, where the first packet includes a first data stream and a sampling time sequence of the first data stream; the first device receives a second packet from a third device, where the second packet includes a second data stream and a sampling time sequence of the second data stream, the first packet and the second packet correspond to a first communication protocol, and the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device; the first device receives a third packet from the second device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the second device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec, the device time information of the second device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship, and the third packet corresponds to a second communication protocol; the first device receives a fourth packet from the third device, where the fourth packet includes a third time stamp and a fourth time stamp, the third time stamp indicates device time information of the third device, the fourth time stamp indicates a time sequence value corresponding to the system clock of the codec, the device time information of the third device and the time sequence value that corresponds to the system clock of the codec meet a second mapping relationship, and the fourth packet corresponds to the second communication protocol; and the first device maps, based on device time information of the first device, the device time information of the second device, the device time information of the third device, and the time sequence value corresponding to the system clock of the codec, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream to a time axis on which the device time information of the first device is located, or a time axis on which the device time information of the second device is located, or a time axis on which the device time information of the third device is located. In this solution, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are converted to a same time axis, so that actual sending moments and/or processing moments of the first packet and the second packet are subsequently correspondingly adjusted, to implement inter-stream synchronization between the first data stream in the first packet and the second data stream in the second packet.
S901: A first device receives a first packet from a second device, where the first packet includes a first data stream and a sampling time sequence of the first data stream. Correspondingly, the second device sends the first packet.
S902: The first device receives a second packet from a third device, where the second packet includes a second data stream and a sampling time sequence of the second data stream. Correspondingly, the third device sends the second packet.
In an embodiment of the application, the first packet and the second packet correspond to a first communication protocol, and the first communication protocol may be, for example, the RTP. “The first packet and the second packet correspond to the first communication protocol” may be understood as that the first packet and the second packet are encapsulated according to the first communication protocol.
In an embodiment of the application, a time axis on which device time information of the first device is located, a time axis on which device time information of the second device is located, and a time axis on which device time information of the third device is located are mutually synchronized.
In embodiments of this application, the first device may periodically receive the first packet from the second device, and the first device may periodically receive the second packet from the third device.
It can be learned from the foregoing that the first packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the second device to the first device, includes the first data stream and the sampling time sequence of the first data stream, and corresponds to the first communication protocol.
The second packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the third device to the first device, includes the second data stream and the sampling time sequence of the second data stream, and corresponds to the first communication protocol. The first data stream and the second data stream may be audio streams or video streams. For example, the first data stream and the second data stream are different video streams. For another example, the first data stream is a video stream, and the second data stream is an audio stream.
In an embodiment of the application, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device.
S903: The first device receives a third packet from the second device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates the device time information of the second device, and the second time stamp indicates a time sequence value corresponding to the system clock of the codec. Correspondingly, the second device sends the third packet.
In an embodiment of the application, the device time information of the second device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship.
S904: The first device receives a fourth packet from the third device, where the fourth packet includes a third time stamp and a fourth time stamp, the third time stamp indicates the device time information of the third device, and the fourth time stamp indicates a time sequence value corresponding to the system clock of the codec. Correspondingly, the third device sends the fourth packet.
The device time information of the third device represents air interface time of the third device. The device time information of the third device and the time sequence value that corresponds to the system clock of the codec of the first device meet a second mapping relationship.
In an embodiment of the application, the third packet and the fourth packet correspond to the second communication protocol, and the second communication protocol may be, for example, the RTCP. In other words, the third packet and the fourth packet are encapsulated according to the second communication protocol.
In addition, in embodiments of this application, the first device may periodically receive the third packet from the second device, and the first device may periodically receive the fourth packet from the third device.
It can be learned from the foregoing that the third packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the second device to the first device, includes a first time stamp and a second time stamp, where the first time stamp indicates the device time information of the second device, and the second time stamp indicates the time sequence value corresponding to the system clock of the codec, and corresponds to the second communication protocol.
The fourth packet represents a plurality of packets or a series of packets that meet a same attribute, and the same attribute of any one of the plurality of packets or the series of packets is as follows: The packet is sent by the third device to the first device, includes a third time stamp and a fourth time stamp, where the third time stamp indicates the device time information of the third device, and the fourth time stamp indicates the time sequence value corresponding to the system clock of the codec, and corresponds to the second communication protocol.
S905: The first device maps, based on the device time information of the first device, the device time information of the second device, the device time information of the third device, and the time sequence value corresponding to the system clock of the codec, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream to the time axis on which the device time information of the first device is located, or the time axis on which the device time information of the second device is located, or the time axis on which the device time information of the third device is located.
The time axis on which the device time information of the first device is located, the time axis on which the device time information of the second device is located, and the time axis on which the device time information of the third device is located are mutually synchronized.
In the embodiment shown in
It should be understood that, before the first device, the second device, and the third device exchange information, the second device and the third device need to perform clock synchronization with the first device.
In an embodiment, the first device sends a system message, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first OFDM symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector, and the clock information is correlated with the device time information of the first device. The second device receives the system message, and performs clock synchronization with the first device based on the clock information in the system message, for the device time information of the second device to be consistent with the device time information of the first device. Similarly, the third device receives the system message, and performs clock synchronization with the first device based on the clock information in the system message, for the device time information of the third device to be consistent with the device time information of the first device. In an embodiment, when the first device, the second device, and the third device form an SLB system, the first device sends the system message.
In an embodiment, the first device sends data link layer control plane data to the second device and the third device, where the data link layer control plane data includes clock information, and the clock information is associated with the device time information of the first device; the second device receives the data link layer control plane data, and performs clock synchronization with the first device based on that the data link layer control plane data includes the clock information; and the third device receives the data link layer control plane data, and performs clock synchronization with the first device based on that the data link layer control plane data includes the clock information. In an embodiment, when the first device, the second device, and the third device form an SLE system, the first device sends the data link layer control plane data to the second device and the third device.
The device time information of the first device represents air interface time of the first device. For example, the device time information of the first device may be a clock that is based on a 48 kHz sampling sequence value and that is exported through air interface synchronization of the first device.
It may be understood that, after the second device performs clock synchronization with the first device, the device time information of the second device is consistent with the device time information of the first device. After the third device performs clock synchronization with the first device, the device time information of the third device is consistent with the device time information of the first device.
In an embodiment, the first device determines a transmission delay of the first packet based on a first moment and a second moment, where the sampling time sequence of the first data stream and the first moment meet the first mapping relationship, and receiving time of the first packet and the second moment meet the first mapping relationship; the first device determines a transmission delay of the second packet based on a third moment and a fourth moment, where the sampling time sequence of the second data stream and the third moment meet the second mapping relationship, and receiving time of the second packet and the fourth moment meet the second mapping relationship; and the first device determines a first delay difference between the transmission delay of the first packet and the transmission delay of the second packet based on the transmission delay of the first packet and the transmission delay of the second packet. Further, the first device adjusts a processing moment of the first packet or a processing moment of the second packet based on the first delay difference; or the first device sends first information to the second device, where the first information indicates the first delay difference; and correspondingly, the second device receives the first information, and adjusts an actual sending moment of the first packet based on the first delay difference; or the first device sends first information to the second device, where the first information indicates the first delay difference; and correspondingly, the third device receives the first information, and adjusts the actual sending moment of the second packet based on the first delay difference.
It may be understood that the processing moment of the first packet is a start moment at which the first device processes the first packet. The processing moment of the second packet is a start moment at which the first device processes the second packet.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the first device receives the any packet, and the sending time of the first packet is time at which the second device sends the any packet to the first device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the second device adjusts the actual sending moment of the first packet based on the first delay difference” may be understood as that the second device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the first device receives the any packet, and the sending time of the any packet is time at which the third device sends the any packet to the first device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the third device adjusts the actual sending moment of the first packet based on the first delay difference” may be understood as the third device adjusts, based on the first delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
In this way, after the first packet and the second packet are processed by the first device (the sink end device), the play time of the first data stream in the first packet is synchronized with the play time of the second data stream in the second packet.
In an embodiment, the first device determines a second delay difference based on the processing delay of the first packet and the processing delay of the second packet. Further, the first device (the sink end device) may determine the second delay difference based on the processing delay of the first packet and the processing delay of the second packet; and the first device adjusts the processing moment of the first packet or the processing moment of the second packet based on the second delay difference; or the first device sends fourth information to the second device, where the fourth information indicates the second delay difference, so that the second device adjusts the actual sending moment of the first packet; or the first device sends fourth information to the third device, where the fourth information indicates the second delay difference, so that the third device adjusts the actual sending moment of the second packet.
It may be understood that, the processing delay of the first packet includes but is not limited to time required for the first device to perform one or more processes such as decapsulating the first packet, or decoding or rendering the first data stream in the first packet. The processing moment of the first packet includes but is not limited to a start moment at which the first device processes the first packet. The processing delay of the second packet is time required for the first device to perform one or more processes such as decapsulating the second packet, decoding or rendering the second data stream in the second packet, or the like. The processing moment of the second packet is a start moment at which the first device processes the second packet. In this way, after the first packet and the second packet are processed by the first device (the sink end device), the play time of the first data stream in the first packet is synchronized with the play time of the second data stream in the second packet.
It can be learned from the foregoing description that the first packet represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the first packet may be a difference between receiving time of any packet in the first packet and sending time of the any packet. The receiving time of the any packet is time at which the second device receives the any packet, and the sending time of the first packet is time at which the first device sends the any packet to the second device. Correspondingly, the actual sending moment of the first packet is sending time of one or more packets that are in the first packet and that are sent after the any packet. Therefore, “the second device adjusts the actual sending moment of the first packet based on the second delay difference” may be understood as that the second device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the first packet and that are sent after the any packet.
Similarly, it can be learned from the foregoing description that the second packet also represents a plurality of packets or a series of packets that meet a same attribute. Correspondingly, the transmission delay of the second packet may be a difference between receiving time of any packet in the second packet and sending time of the any packet. The receiving time of the any packet is time at which the third device receives the any packet, and the sending time of the any packet is time at which the first device sends the any packet to the third device. Correspondingly, the actual sending moment of the second packet is sending time of one or more packets that are in the second packet and that are sent after the any packet. Therefore, “the third device adjusts the actual sending moment of the second packet based on the second delay difference” may be understood as that the third device adjusts, based on the second delay difference, the sending time of the one or more packets that are in the second packet and that are sent after the any packet.
It may be understood that before the second device sends the third packet to the first device, the second device needs to obtain the device time information of the second device. In a possible implementation, that the second device obtains the device time information of the second device includes: The second device obtains the device time information of the second device by using an inter-layer primitive of a protocol stack.
In an embodiment, the protocol stack includes a first protocol layer, a second protocol layer, and a third protocol layer.
Correspondingly, that the second device obtains the device time information of the second device by using an inter-layer primitive of a protocol stack includes: The first protocol layer sends a first inter-layer primitive to the second protocol layer, where the first inter-layer primitive is used by the first protocol layer to request the second protocol layer to query the device time information of the second device; the second protocol layer sends a second inter-layer primitive to the third protocol layer, where the second inter-layer primitive is used by the second protocol layer to request the third protocol layer to query the device time information of the second device; the second protocol layer receives a third inter-layer primitive from the third protocol layer, where the third inter-layer primitive is used by the third protocol layer to indicate the device time information of the second device to the second protocol layer; and the first protocol layer receives a fourth inter-layer primitive from the second protocol layer, where the fourth inter-layer primitive is used by the second protocol layer to indicate the device time information of the second device to the first protocol layer.
It may be understood that before the third device sends the fourth packet to the first device, the third device needs to obtain the device time information of the third device. In an embodiment, that the third device obtains the device time information of the third device includes: The third device obtains the device time information of the third device by using an inter-layer primitive of a protocol stack. An implementation is similar to an implementation in which the second device obtains the device time information of the second device, and details are not described herein again.
The foregoing describes in detail the communication methods provided in embodiments of this application. The following describes in detail apparatuses provided in embodiments of this application with reference to accompanying drawings. It should be understood that descriptions of the apparatus embodiments correspond to the descriptions of the method embodiments. Therefore, for content that is not described in detail, refer to each other.
In Case 1, when the apparatus 900 is configured to implement the functions of the first device in the method embodiment 1, the apparatus 900 may be the first device, or a chip, a circuit, or the like configured in the first device. The processing unit 1001 is configured to perform processing-related operations of the first device in the method embodiment 1, and the communication unit 1002 is configured to perform sending/receiving-related operations of the first device in the method embodiment 1.
When the apparatus 900 is configured to implement the functions of the first device in the foregoing the method embodiment 1, the communication unit 1002 may be configured to: send a first packet to a second device, where the first packet includes a first data stream and a sampling time sequence of the first data stream; and send a second packet to a third device, where the second packet includes a second data stream and a sampling time sequence of the second data stream, the first packet and the second packet correspond to a first communication protocol, and the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device. The communication unit 1002 may be further configured to send third packets to the second device and the third device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec, and the third packet corresponds to a second communication protocol.
In an embodiment, the device time information of the first device represents air interface time of the first device. In this way, a reference time axis of the first packet and the second packet is a time axis of the air interface time of the first device.
In an embodiment, the communication unit 1002 may be further configured to send a system message, where the system message includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first orthogonal frequency division multiplexing OFDM symbol in a hyper frame corresponding to the hyper frame number passes through an antenna connector; or the communication unit 1002 may be further configured to send data link layer control plane data to the second device and the third device, where the data link layer control plane data includes clock information. The clock information is associated with the device time information, and the clock information is used by the second device and the third device to perform clock synchronization with the first device. The antenna connector is a connection unit that is in the first device and that connects a radio frequency analog circuit of a transceiver and an antenna.
In an embodiment, the communication unit 1002 may be further configured to obtain device time information of the communication unit 1002 before sending the third packets to the second device and the third device.
In an embodiment, the first device obtains the device time information of the first device by using an inter-layer primitive of a protocol stack.
In an embodiment, the protocol stack includes a first protocol layer, a second protocol layer, and a third protocol layer; and correspondingly, that the first device obtains the device time information by using an inter-layer primitive of a protocol stack includes: The first protocol layer sends a first inter-layer primitive to the second protocol layer, where the first inter-layer primitive is used by the first protocol layer to request the second protocol layer to query the device time information; the second protocol layer sends a second inter-layer primitive to the third protocol layer, where the second inter-layer primitive is used by the second protocol layer to request the third protocol layer to query the device time information; the second protocol layer receives a third inter-layer primitive from the third protocol layer, where the third inter-layer primitive is used by the third protocol layer to indicate the device time information to the second protocol layer; and the first protocol layer receives a fourth inter-layer primitive from the second protocol layer, where the fourth inter-layer primitive is used by the second protocol layer to indicate the device time information to the first protocol layer.
In an embodiment, the communication unit 1002 may be further configured to: receive first information from the second device, and receive second information from the third device, where the first information indicates a transmission delay of the first packet, and the second information indicates a transmission delay of the second packet. The processing unit 1001 may be further configured to: determine a first delay difference between the transmission delay of the first packet and the transmission delay of the second packet based on the transmission delay of the first packet and the transmission delay of the second packet; and adjust an actual sending moment of the first packet or an actual sending moment of the second packet based on the first delay difference. The communication unit 1002 may be further configured to send third information to the second device or the third device, where the third information indicates the first delay difference.
In an embodiment, the processing unit 1001 may be further configured to: obtain a processing delay of the first packet and a processing delay of the second packet; determine a second delay difference based on the processing delay of the first packet and the processing delay of the second packet; and adjust the actual sending moment of the first packet or the actual sending moment of the second packet based on the second delay difference; or the communication unit 1002 may be further configured to send fourth information to the second device or the third device, where the fourth information indicates the second delay difference.
In an embodiment, the communication unit 1002 receives first indication information from the second device, where the first indication information indicates the processing delay of the first packet; and the communication unit 1002 receives second indication information from the third device, where the second indication information indicates the processing delay of the second packet.
In an embodiment, the first indication information is carried in first signaling, and the second indication information is carried in second signaling.
In an embodiment, the communication unit 1002 sends first acknowledgment information to the second device after receiving the first indication information, where the first acknowledgment information indicates that the first indication information has been successfully received; and the communication unit 1002 sends second acknowledgment information to the third device after receiving the second indication information, where the second acknowledgment information indicates that the second indication information has been successfully received.
In Case 2, when the apparatus 900 is configured to implement the functions of the second device in the method embodiment 1, the apparatus 900 may be the second device, or a chip, a circuit, or the like configured in the second device. The processing unit 1001 is configured to perform processing-related operations of the second device in the method embodiment 1, and the communication unit 1002 is configured to perform sending/receiving-related operations of the second device in the method embodiment 1.
In an embodiment, the communication unit 1002 is configured to receive a first packet from a first device, where the first packet includes a first data stream and a sampling time sequence of the first data stream, the first packet corresponds to a first communication protocol, and the sampling time sequence of the first data stream is a time sequence whose value is in a unit of a system clock of a codec of the first device. The communication unit 1002 is further configured to receive a third packet from the first device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec of the first device, and the third packet corresponds to a second communication protocol. The processing unit 1001 is configured to map, based on the device time information and the time sequence value that corresponds to the system clock of the codec, the sampling time sequence of the first data stream to a first moment on a time axis on which the device time information of the first device is located, where the device time information of the first device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship.
In Case 3, when the apparatus 900 is configured to implement the functions of the third device in the method embodiment 1, the apparatus 900 may be the third device, or a chip, a circuit, or the like configured in the third device. The processing unit 1001 is configured to perform processing-related operations of the third device in the method embodiment 1, and the communication unit 1002 is configured to perform sending/receiving-related operations of the third device in the method embodiment 1.
In an embodiment, the communication unit 1002 is configured to receive a second packet from a first device, where the first packet includes a second data stream and a sampling time sequence of the second data stream, the second packet corresponds to a first communication protocol, and the sampling time sequence of the second data stream is a time sequence whose value is in a unit of a system clock of a codec of the first device. The communication unit 1002 is further configured to receive a third packet from the first device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the first device, the second time stamp indicates a time sequence value corresponding to a system clock of a codec of the first device, and the third packet corresponds to a second communication protocol. The processing unit 1001 is configured to map, based on the device time information and the time sequence value that corresponds to the system clock of the codec, the sampling time sequence of the second data stream to a first moment on a time axis on which the device time information of the first device is located, where the device time information of the first device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship.
In Case 4, when the apparatus 900 is configured to implement the functions of the first device in the method embodiment 1, the apparatus 900 may be the first device, or a chip, a circuit, or the like configured in the first device. The processing unit 1001 is configured to perform processing-related operations of the first device in the method embodiment 1, and the communication unit 1002 is configured to perform sending/receiving-related operations of the first device in the method embodiment 1.
In an embodiment, the communication unit 1002 is configured to receive a first packet from a second device, where the first packet includes a first data stream and a sampling time sequence of the first data stream. The communication unit 1002 is further configured to receive a second packet from a third device, where the second packet includes a second data stream and a sampling time sequence of the second data stream, the first packet and the second packet correspond to a first communication protocol, and the sampling time sequence of the first data stream and the sampling time sequence of the second data stream are time sequences whose values each are in a unit of a system clock of a codec of the first device. The communication unit 1002 is further configured to receive a third packet from the second device, where the third packet includes a first time stamp and a second time stamp, the first time stamp indicates device time information of the second device, the second time stamp indicates a time sequence value corresponding to the system clock of the codec, the device time information of the second device and the time sequence value that corresponds to the system clock of the codec meet a first mapping relationship, and the third packet corresponds to a second communication protocol. The communication unit 1002 is further configured to receive a fourth packet from the third device, where the fourth packet includes a third time stamp and a fourth time stamp, the third time stamp indicates device time information of the third device, the fourth time stamp indicates a time sequence value corresponding to the system clock of the codec, the device time information of the third device and the time sequence value that corresponds to the system clock of the codec meet a second mapping relationship, and the fourth packet corresponds to the second communication protocol. The first device maps, based on device time information of the first device, the device time information of the second device, the device time information of the third device, and the time sequence value corresponding to the system clock of the codec, the sampling time sequence of the first data stream and the sampling time sequence of the second data stream to a time axis on which the device time information of the first device is located, or a time axis on which the device time information of the second device is located, or a time axis on which the device time information of the third device is located.
In case 5, when the apparatus 900 is configured to implement the functions of the second device in the foregoing method embodiment 2, the apparatus 900 may be the second device, or a chip, a circuit, or the like configured in the second device. The processing unit 1001 is configured to perform processing-related operations of the second device in the method embodiment 2, and the communication unit 1002 is further configured to perform sending/receiving-related operations of the second device in the method embodiment 2.
In an embodiment, the communication unit 1002 is configured to send a first packet to a first device, where the first packet includes a first data stream and a sampling time sequence of the first data stream, and the first packet corresponds to a first communication protocol. The communication unit 1002 is further configured to send a third packet to the first device, where the third packet includes device time information of the second device and a time sequence value that corresponds to a system clock of a codec of the first device, and the third packet corresponds to the second communication protocol.
In case 6, when the apparatus 900 is configured to implement the functions of the third device in the foregoing method embodiment 2, the apparatus 900 may be the third device, or a chip, a circuit, or the like configured in the third device. The processing unit 1001 is configured to perform processing-related operations of the third device in the method embodiment 2, and the communication unit 1002 is configured to perform sending/receiving-related operations of the third device in the method embodiment 2.
In an embodiment, the communication unit 1002 is configured to send a second packet to a first device, where the second packet includes a second data stream and a sampling time sequence of the second data stream, and the second packet corresponds to a first communication protocol. The communication unit 1002 is further configured to send a fourth packet to the first device, where the fourth packet includes device time information of the third device and a time sequence value that corresponds to a system clock of a codec of the first device, and the fourth packet corresponds to the second communication protocol.
In an embodiment of the application, division into the units is an example, and is only a logical function division. In an embodiment, another division manner may be used. In addition, functional units in an embodiment of the application may be integrated into one processor, or each of the units may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit.
As shown in
The communication apparatus 1000 includes one or more processors 1101. The processor 1101 may be a general-purpose processor, a dedicated processor, or the like. For example, the processor may be a baseband processor or a central processing unit. The baseband processor may be configured to process a communication protocol and communication data. The central processing unit may be configured to: control a communication apparatus (for example, a base station, a terminal, or a chip), execute a software program, and process data of the software program. The communication apparatus may include a transceiver unit, configured to input (receive) and output (send) signals. For example, the transceiver unit may be a transceiver or a radio frequency chip.
The communication apparatus 1000 includes one or more processors 1101, and the one or more processors 1101 can implement the method in the foregoing embodiment. In an embodiment, the processor 1101 may further implement another function in addition to the method shown in the foregoing embodiment.
In an embodiment of the application, the apparatus 1000 may further include a transceiver 1105, an antenna 1106, and an antenna connector 1107. The processor 1101 may be referred to as a processing unit, and is configured to control the apparatus (a terminal or a base station). The transceiver 1105 may be referred to as a transceiver, a transceiver circuit, a transceiver unit, or the like, and is configured to implement a receiving and sending function of the apparatus through the antenna 1106. In the first device, a connection unit connecting the radio frequency analog circuit in the transceiver 1105 and the antenna 1106 is an antenna connector 1107. Correspondingly, the system message sent by the first device includes a hyper frame number and clock information that corresponds to a moment at which a start point of a cyclic prefix of a first OFDM symbol in a hyper frame corresponding to the hyper frame number passes through the antenna connector 1107.
In an embodiment, the processor 1101 may execute instructions, so that the apparatus 1000 performs the methods described in the foregoing method embodiments. All or some of the instructions may be stored in the processor 1101. For example, all or some of instructions 1103 may be stored in the processor 1101, or the instructions 1103 are stored in the processor 1101, and instructions 1104 are stored in a memory 1102 coupled to the processor. The processor 1101 may synchronously execute the instructions 1103 and the instructions 1104, so that the communication apparatus 1000 performs the method described in the foregoing method embodiment. The instructions 1103 and the instructions 1104 are also referred to as computer programs.
In an embodiment, the communication apparatus 1000 may further include a circuit, and the circuit may implement the function in the foregoing method embodiment.
In an embodiment, the communication apparatus 1000 may include one or more memories 1102 storing the instructions 1104. The instructions may be run on the processor 1101, so that the apparatus 1000 performs the method described in the foregoing method embodiment. In an embodiment, the memory 1102 may further store data. In an embodiment, the processor 1101 may also store instructions and/or data. For example, the one or more memories 1102 may store the correspondence described in the foregoing embodiment, or the related parameter, table, or the like in the foregoing embodiment. The processor and the memory may be separately disposed, or may be integrated.
The processor may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), one or more integrated circuits configured to control program execution of the solutions of this application, a general-purpose processor, a digital signal processor (DSP), a field programmable gate array (FPGA) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware assembly. The processor may implement or perform the methods, the operations, and logical block diagrams that are disclosed in embodiments of this application. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The operations in the methods disclosed with reference to embodiments of this application may be directly performed and completed by a hardware decoding processor, or may be performed and completed by using a combination of hardware in the decoding processor and a software module. The software module may be in a storage medium, and the storage medium is located in a memory.
The memory may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. The nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), used as an external cache. By way of example, and not limitation, many forms of RAMs may be used, for example, a static random access memory (Static RAM, SRAM), a dynamic random access memory (Dynamic RAM, DRAM), a synchronous dynamic random access memory (Synchronous DRAM, SDRAM), a double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), an enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), a synchronous link dynamic random access memory (synchronous link DRAM, SLDRAM), and a direct rambus random access memory (Direct Rambus RAM, DR RAM). It should be noted that the memory of the systems and methods described in this specification includes but is not limited to these memories and any memory of another appropriate type. The memory may independently exist and may be connected to the processor through a communication line. The memory may alternatively be integrated with the processor.
An embodiment of this application further provides a terminal. The terminal may be an intelligent cockpit device, a smart home device, an intelligent manufacturing device, a vehicle, or the like. It may alternatively be understood that the “vehicle-mounted wireless short-range communication system” technology is applied to a short-range communication system in the non-vehicle-mounted field. The first device, the second device, and the third device each may be one or more of modules such as a camera, a screen, a microphone, an acoustic device, radar, an electronic key, a passive entry passive start system controller, and user equipment UE. In an embodiment, the terminal may be an unmanned aerial vehicle, a robot, a device in a smart home scenario, a device in an intelligent manufacturing scenario, or the like.
Further, an embodiment of this application further provides an apparatus, including units configured to implement the foregoing embodiments. Alternatively, the apparatus includes a processor and an interface circuit. The processor is configured to communicate with another apparatus through the interface circuit, and perform the methods in the foregoing method embodiments. Alternatively, the apparatus includes a processor, configured to invoke a program stored in a memory, to perform the methods described in the foregoing embodiments.
An embodiment of this application further provides a computer-readable storage medium, including readable instructions. When the readable instructions are run on a computer, the computer is enabled to perform the methods described in the foregoing embodiment.
An embodiment of this application further provides a chip system. The chip system includes at least one processor and interface circuit. Further, in an embodiment, the chip system may further include a memory or an external memory. The processor is configured to execute instructions and/or data interaction through the interface circuit, to implement the method in the foregoing method embodiment. The chip system may include a chip, or may include a chip and another discrete device.
An embodiment of this application further provides a computer program product, including instructions. When the instructions are run on a computer, the computer is enabled to perform the methods described in the foregoing embodiment.
In embodiments of this application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or another programmable logic device, a discrete gate or transistor logic device, a discrete hardware assembly, or a synergistic processing unit, and may implement or perform the methods, operations, and logical block diagrams disclosed in embodiments of this application. The general-purpose processor may be a microprocessor, any conventional processor, or the like. The operations in the methods disclosed with reference to embodiments of this application may be directly performed by a hardware processor, or may be performed by using a combination of hardware in the processor and a software module.
In an embodiment of the application, the memory may be a non-volatile memory, for example, a hard disk drive (HDD) or a solid-state drive (SSD), or may be a volatile memory, for example, a random access memory (RAM). The memory is any other medium that can carry or store expected program code in a form of instructions or a data structure and that can be accessed by a computer, but is not limited thereto. The memory in embodiments of this application may alternatively be a circuit or any other apparatus that can implement a storage function, and is configured to store the program instructions and/or the data.
One of ordinary skilled in the art should understand that embodiments of this application may be provided as a method, a system, or a computer program product. Therefore, this application may use a form of hardware only embodiments, software only embodiments, or embodiments with a combination of software and hardware. In addition, this application may use a form of a computer program product that is implemented on one or more computer-usable storage media (including but not limited to a disk storage, a CD-ROM, and an optical storage) that include computer-usable program code.
This application is described with reference to the flowcharts and/or block diagrams of the method, the device (system), and the computer program product according to the application. It should be understood that computer program instructions may be used to implement each process and/or each block in the flowcharts and/or the block diagrams and a combination of a procedure and/or a block in the flowcharts and/or the block diagrams. The computer program instructions may be provided for a general-purpose computer, a dedicated computer, an embedded processor, or a processor of any other programmable data processing device to generate a machine, so that the instructions executed by a computer or a processor of any other programmable data processing device generate an apparatus for implementing a function in one or more procedures in the flowcharts and/or in one or more blocks in the block diagrams.
The computer program instructions may be stored in a computer-readable storage that can instruct the computer or any other programmable data processing device to work in a manner, so that the instructions stored in the computer-readable storage generate an artifact that includes an instruction apparatus. The instruction apparatus implements a function in one or more procedures in the flowcharts and/or in one or more blocks in the block diagrams.
The computer program instructions may alternatively be loaded onto a computer or another programmable data processing device, so that a series of operations and operations are performed on the computer or the another programmable device, to generate computer-implemented processing. Therefore, the instructions executed on the computer or the another programmable device provide operations for implementing a function in one or more procedures in the flowcharts and/or in one or more blocks in the block diagrams.
It is clearly that one of ordinary skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. This application is intended to cover these modifications and variations of this application provided that they fall within the scope of protection defined by the following claims and their equivalent technologies.
Number | Date | Country | Kind |
---|---|---|---|
202211043681.0 | Aug 2022 | CN | national |
This application is a continuation of International Application No. PCT/CN2023/111988, filed on Aug. 9, 2023, which claims priority to Chinese Patent Application No. 202211043681.0, filed on Aug. 29, 2022. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2023/111988 | Aug 2023 | WO |
Child | 19063859 | US |