WO2011057588A1 - Streaming media server and method for synchronization in media stream switching - Google Patents

Streaming media server and method for synchronization in media stream switching Download PDF

Info

Publication number
WO2011057588A1
WO2011057588A1 PCT/CN2010/078760 CN2010078760W WO2011057588A1 WO 2011057588 A1 WO2011057588 A1 WO 2011057588A1 CN 2010078760 W CN2010078760 W CN 2010078760W WO 2011057588 A1 WO2011057588 A1 WO 2011057588A1
Authority
WO
WIPO (PCT)
Prior art keywords
timestamp
real
time
media stream
packet
Prior art date
Application number
PCT/CN2010/078760
Other languages
French (fr)
Chinese (zh)
Inventor
刘启铭
仇刚
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2011057588A1 publication Critical patent/WO2011057588A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/28Timers or timing mechanisms used in protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/61Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
    • H04L65/611Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio for multicast or broadcast

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a media stream switching synchronization method and a streaming media server. Background technique
  • RTP Realtime Transport Protocol
  • RTP A transport protocol for multimedia data streams over the Internet.
  • RTP is defined to operate in a one-to-one or one-to-many transmission with the purpose of providing time information and stream synchronization.
  • RTP itself only guarantees the transmission of data when it is confirmed. It does not provide a reliable transmission mechanism for transmitting packets in sequence, nor does it provide flow control or congestion control. It relies on Real-time Control Protocol (RTCP) to provide services.
  • RTCP Real-time Control Protocol
  • the RTCP protocol is responsible for managing the transmission quality to exchange control information between current application processes.
  • each participant periodically transmits RTCP packets, which contain statistics such as the number of transmitted packets and the number of lost packets. Therefore, the server can use this information to dynamically change the transmission rate, even Change the payload type.
  • RTP Optimizs transmission efficiency with efficient feedback and minimal overhead, making it ideal for delivering real-time data on the network.
  • the initial values of the packet sequence number and timestamp are random, and the timestamp only reflects the sampling time of the first byte.
  • RTP timestamps for different media streams may grow at different rates and have independent random offsets. Therefore, it is not possible to synchronize the time stamps of different media streams directly.
  • a key function of RTCP is to enable the receiver to synchronize multiple RTP streams. For example: When audio and video are transmitted together, RTP uses two streams for transmission because of different encodings, so the time stamps of the two streams are different. At the rate of operation, the receiver must synchronize the two streams to ensure that the sound is consistent with the image. In order to be able to perform stream synchronization, there is a network in the sender report that is delivered. The absolute time value represented by the time protocol NTP (Network Time Protocol) format, and then an RTP timestamp (timestamp) value is given in the sender report (Sender Report, SR), and the clock generating the value is the timestamp in the RTP packet. The clock of the field.
  • NTP Network Time Protocol
  • the sender reports as an RTCP packet, which conforms to the RTCP protocol standard. Since all the streams sent by the sender and the sender report use the same absolute clock (NTP clock), the receiver can compare the absolutes of the two streams from the same data source. Time, thereby determining how to map the timestamp value in one stream to the timestamp value in another stream.
  • the embodiment of the invention provides a media stream switching synchronization method and a streaming media server, which can realize synchronous switching of media streams when NTP is not homologous.
  • the streaming server receives the sender report packet of the media stream
  • the streaming media server records the system time when the sender reports the packet, and modifies the network calibration protocol network time-of-day protocol time stamp of the sender report packet according to the recorded system time;
  • the streaming media server receives the real-time transport protocol packet of the media stream
  • the streaming media server replaces the real-time transport protocol timestamp in the real-time transport protocol packet according to the system timestamp when the real-time transport protocol arrives; the system timestamp is generated according to the system time, and a unique system timestamp is generated per unit time;
  • the system time stamp in the real-time transport protocol packet of the media stream is synchronously switched.
  • a data packet receiving unit configured to receive a sender report packet of the media stream
  • a timestamp modification unit configured to record a system time when the real-time transmission control protocol packet is received, and modify a network timing protocol network timing of the sender report packet according to the recorded system time Protocol timestamp
  • the switching control unit is configured to perform synchronous switching according to a network calibration time stamp in the sender report packet of the media stream when the media stream is switched.
  • a receiving unit configured to receive a real-time transport protocol packet of the media stream
  • a timestamp replacement unit configured to replace a real-time transport protocol timestamp in the real-time transport protocol packet according to a system timestamp when the real-time transport protocol arrives; the system timestamp is generated according to a system time, and a unique system timestamp is generated per unit time
  • a switching control unit configured to perform synchronous switching according to a system timestamp in a real-time transport protocol packet of the media stream.
  • the streaming media data packet is modified, and the system time of the streaming media server is replaced with the NTP timestamp, and the NTP time stamp of the multiple media streams is converted from different sources to the same source, or directly according to the streaming media.
  • the system time of the server performs absolute unified calibration on the received RTP timestamps of multiple media streams, thereby realizing the synchronization of media switching.
  • the problem that the media stream of different NTP clocks cannot be switched in the prior art is solved, and the service experience of the user is improved.
  • FIG. 1 is a flowchart of a method for media stream switching synchronization according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a media stream synchronous switching according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for media stream switching synchronization according to another embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a streaming media server according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a switching control unit of a streaming media server according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a streaming media server according to another embodiment of the present invention.
  • the present invention proposes a solution.
  • the embodiment of the present invention provides a media stream switching synchronization method.
  • the flowchart is as shown in FIG. 1 and includes:
  • the streaming media server receives the SR packet of the media stream
  • the streaming media server records the system time when the SR packet is received, and modifies the network timing protocol NTP timestamp of the SR packet according to the recorded system time;
  • the NTP time stamp in the SR packet of the media stream is synchronously switched.
  • the streaming media data packet is modified, and the system time of the streaming media server is replaced with the NTP timestamp, and the NTP time stamp of the multiple media streams is converted from different sources to the same source, thereby implementing media switching. Synchronization. The problem that the media stream of different NTP clocks cannot be switched in the prior art is solved, and the service experience of the user is improved.
  • the method for performing the synchronous switching according to the NTP timestamp in the real-time transmission control protocol packet of the media stream may refer to the conventional implementation manner of the prior art, so that the time stamp of obtaining the media stream after the handover is more accurate, the present invention Provide a feasible switching mode, as shown in Figure 2, including:
  • the streaming media server when the media stream is switched, is based on the RTP timestamp in the last real-time transport protocol RTP packet of the media stream before the handover, and the NTP timestamp in the SR packet of the pre-switch media stream and the SR packet in the switched media stream.
  • the NTP timestamp recalculates the RTP timestamp in the first RTP packet of the media stream after the switch.
  • the RTP timestamp in the first RTP packet may be used to regenerate the RTP timestamp for the subsequent data packet of the switched media stream.
  • the first RTP packet of the switched media stream refers to the first RTP packet sent to the user after the media switch.
  • the calculated RTP timestamp can also be adjusted according to the feedback of the user: the user periodically performs delay feedback, receives the delay feedback of the user, and adjusts and sends the RTP packet according to the delay feedback of the user.
  • the value of the RTP timestamp so that the delay on the user side can be eliminated by adjusting the advance time of the timestamp.
  • the media streams of the two channels are consistent in media format, sample rate, and resolution. It is to be understood that the following technical details are specific examples in the implementation of the present application and do not constitute a limitation of the present invention.
  • the accuracy of the system time based on the commonly used streaming server is likely to fail to meet the requirements for accurate timing of each packet. Therefore, in this example, the system time + real-time clock is used.
  • the mode of the clock is timed.
  • the server When the server starts, it reads the current system time and uses this as the reference time.
  • the server uses the high-precision RTC clock that comes with the Linux system to calculate the elapsed time, adds the elapsed time to the reference time, and gets a current time. Time, the current RTC time is taken in the subsequent samples.
  • an RTP time stamp deviation correction model based on RTC mechanism is established.
  • the current RTC clock information is extracted from the SR packets received from each track, and the original NTP clock information is replaced as the NTP timestamp of the SR packet. After the channel is switched, the current NTP clock information may be unrelated.
  • the time stamps of the two tracks are continuous.
  • the specific calculation process of the model is as follows:
  • the timestamp of the SR recently received by the track are calculated.
  • the payload type of the current RTP packet sent by this track needs to be consistent with the initial payload type (ayload type) of the track.
  • the timestamp (unit: second) of the SR packet is re-corrected according to the sampling rate of the track, the timestamp of the SR packet recently sent by the track, the RTC timestamp, and the RTC timestamp information of the currently sent SR. as follows:
  • TS Timestamp of the most recent RTCP packet of the media track (timestamp).
  • TS "> The corrected timestamp of the RTCP packet sent by the media track.
  • X The divisibility factor of the NTP timestamp, for example: OxFFFFFFFF.
  • The fractional part of the RTC timestamp of the SR packet recently received by the media track (unit: 1 second).
  • t the time scale of the orbital scale.
  • P t The initial payload type of the channel.
  • N RTC time (in seconds) of the RTP packet whose media track number is n.
  • AN The absolute difference in RTC time between two RTP packets before and after the media track (unit: second).
  • the timestamp of the SR packet recently sent by the track.
  • the present invention provides another embodiment of a body stream switching synchronization method.
  • the flowchart is as shown in FIG. 3, and includes:
  • the streaming media server receives the RTP packet of the media stream
  • the streaming media server replaces the RTP timestamp in the RTP packet according to the system timestamp when the RTP arrives; the system timestamp is generated according to the system time, and a unique system timestamp is generated every unit time;
  • the foregoing embodiment of the present invention re-establishes the reference time axis by using the local system time of the streaming media server as a reference point.
  • the system timestamp is re-generated as the RTP timestamp according to the reference time axis.
  • the generated timestamp is based on the reference time axis and is in the same unit of the streaming server system time (the unit time is related to the time precision of the system time as follows: eg milliseconds) Received multiple packets, generated timestamp value If the media stream is switched, the RTP timestamp conversion is not required, and the media stream is synchronously switched.
  • the streaming server provided by the present invention will be described in detail below.
  • the terminal device may be a mobile phone or a data card or the like
  • the function module/unit included may be a hardware module/unit, a software module/unit or a combination of software and hardware. /unit.
  • the present invention provides an embodiment of a streaming media server.
  • the schematic diagram of the structure is as shown in FIG. 4, including: a data packet receiving unit 410, configured to receive a SR packet of a media stream;
  • a timestamp modification unit 420 configured to record a system time when the real-time transmission control protocol packet is received, and modify a network time-of-service protocol NTP timestamp of the SR packet received by the data packet receiving unit according to the recorded system time;
  • the switching control unit 430 is configured to perform synchronous switching according to an NTP timestamp in the SR packet of the media stream when performing media stream switching.
  • the handover control unit 430 may include:
  • the timestamp generating unit 431, according to the RTP timestamp in the last real-time transport protocol RTP packet of the media stream before the handover, and the NTP timestamp in the SR packet of the media stream before the handover and the NTP timestamp in the SR packet of the switched media stream, Recalculating the RTP timestamp in the first RTP packet of the media stream after the handover is generated;
  • the sending unit 432 is configured to add the RTP timestamp of the switched media stream calculated by the timestamp calculating unit to the RTP packet of the switched media stream, and send the RTP packet to the user.
  • the timestamp generating unit 431 is further configured to: regenerate an RTP timestamp for the subsequent data packet of the switched media stream according to the RTP timestamp in the first RTP packet of the re-calculated media stream, and receive the user
  • the delay feedback adjusts the value of the RTP timestamp of the RTP packet sent according to the user's delay feedback.
  • the present invention provides another embodiment of a streaming media server.
  • the structure is shown in FIG. 6.
  • the receiving unit 610 is configured to receive an RTP packet of a media stream.
  • the timestamp replacement unit 620 is configured to replace the RTP timestamp in the RTP packet according to the system timestamp when the RTP arrives; the system timestamp is generated according to the system time, and a unique system timestamp is generated every unit time;
  • the switching control unit 630 is configured to perform synchronous switching according to a system timestamp in the RTP packet of the media stream.
  • the foregoing storage medium includes: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, and the program code can be stored. Medium.
  • the media stream switching synchronization method and the streaming media server provided by the embodiments of the present invention are described above.
  • the description of the above embodiments is only for helping to understand the method and core ideas of the present invention. Meanwhile, for those skilled in the art, The present invention is not limited by the scope of the present invention.

Abstract

A streaming media server and a method for synchronization in media stream switching are disclosed. In the embodiments of the present invention, a streaming media data packet is modified; NTP timestamps are replaced by system time of the streaming media server in order that the Network Time Protocol (NTP) timestamps of several media streams are switched from distinct sources to the same source; or the calibration of the Real-time Transport Protocol (RTP) timestamps of several received media streams is absolutely normalized according to the system time of the streaming media server directly; thereby the synchronization in media switching is realized. The problem that media streams of different NTP timepieces can not be switched in the prior art is resolved, and the user service experience is improved.

Description

媒体流切换同步方法和流媒体服务器 本申请要求于 2009 年 11 月 16 日提交中国专利局、 申请号为 200910180193.2、 发明名称为"媒体流切换同步方法和流媒体服务器"的中国 专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域  Media stream switching synchronization method and streaming server This application claims priority to Chinese patent application filed on November 16, 2009 by the Chinese Patent Office, Application No. 200910180193.2, and entitled "Media Stream Switching Synchronization Method and Streaming Media Server" The entire contents of which are incorporated herein by reference. Technical field
本发明涉及通信技术领域, 具体涉及媒体流切换同步方法和流媒体服务 器。 背景技术  The present invention relates to the field of communications technologies, and in particular, to a media stream switching synchronization method and a streaming media server. Background technique
实时传输协议 ( Realtime Transport Protocol , RTP ): 是针对互联网 ( Internet )上多媒体数据流的一个传输协议。 RTP被定义为在一对一或一对 多的传输情况下工作, 其目的是提供时间信息和实现流同步。 RTP本身只保 证实时数据的传输, 并不能为按顺序传送数据包提供可靠的传送机制, 也不 提供流量控制或拥塞控制, 它依靠实时传输控制协议 (Real-time Control Protocol, RTCP)提供服务。  Realtime Transport Protocol (RTP): A transport protocol for multimedia data streams over the Internet. RTP is defined to operate in a one-to-one or one-to-many transmission with the purpose of providing time information and stream synchronization. RTP itself only guarantees the transmission of data when it is confirmed. It does not provide a reliable transmission mechanism for transmitting packets in sequence, nor does it provide flow control or congestion control. It relies on Real-time Control Protocol (RTCP) to provide services.
RTCP协议负责管理传输质量在当前应用进程之间交换控制信息。在 RTP 会话期间, 各参与者周期性地传送 RTCP包, 包中含有已发送的数据包的数 量、 丟失的数据包的数量等统计资料, 因此, 服务器可以利用这些信息动态 地改变传输速率, 甚至改变有效载荷类型。 RTP和 RTCP配合使用, 能以有 效的反馈和最小的开销使传输效率最佳化,故特别适合传送网上的实时数据。  The RTCP protocol is responsible for managing the transmission quality to exchange control information between current application processes. During the RTP session, each participant periodically transmits RTCP packets, which contain statistics such as the number of transmitted packets and the number of lost packets. Therefore, the server can use this information to dynamically change the transmission rate, even Change the payload type. Used in conjunction with RTCP, RTP optimizes transmission efficiency with efficient feedback and minimal overhead, making it ideal for delivering real-time data on the network.
RTP包中, 包序列号和时间戳的初始值都是随机的, 时间戳只是反映了 第一个字节的釆样时间。 不同媒体流的 RTP时间戳可能以不同的速率增长, 而且会有独立的随机偏移量。 因此, 但直接比较不同的媒体流的时间戳并不 能进行同步。  In the RTP packet, the initial values of the packet sequence number and timestamp are random, and the timestamp only reflects the sampling time of the first byte. RTP timestamps for different media streams may grow at different rates and have independent random offsets. Therefore, it is not possible to synchronize the time stamps of different media streams directly.
RTCP的一个关键作用就是能让接收方同步多个 RTP流, 例如: 当音频 与视频一起传输的时候, 由于编码的不同, RTP使用两个流分别进行传输, 这样两个流的时间戳以不同的速率运行, 接收方必须同步两个流, 以保证声 音与影像的一致。 为能进行流同步, 在传递的发送者报告中含有一个以网络 时间协议 NTP(Network Time Protocol)格式表示的绝对时间值 ,接着发送者报 告( Sender Report, SR )中给出一个 RTP时间戳 ( timestamp )值, 产生该值 的时钟就是产生 RTP分组中的时间戳字段的那个时钟。 发送者报告为 RTCP 数据包, 符合 RTCP协议标准, 由于发送方发出的所有流和发送方报告都使 用同一个绝对时钟(NTP 时钟), 接收方就可以比较来自同一数据源的两个 流的绝对时间, 从而确定如何将一个流中的时间戳值映射为另一个流中的时 间戳值。 A key function of RTCP is to enable the receiver to synchronize multiple RTP streams. For example: When audio and video are transmitted together, RTP uses two streams for transmission because of different encodings, so the time stamps of the two streams are different. At the rate of operation, the receiver must synchronize the two streams to ensure that the sound is consistent with the image. In order to be able to perform stream synchronization, there is a network in the sender report that is delivered. The absolute time value represented by the time protocol NTP (Network Time Protocol) format, and then an RTP timestamp (timestamp) value is given in the sender report (Sender Report, SR), and the clock generating the value is the timestamp in the RTP packet. The clock of the field. The sender reports as an RTCP packet, which conforms to the RTCP protocol standard. Since all the streams sent by the sender and the sender report use the same absolute clock (NTP clock), the receiver can compare the absolutes of the two streams from the same data source. Time, thereby determining how to map the timestamp value in one stream to the timestamp value in another stream.
发明内容 Summary of the invention
本发明实施例提供媒体流切换同步方法和流媒体服务器,可以在 NTP不 同源的情况下, 实现媒体流的同步切换。  The embodiment of the invention provides a media stream switching synchronization method and a streaming media server, which can realize synchronous switching of media streams when NTP is not homologous.
本发明实施例提供的一种媒体流切换同步方法, 包括:  A media stream switching synchronization method provided by an embodiment of the present invention includes:
流媒体服务器接收媒体流的发送者报告包;  The streaming server receives the sender report packet of the media stream;
流媒体服务器记录收到所述发送者报告包时的系统时间, 并依据所述记 录的系统时间修改所述发送者报告包包的网络校时协议网络校时协议时间 戳;  The streaming media server records the system time when the sender reports the packet, and modifies the network calibration protocol network time-of-day protocol time stamp of the sender report packet according to the recorded system time;
当进行媒体流切换时, 根据媒体流的发送者报告包中的网络校时协议时 间戳进行同步切换。  When media stream switching is performed, synchronous switching is performed according to the network timing protocol time stamp in the sender report packet of the media stream.
本发明实施例提供的一种媒体流切换同步方法, 包括:  A media stream switching synchronization method provided by an embodiment of the present invention includes:
流媒体服务器接收媒体流的实时传输协议包;  The streaming media server receives the real-time transport protocol packet of the media stream;
流媒体服务器根据实时传输协议到达时的系统时间戳替换实时传输协议 包中的实时传输协议时间戳; 所述系统时间戳按照系统时间生成, 每个单位 时间生成唯一的系统时间戳;  The streaming media server replaces the real-time transport protocol timestamp in the real-time transport protocol packet according to the system timestamp when the real-time transport protocol arrives; the system timestamp is generated according to the system time, and a unique system timestamp is generated per unit time;
当进行媒体流切换时, 根据媒体流的实时传输协议包中的系统时间戳的 进行同步切换。  When the media stream is switched, the system time stamp in the real-time transport protocol packet of the media stream is synchronously switched.
本发明实施例提供的一种流媒体服务器, 包括:  A streaming media server provided by an embodiment of the present invention includes:
数据包接收单元, 用于接收媒体流的发送者报告包;  a data packet receiving unit, configured to receive a sender report packet of the media stream;
时间戳修改单元, 用于记录收到所述实时传输控制协议包时的系统时间 , 并依据所述记录的系统时间修改所述发送者报告包的网络校时协议网络校时 协议时间戳; a timestamp modification unit, configured to record a system time when the real-time transmission control protocol packet is received, and modify a network timing protocol network timing of the sender report packet according to the recorded system time Protocol timestamp
切换控制单元, 用于在进行媒体流切换时, 根据媒体流的发送者报告包 中的网络校时协议时间戳进行同步切换。  The switching control unit is configured to perform synchronous switching according to a network calibration time stamp in the sender report packet of the media stream when the media stream is switched.
本发明实施例提供的一种流媒体服务器, 包括:  A streaming media server provided by an embodiment of the present invention includes:
接收单元, 用于接收媒体流的实时传输协议包;  a receiving unit, configured to receive a real-time transport protocol packet of the media stream;
时间戳替换单元, 用于根据实时传输协议到达时的系统时间戳替换实时 传输协议包中的实时传输协议时间戳; 所述系统时间戳按照系统时间生成, 每个单位时间生成唯一的系统时间戳; 切换控制单元, 用于根据媒体流的实时传输协议包中的系统时间戳的进 行同步切换。  a timestamp replacement unit, configured to replace a real-time transport protocol timestamp in the real-time transport protocol packet according to a system timestamp when the real-time transport protocol arrives; the system timestamp is generated according to a system time, and a unique system timestamp is generated per unit time And a switching control unit, configured to perform synchronous switching according to a system timestamp in a real-time transport protocol packet of the media stream.
本发明实施例中, 对流媒体数据包进行修改, 釆用将流媒体服务器的系 统时间替换 NTP时间戳, 完成多个媒体流的 NTP时间戳从不同源到同源的 转换,或者直接根据流媒体服务器的系统时间对收到的多个媒体流的 RTP时 间戳进行绝对统一校准, 以此实现媒体切换的同步。 解决了现有技术中不同 NTP时钟的媒体流无法切换的问题, 提高了用户的业务体验。 附图说明  In the embodiment of the present invention, the streaming media data packet is modified, and the system time of the streaming media server is replaced with the NTP timestamp, and the NTP time stamp of the multiple media streams is converted from different sources to the same source, or directly according to the streaming media. The system time of the server performs absolute unified calibration on the received RTP timestamps of multiple media streams, thereby realizing the synchronization of media switching. The problem that the media stream of different NTP clocks cannot be switched in the prior art is solved, and the service experience of the user is improved. DRAWINGS
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中 所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本 发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的 前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in view of the drawings.
图 1是本发明一实施例媒体流切换同步方法的流程图;  1 is a flowchart of a method for media stream switching synchronization according to an embodiment of the present invention;
图 2是本发明实施例媒体流同步切换的流程图;  2 is a flowchart of a media stream synchronous switching according to an embodiment of the present invention;
图 3是本发明另一实施例媒体流切换同步方法的流程图;  3 is a flowchart of a method for media stream switching synchronization according to another embodiment of the present invention;
图 4是本发明一实施例流媒体服务器的结构示意图;  4 is a schematic structural diagram of a streaming media server according to an embodiment of the present invention;
图 5是本发明实施例流媒体服务器的切换控制单元的结构示意图; 图 6是本发明另一实施例流媒体服务器的结构示意图。 具体实施方式 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明实施例, 基于本发 明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获得的 所有其他实施例, 都属于本发明保护的范围。 5 is a schematic structural diagram of a switching control unit of a streaming media server according to an embodiment of the present invention; and FIG. 6 is a schematic structural diagram of a streaming media server according to another embodiment of the present invention. detailed description The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only embodiments of the present invention, based on the embodiments of the present invention, All other embodiments obtained by a person of ordinary skill in the art without creative efforts are within the scope of the present invention.
由于基于 NTP时钟机制进行的媒体流的同步,需要保证切换的两个媒体 流釆用同一个 NTP时钟, 否则将无法完成媒体流之间的切换,但是在实际应 用中,有时很难保证所有媒体流之间的 NTP时钟同源, 经常无法进行同步切 换或切换出错。 针对于此, 本发明提出了解决方案。  Because the media stream is synchronized based on the NTP clock mechanism, it is necessary to ensure that the two media streams that are switched use the same NTP clock. Otherwise, the switching between media streams cannot be completed. However, in practical applications, it is sometimes difficult to ensure all media. The NTP clocks between streams are the same, and it is often impossible to perform synchronous switching or switching errors. In response to this, the present invention proposes a solution.
本发明提供一种媒体流切换同步方法实施例, 流程图如图 1所示, 包括: The embodiment of the present invention provides a media stream switching synchronization method. The flowchart is as shown in FIG. 1 and includes:
A1 , 流媒体服务器接收媒体流的 SR包; A1, the streaming media server receives the SR packet of the media stream;
A2, 流媒体服务器记录收到 SR包时的系统时间, 并依据记录的系统时间 修改 SR包的网络校时协议 NTP时间戳;  A2, the streaming media server records the system time when the SR packet is received, and modifies the network timing protocol NTP timestamp of the SR packet according to the recorded system time;
A3 , 当进行媒体流切换时, 根据媒体流的 SR包中的 NTP时间戳进行同步 切换。  A3. When the media stream is switched, the NTP time stamp in the SR packet of the media stream is synchronously switched.
本发明实施例中, 对流媒体数据包进行修改, 釆用将流媒体服务器的系 统时间替换 NTP时间戳, 完成多个媒体流的 NTP时间戳从不同源到同源的 转换, 以此实现媒体切换的同步。解决了现有技术中不同 NTP时钟的媒体流 无法切换的问题, 提高了用户的业务体验。  In the embodiment of the present invention, the streaming media data packet is modified, and the system time of the streaming media server is replaced with the NTP timestamp, and the NTP time stamp of the multiple media streams is converted from different sources to the same source, thereby implementing media switching. Synchronization. The problem that the media stream of different NTP clocks cannot be switched in the prior art is solved, and the service experience of the user is improved.
本发明实施例中,根据媒体流的实时传输控制协议包中的 NTP时间戳进行 同步切换的方式可以参照现有技术的常规实现方式, 为使得切换后媒体流的 获得时间戳更加准确, 本发明提供一种可行的切换方式, 具体参见图 2所示, 包括:  In the embodiment of the present invention, the method for performing the synchronous switching according to the NTP timestamp in the real-time transmission control protocol packet of the media stream may refer to the conventional implementation manner of the prior art, so that the time stamp of obtaining the media stream after the handover is more accurate, the present invention Provide a feasible switching mode, as shown in Figure 2, including:
B1 , 进行媒体流切换时, 流媒体服务器根据切换前媒体流最后一个实时 传输协议 RTP包中的 RTP 时间戳以及切换前媒体流的 SR包中 NTP时间戳和切 换后的媒体流的 SR包中的 NTP时间戳,重新计算切换后媒体流第一个 RTP包中 的 RTP时间戳。  B1, when the media stream is switched, the streaming media server is based on the RTP timestamp in the last real-time transport protocol RTP packet of the media stream before the handover, and the NTP timestamp in the SR packet of the pre-switch media stream and the SR packet in the switched media stream. The NTP timestamp recalculates the RTP timestamp in the first RTP packet of the media stream after the switch.
具体的重新计算切换后媒体流的 RTCP包中的 RTP 时间戳的过程包括: 切换后的媒体流第一个 RTP包的 RTP时间戳 = (切换后的媒体流的 SR包的 NTP时间戳 - 切换前媒体流的 SR包的 NTP 时间戳) X 切换前媒体流的釆 样率 + 切换前媒体流的 SR包的 RTP 时间戳。 当得到切换后的媒体流的第一个 RTP包时间戳之后, 则可以第一个 RTP包 中的 RTP时间戳, 为切换后的媒体流后续的数据包重新生成 RTP时间戳。 这里 的切换后的媒体流的第一个 RTP包是指媒体切换后发送给用户的第一个 RTP 包。 The specific process of recalculating the RTP timestamp in the RTCP packet of the switched media stream includes: RTP timestamp of the first RTP packet of the switched media stream = (SR packet of the switched media stream) NTP timestamp - NTP timestamp of the SR packet of the previous media stream) X Rate of sampling of the media stream before switching + RTP timestamp of the SR packet of the media stream before switching. After the timestamp of the first RTP packet of the switched media stream is obtained, the RTP timestamp in the first RTP packet may be used to regenerate the RTP timestamp for the subsequent data packet of the switched media stream. Here, the first RTP packet of the switched media stream refers to the first RTP packet sent to the user after the media switch.
B2, 将时间戳计算单元计算得到的切换后媒体流的 RTP时间戳加入到切 换后的媒体流的 RTP包中发送给用户。  B2: The RTP timestamp of the switched media stream calculated by the timestamp computing unit is added to the RTP packet of the switched media stream and sent to the user.
可以理解,在本发明实施例中,计算得到的 RTP时间戳还可以根据用户的 反馈进行调整: 用户定期进行时延反馈, 当接收用户的时延反馈, 根据用户 的时延反馈调整发送 RTP包的 RTP时间戳的值, 这样则可以通过对时间戳进行 的提前量调整, 来消除用户侧的延迟。  It can be understood that, in the embodiment of the present invention, the calculated RTP timestamp can also be adjusted according to the feedback of the user: the user periodically performs delay feedback, receives the delay feedback of the user, and adjusts and sends the RTP packet according to the delay feedback of the user. The value of the RTP timestamp, so that the delay on the user side can be eliminated by adjusting the advance time of the timestamp.
条件假设: 的两个频道的媒体流在媒体格式、 釆样率、 分辩率均保持一致。 可以理解, 以下技术细节均为本申请实现过程中的具体实例, 不构成对本发明的限制。 Conditional assumptions: The media streams of the two channels are consistent in media format, sample rate, and resolution. It is to be understood that the following technical details are specific examples in the implementation of the present application and do not constitute a limitation of the present invention.
本例中, 基于常用的流媒体服务器的系统时间的精确程度很可能无法达 到对每一个数据包精确计时的要求, 因此本例中釆用系统时间 +实时时钟 In this example, the accuracy of the system time based on the commonly used streaming server is likely to fail to meet the requirements for accurate timing of each packet. Therefore, in this example, the system time + real-time clock is used.
( Real-Time Clock, RTC ) 时钟的模式进行计时。 当服务器启动时, 读取当 前系统时间并将此作为基准时间, 服务器釆用 linux系统自带的高精度 RTC 时钟来计算所流逝的时间, 将流逝的时间再加上基准时间, 便得到一个当前 时间, 后续釆样时均取当前的 RTC时间。 ( Real-Time Clock, RTC) The mode of the clock is timed. When the server starts, it reads the current system time and uses this as the reference time. The server uses the high-precision RTC clock that comes with the Linux system to calculate the elapsed time, adds the elapsed time to the reference time, and gets a current time. Time, the current RTC time is taken in the subsequent samples.
在上述高精度时钟机制存在的前提下, 建立基于 RTC机制的 RTP时间 戳偏差校正模型。利用从各个轨道接收到的 SR包中提取当前 RTC时钟信息, 替换原来的 NTP时钟信息,作为该 SR包的 NTP时间戳, 频道切换后, 就可 以根据当前新的 NTP 时钟信息将原本不相关的两个轨道的时间戳具备连续 性。 模型具体的推算过程如下:  Under the premise of the above high-precision clock mechanism, an RTP time stamp deviation correction model based on RTC mechanism is established. The current RTC clock information is extracted from the SR packets received from each track, and the original NTP clock information is replaced as the NTP timestamp of the SR packet. After the channel is switched, the current NTP clock information may be unrelated. The time stamps of the two tracks are continuous. The specific calculation process of the model is as follows:
对于该轨道每一个 RTP包, 在发送之前根据轨道的釆样率, 轨道最近收 到的 SR的时间戳、 RTC时间戳, RTP本身的时间戳, 轨道最近发送的 RTP 的时间戳等信息, 计算出 RTC时间值(单位: 秒), 计算公式如下: Nn =Nsec +Nfrac/X + (tsr -TS)lt 公式 (1) 该轨道前后两个包的 RTC时间差值 (单位: 秒), 计算公式如下: = H 公式 (2) For each RTP packet of the track, according to the sampling rate of the track, the timestamp of the SR recently received by the track, the RTC timestamp, the timestamp of the RTP itself, the timestamp of the RTP sent by the track, etc., are calculated. The RTC time value (unit: second) is calculated as follows: N n =N sec +N frac /X + (ts r -TS)lt Equation (1) The RTC time difference between two packets before and after the orbit (unit: second), calculated as follows: = H Equation (2)
该轨道当前发送 RTP包的纠正后的时间戳 , 计算公式如下: tsm =(ANxt) + tsc 公式 (3) The corrected timestamp of the current RTP packet sent by the track, calculated as follows: ts m = (ANxt) + ts c formula (3)
该轨道当前发送 RTP包的纠正后的包序列号 计算公式如下: seqm =seqc+l 公式 (4) The corrected packet sequence number for the current RTP packet sent by this track is calculated as follows: seq m =seq c +l Equation (4)
该轨道当前发送 RTP 包的 payload type需保持跟轨道最初的负载类型 ( ayload type )一致。  The payload type of the current RTP packet sent by this track needs to be consistent with the initial payload type (ayload type) of the track.
= Pt 公式 (5)  = Pt formula (5)
对于该轨道每一个 SR包, 由于其 RTC时间戳是可以保证正确的, 那么 只需糾正时间戳。 在发送之前需根据轨道的釆样率, 以轨道最近发送的 SR 包的时间戳、 RTC时间戳、 当前发送 SR的 RTC时间戳信息, 重新纠正 SR 包的时间戳(单位: 秒), 计算公式如下:  For each SR packet of the track, since its RTC timestamp is guaranteed to be correct, then only the timestamp is corrected. Before sending, the timestamp (unit: second) of the SR packet is re-corrected according to the sampling rate of the track, the timestamp of the SR packet recently sent by the track, the RTC timestamp, and the RTC timestamp information of the currently sent SR. as follows:
TSm = ("sec +nfrac /X-(nsec_c +nfrac_c/X))/t + TSc 公式 (6) 综合公式 (1)(2)(3)(4) (5)(6), 可得音视频同步目标函数如下: TS m = (" sec +n frac /X-(n sec _ c +n frac _ c /X))/t + TS c Formula (6) General formula (1)(2)(3)(4) ( 5) (6), the audio and video synchronization target function is as follows:
目标函数 H 公式 (7)  Objective function H formula (7)
seqm =seqc+l 公式 (8) Seq m =seq c +l formula (8)
^m = d -Nn)xt + tsc 公式 (9) ^ m = d -N n )xt + ts c formula (9)
TSm = (nsec +nfrac IX_{n一 +rifrac_c I X))l t + TSC 公式 (10) 约束条件 "≥0," l,2, + ++,N TS m = (n sec +n frac IX_{n一+rifrac _ c IX)) lt + TS C formula (10) Constraint "≥0," l,2, + ++,N
ts,„≠ ts„ 以上公式的中的参量定义如下:  Ts, „≠ ts„ The parameters in the above formula are defined as follows:
TS: 媒体轨最近的 RTCP包的时间戳( timestamp )。  TS: Timestamp of the most recent RTCP packet of the media track (timestamp).
TS">: 媒体轨发送的 RTCP包经过纠正后的时间戳。 TS ">: The corrected timestamp of the RTCP packet sent by the media track.
X: NTP时间戳的整除因子, 例如: OxFFFFFFFF。  X: The divisibility factor of the NTP timestamp, for example: OxFFFFFFFF.
Ν · 媒体轨最近收到的 SR包的 RTC时间戳的整数部分 (单位: 秒)。 Ν · The integer part (in seconds) of the RTC timestamp of the SR packet recently received by the media track.
^ :媒体轨最近收到的 SR包的 RTC时间戳的小数部分(单位: I 秒)。 t: 轨道的釆样率时标( time scale )。 : 当前 RTP包的原始序列号 ( sequence number )。 ^ : The fractional part of the RTC timestamp of the SR packet recently received by the media track (unit: 1 second). t: the time scale of the orbital scale. : The original sequence number of the current RTP packet.
seq>»: 当前 RTP包校正后的 sequence number„ s eq >»: sequence number after correction of the current RTP package
当前 RTP包的原始 timestamp。  The original timestamp of the current RTP packet.
ts 当前 RTP包校正后的 timestamp。 t s The timestamp after the current RTP packet is corrected.
: 当前 SR包的 RTC时间戳的整数部分(单位: 秒)。  : The integer part (in seconds) of the RTC timestamp of the current SR packet.
" : 当前 SR包的 RTC时间戳的小数部分(单位: 1/ 秒)。  " : The fractional part of the RTC timestamp of the current SR packet (unit: 1/sec).
Pt: 频道最初的 payload type。 P t : The initial payload type of the channel.
pt 当前 RTP包校正后的 payload type。 p t The current payload type of the RTP packet.
N": 媒体轨序号为 n的 RTP包的 RTC时间 (单位: 秒)。  N": RTC time (in seconds) of the RTP packet whose media track number is n.
AN: 媒体轨前后两个 RTP包的 RTC时间绝对差 (单位: 秒)。  AN: The absolute difference in RTC time between two RTP packets before and after the media track (unit: second).
se 轨道最近发送的 RTP包的 sequence。 The sequence of the RTP packet recently sent by the s e track.
ts . 轨道最近发送的 RTP包的 timestamp。 t s . The timestamp of the RTP packet recently sent by the track.
: 轨道最近发送的 RTP包的原始 timestamp。  : The original timestamp of the RTP packet that was last sent by the track.
轨道最近发送的 SR包的 timestamp。  The timestamp of the SR packet recently sent by the track.
" : 轨道最近发送的 SR包的 RTC时间戳的整数部分(单位: 秒 )。  " : The integer part (in seconds) of the RTC timestamp of the SR packet sent by the track.
:轨道最近发送的 SR包的 RTC时间戳的小数部分(单位: 秒)。 本发明提供另一种某体流切换同步方法实施例,流程图如图 3所示, 包括: : The fractional part (in seconds) of the RTC timestamp of the SR packet recently sent by the track. The present invention provides another embodiment of a body stream switching synchronization method. The flowchart is as shown in FIG. 3, and includes:
C1 , 流媒体服务器接收媒体流的 RTP包; C1, the streaming media server receives the RTP packet of the media stream;
C2 , 流媒体服务器根据 RTP到达时的系统时间戳替换 RTP包中的 RTP时间 戳; 系统时间戳按照系统时间生成, 每个单位时间生成唯一的系统时间戳; C2, the streaming media server replaces the RTP timestamp in the RTP packet according to the system timestamp when the RTP arrives; the system timestamp is generated according to the system time, and a unique system timestamp is generated every unit time;
C3 , 当进行媒体流切换时, 根据媒体流的 RTP包中的系统时间戳的进行 同步切换。 C3. When the media stream is switched, the system timestamp in the RTP packet of the media stream is synchronously switched.
本发明上述实施例均使用流媒体服务器的本地系统时间作为参考点重新 建立参考时间轴,而本实施例则是根据参考时间轴重新对收到的 RTP数据包 重新生成系统时间戳作为 RTP时间戳, 生成的时间戳以参考时间轴为基准, 在流媒体服务器系统时间的同一单位(单位时间与系统时间的时间精度相关 如: 如: 毫秒) 收到的多个数据包, 生成的时间戳数值相等, 那么在进行媒 体流切换时, 则无需进行 RTP时间戳转换, 实现了媒体流的同步切换。 下面对本发明提供的流媒体服务器进行详细描述。 为了便于说明, 仅示 出了与本发明实施例相关的部分, 该终端设备可以是手机或数据卡或类似的 终端,其包含的功能模块 /单元可以是硬件模块 /单元、软件模块 /单元或软硬件 相结合的模块 /单元。 The foregoing embodiment of the present invention re-establishes the reference time axis by using the local system time of the streaming media server as a reference point. In this embodiment, the system timestamp is re-generated as the RTP timestamp according to the reference time axis. The generated timestamp is based on the reference time axis and is in the same unit of the streaming server system time (the unit time is related to the time precision of the system time as follows: eg milliseconds) Received multiple packets, generated timestamp value If the media stream is switched, the RTP timestamp conversion is not required, and the media stream is synchronously switched. The streaming server provided by the present invention will be described in detail below. For the sake of explanation, only show In a part related to the embodiment of the present invention, the terminal device may be a mobile phone or a data card or the like, and the function module/unit included may be a hardware module/unit, a software module/unit or a combination of software and hardware. /unit.
本发明提供一种流媒体服务器实施例, 结构示意图如图 4所示, 包括: 数据包接收单元 410, 用于接收媒体流的 SR包;  The present invention provides an embodiment of a streaming media server. The schematic diagram of the structure is as shown in FIG. 4, including: a data packet receiving unit 410, configured to receive a SR packet of a media stream;
时间戳修改单元 420 , 用于记录收到实时传输控制协议包时的系统时间, 并依据记录的系统时间修改数据包接收单元收到的 SR包的网络校时协议 NTP 时间戳;  a timestamp modification unit 420, configured to record a system time when the real-time transmission control protocol packet is received, and modify a network time-of-service protocol NTP timestamp of the SR packet received by the data packet receiving unit according to the recorded system time;
切换控制单元 430 , 用于在进行媒体流切换时, 根据媒体流的 SR包中的 NTP时间戳进行同步切换。  The switching control unit 430 is configured to perform synchronous switching according to an NTP timestamp in the SR packet of the media stream when performing media stream switching.
如图 5所示, 本实施例中, 切换控制单元 430可以包括:  As shown in FIG. 5, in this embodiment, the handover control unit 430 may include:
时间戳生成单元 431 , 根据切换前媒体流最后一个实时传输协议 RTP包中 的 RTP 时间戳以及切换前媒体流的 SR包中 NTP时间戳和切换后的媒体流的 SR包中的 NTP时间戳,重新计算生成切换后媒体流第一个 RTP包中的 RTP时间 戳;  The timestamp generating unit 431, according to the RTP timestamp in the last real-time transport protocol RTP packet of the media stream before the handover, and the NTP timestamp in the SR packet of the media stream before the handover and the NTP timestamp in the SR packet of the switched media stream, Recalculating the RTP timestamp in the first RTP packet of the media stream after the handover is generated;
发送单元 432, 用于将时间戳计算单元计算得到的切换后媒体流的 RTP时 间戳加入到切换后的媒体流的 RTP包中发送给用户。  The sending unit 432 is configured to add the RTP timestamp of the switched media stream calculated by the timestamp calculating unit to the RTP packet of the switched media stream, and send the RTP packet to the user.
所述时间戳生成单元 431还可以用于根据重新计算得到的切换后媒体流 第一个 RTP包中的 RTP时间戳, 为切换后的媒体流后续的数据包重新生成 RTP 时间戳, 并接收用户的时延反馈, 根据用户的时延反馈调整发送 RTP包的 RTP 时间戳的值。  The timestamp generating unit 431 is further configured to: regenerate an RTP timestamp for the subsequent data packet of the switched media stream according to the RTP timestamp in the first RTP packet of the re-calculated media stream, and receive the user The delay feedback adjusts the value of the RTP timestamp of the RTP packet sent according to the user's delay feedback.
本发明提供另一种流媒体服务器实施例, 结构示意图如图 6所示, 包括: 接收单元 610, 用于接收媒体流的 RTP包;  The present invention provides another embodiment of a streaming media server. The structure is shown in FIG. 6. The receiving unit 610 is configured to receive an RTP packet of a media stream.
时间戳替换单元 620 , 用于根据 RTP到达时的系统时间戳替换 RTP包中的 RTP时间戳; 系统时间戳按照系统时间生成,每个单位时间生成唯一的系统时 间戳;  The timestamp replacement unit 620 is configured to replace the RTP timestamp in the RTP packet according to the system timestamp when the RTP arrives; the system timestamp is generated according to the system time, and a unique system timestamp is generated every unit time;
切换控制单元 630, 用于根据媒体流的 RTP包中的系统时间戳的进行同步 切换。 上述本发明装置实施例可以运行的方法参照上述方法实施例的描述, 此 处不再赘述。 The switching control unit 630 is configured to perform synchronous switching according to a system timestamp in the RTP packet of the media stream. The method that can be operated by the foregoing embodiment of the device of the present invention is described with reference to the description of the foregoing method embodiments, and details are not described herein again.
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述 的存储介质包括: 只读存储器 (Read-Only Memory , ROM ), 随机存取器 ( Random Access Memory, RAM ), 磁碟或者光盘等各种可以存储程序代 码的介质。  A person skilled in the art can understand that all or part of the steps of implementing the above method embodiments may be completed by using hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed. The foregoing storage medium includes: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, and the program code can be stored. Medium.
以上对本发明实施例所提供的媒体流切换同步方法和流媒体服务器进行 述, 以上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同时, 对于本领域的一般技术人员, 依据本发明的思想, 在具体实施方式及应用范 围上均会有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限制。  The media stream switching synchronization method and the streaming media server provided by the embodiments of the present invention are described above. The description of the above embodiments is only for helping to understand the method and core ideas of the present invention. Meanwhile, for those skilled in the art, The present invention is not limited by the scope of the present invention.

Claims

权 利 要求 Rights request
1、 一种媒体流切换同步方法, 其特征在于, 包括:  A media stream switching synchronization method, comprising:
流媒体服务器接收媒体流的发送者报告包;  The streaming server receives the sender report packet of the media stream;
流媒体服务器记录收到所述发送者报告包时的系统时间, 并依据所述记 录的系统时间修改所述发送者报告包包的网络校时协议网络校时协议时间 戳;  The streaming media server records the system time when the sender reports the packet, and modifies the network calibration protocol network time-of-day protocol time stamp of the sender report packet according to the recorded system time;
当进行媒体流切换时, 根据媒体流的发送者报告包中的网络校时协议时 间戳进行同步切换。  When media stream switching is performed, synchronous switching is performed according to the network timing protocol time stamp in the sender report packet of the media stream.
2、 如权利要求 1所述的方法, 其特征在于, 所述根据媒体流的发送者报 告包中的网络校时协议时间戳进行同步切换包括:  2. The method according to claim 1, wherein the synchronizing switching according to the network calibration time stamp in the sender report packet of the media stream comprises:
进行媒体流切换时, 流媒体服务器根据切换前媒体流最后一个实时传输 协议包中的实时传输协议时间戳以及切换前媒体流的发送者报告包中网络校 时协议时间戳和切换后的媒体流的发送者报告包中的网络校时协议时间戳, 重新计算切换后媒体流第一个实时传输协议包中的实时传输协议时间戳; 将时间戳计算单元计算得到的切换后媒体流的实时传输协议时间戳加入 到切换后的媒体流的实时传输协议包中发送给用户。  When the media stream is switched, the streaming media server according to the real-time transport protocol timestamp in the last real-time transport protocol packet of the media stream before the handover and the sender of the pre-switch media stream report the network calibration protocol timestamp and the switched media stream in the packet. The sender reports the timestamp of the network calibration protocol in the packet, and recalculates the real-time transport protocol timestamp in the first real-time transport protocol packet of the switched media stream; real-time transmission of the switched media stream calculated by the timestamp computing unit The protocol timestamp is added to the user in the real-time transport protocol packet of the switched media stream.
3、 如权利要求 2所述的方法, 其特征在于, 所述重新计算切换后媒体流 第一个实时传输协议包中的实时传输协议时间戳之后包括:  3. The method according to claim 2, wherein the recalculating the media stream after the switching of the real-time transport protocol timestamp in the first real-time transport protocol packet comprises:
根据所述重新计算得到的切换后媒体流第一个实时传输协议包中的实时 传输协议时间戳, 为切换后的媒体流后续的数据包重新生成实时传输协议时 间戳。  And real-time transmission protocol time stamp in the first real-time transmission protocol packet of the re-calculated mobile media stream, and real-time transmission protocol time stamp is regenerated for the subsequent data packet of the switched media stream.
4、 如权利要求 1至 3任意一项所述的方法, 其特征在于, 接收用户的时延 反馈, 根据所述用户的时延反馈调整发送实时传输协议包的实时传输协议时 间戳的值。  The method according to any one of claims 1 to 3, characterized in that the delay feedback of the user is received, and the value of the real-time transport protocol time stamp of the real-time transport protocol packet is adjusted according to the delay feedback of the user.
5、 一种媒体流切换同步方法, 其特征在于, 包括:  5. A media stream switching synchronization method, comprising:
流媒体服务器接收媒体流的实时传输协议包;  The streaming media server receives the real-time transport protocol packet of the media stream;
流媒体服务器根据实时传输协议到达时的系统时间戳替换实时传输协议 包中的实时传输协议时间戳; 所述系统时间戳按照系统时间生成, 每个单位 时间生成唯一的系统时间戳; The streaming media server replaces the real-time transport protocol timestamp in the real-time transport protocol packet according to the system timestamp when the real-time transport protocol arrives; the system timestamp is generated according to the system time, each unit Time generates a unique system timestamp;
当进行媒体流切换时, 根据媒体流的实时传输协议包中的系统时间戳的 进行同步切换。  When the media stream is switched, the system time stamp in the real-time transport protocol packet of the media stream is synchronously switched.
6、 一种流媒体服务器, 其特征在于, 包括:  6. A streaming media server, comprising:
数据包接收单元, 用于接收媒体流的发送者报告包;  a data packet receiving unit, configured to receive a sender report packet of the media stream;
时间戳修改单元, 用于记录收到所述实时传输控制协议包时的系统时间 , 并依据所述记录的系统时间修改所述发送者报告包的网络校时协议网络校时 协议时间戳;  a timestamp modification unit, configured to record a system time when the real-time transmission control protocol packet is received, and modify a network time-of-service protocol network calibration time stamp of the sender report packet according to the recorded system time;
切换控制单元, 用于在进行媒体流切换时, 根据媒体流的发送者报告包 中的网络校时协议时间戳进行同步切换。  The switching control unit is configured to perform synchronous switching according to a network calibration time stamp in the sender report packet of the media stream when the media stream is switched.
7、 如权利要求 6所述的流媒体服务器, 其特征在于, 所述切换控制单元 包括:  The streaming media server according to claim 6, wherein the switching control unit comprises:
时间戳计算单元, 根据切换前媒体流最后一个实时传输协议实时传输协 议包中的实时传输协议 时间戳以及切换前媒体流的发送者报告包中网络校 时协议时间戳和切换后的媒体流的发送者报告包中的网络校时协议时间戳, 重新计算切换后媒体流第一个实时传输协议包中的实时传输协议时间戳; 发送单元, 用于将时间戳计算单元计算得到的切换后媒体流的实时传输 协议时间戳加入到切换后的媒体流的实时传输协议包中发送给用户。  a timestamp calculation unit, according to a real-time transport protocol timestamp in the real-time transport protocol packet of the last real-time transport protocol of the media stream before the handover, and a network calibration timestamp and a switched media stream in the sender report packet of the pre-switch media stream The sender reports the timestamp of the network calibration protocol in the packet, and recalculates the real-time transport protocol timestamp in the first real-time transport protocol packet of the switched media stream; the sending unit is configured to calculate the switched media after the timestamp computing unit The real-time transport protocol timestamp of the stream is added to the real-time transport protocol packet of the switched media stream and sent to the user.
8、 如权利要求 7所述的方法, 其特征在于, 所述时间戳计算单元还用于 根据所述重新计算得到的切换后媒体流第一个实时传输协议包中的实时传输 协议时间戳, 为切换后的媒体流后续的数据包重新生成实时传输协议时间戳。  The method according to claim 7, wherein the timestamp calculation unit is further configured to: according to the recalculated real-time transmission protocol timestamp in the first real-time transmission protocol packet of the switched media stream, Regenerate the real-time transport protocol timestamp for subsequent packets of the switched media stream.
9、 如权利要求 6至 8任意一项所述的流媒体服务器, 其特征在于, 所述时 间戳计算单元还用于接收用户的时延反馈, 根据所述用户的时延反馈调整发 送实时传输协议包的实时传输协议时间戳的值。  The streaming media server according to any one of claims 6 to 8, wherein the timestamp calculation unit is further configured to receive delay feedback of the user, and adjust and send the real-time transmission according to the delay feedback of the user. The value of the real-time transport protocol timestamp of the protocol packet.
10、 一种流媒体服务器, 其特征在于, 包括:  10. A streaming media server, comprising:
接收单元, 用于接收媒体流的实时传输协议包;  a receiving unit, configured to receive a real-time transport protocol packet of the media stream;
时间戳替换单元, 用于根据实时传输协议到达时的系统时间戳替换实时 传输协议包中的实时传输协议时间戳; 所述系统时间戳按照系统时间生成, 每个单位时间生成唯一的系统时间戳; a timestamp replacement unit, configured to replace a real-time transport protocol timestamp in the real-time transport protocol packet according to a system timestamp when the real-time transport protocol arrives; the system timestamp is generated according to a system time, Generate a unique system timestamp per unit time;
切换控制单元, 用于根据媒体流的实时传输协议包中的系统时间戳的进 行同步切换。  And a switching control unit, configured to perform synchronous switching according to a system timestamp in a real-time transport protocol packet of the media stream.
PCT/CN2010/078760 2009-11-16 2010-11-16 Streaming media server and method for synchronization in media stream switching WO2011057588A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200910180193.2A CN102065060B (en) 2009-11-16 2009-11-16 Media stream switching synchronization method and streaming media server
CN200910180193.2 2009-11-16

Publications (1)

Publication Number Publication Date
WO2011057588A1 true WO2011057588A1 (en) 2011-05-19

Family

ID=43991223

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/078760 WO2011057588A1 (en) 2009-11-16 2010-11-16 Streaming media server and method for synchronization in media stream switching

Country Status (2)

Country Link
CN (1) CN102065060B (en)
WO (1) WO2011057588A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174979A (en) * 2022-06-20 2022-10-11 阿里巴巴(中国)有限公司 Streaming media transmission network, transmission control method, device, equipment and storage medium

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103517044B (en) * 2012-06-25 2016-12-07 鸿富锦精密工业(深圳)有限公司 Video conference device and the method for lip-sync thereof
US20140297882A1 (en) * 2013-04-01 2014-10-02 Microsoft Corporation Dynamic track switching in media streaming
CN103414939B (en) * 2013-07-29 2017-09-05 深圳Tcl新技术有限公司 A kind of channel switching method and device
CN110226329B (en) * 2017-01-27 2021-09-21 阿帕里奥全球咨询股份有限公司 Method and system for sending alternate image content for a physical display to different viewers
CN111885359A (en) * 2020-07-28 2020-11-03 中冶赛迪重庆信息技术有限公司 Intelligent rolling line monitoring system and method based on machine vision
CN113382210B (en) * 2021-08-12 2021-11-16 深圳市有为信息技术发展有限公司 Processing method of multi-channel monitoring video data, streaming media server and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996897A (en) * 2005-12-28 2007-07-11 中兴通讯股份有限公司 A method for real time detection of the network transfer delay in the RTP
CN101009686A (en) * 2006-01-23 2007-08-01 中兴通讯股份有限公司 A stream media playing method
US20080049635A1 (en) * 2006-08-25 2008-02-28 Sbc Knowledge Ventures, Lp Method and system for determining one-way packet travel time using RTCP
WO2009053899A2 (en) * 2007-10-25 2009-04-30 Nokia Corporation System and method for re-synchronization of a pss session to an mbms session

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101282482B (en) * 2008-05-04 2011-05-11 中兴通讯股份有限公司 Apparatus, system and method for synchronously playing video data and audio data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996897A (en) * 2005-12-28 2007-07-11 中兴通讯股份有限公司 A method for real time detection of the network transfer delay in the RTP
CN101009686A (en) * 2006-01-23 2007-08-01 中兴通讯股份有限公司 A stream media playing method
US20080049635A1 (en) * 2006-08-25 2008-02-28 Sbc Knowledge Ventures, Lp Method and system for determining one-way packet travel time using RTCP
WO2009053899A2 (en) * 2007-10-25 2009-04-30 Nokia Corporation System and method for re-synchronization of a pss session to an mbms session

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174979A (en) * 2022-06-20 2022-10-11 阿里巴巴(中国)有限公司 Streaming media transmission network, transmission control method, device, equipment and storage medium
CN115174979B (en) * 2022-06-20 2023-12-29 阿里巴巴(中国)有限公司 Streaming media transmission network, transmission control method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN102065060B (en) 2013-09-11
CN102065060A (en) 2011-05-18

Similar Documents

Publication Publication Date Title
EP1398931B1 (en) Synchronous play-out of media data packets
WO2011057588A1 (en) Streaming media server and method for synchronization in media stream switching
EP1606717B1 (en) Method and device for multimedia streaming
CN100442858C (en) Lip synchronous method for multimedia real-time transmission in packet network and apparatus thereof
KR101261123B1 (en) Improved method, system and apparatus for synchronizing signals
CN102356619B (en) Change stream synchronization
JP5433694B2 (en) Improved method, system and apparatus for signal synchronization
US8208460B2 (en) Method and system for in-band signaling of multiple media streams
CN102057687B (en) Synchronization of media stream components
US9621682B2 (en) Reduced latency media distribution system
KR20140104969A (en) Apparatus and method for synchronized transmission of multimedia content over an asynchronous network
WO2009053899A2 (en) System and method for re-synchronization of a pss session to an mbms session
CN101103566A (en) Method of transmitting mpeg streams over ip and corresponding device, receiving method and receiver
JP4042396B2 (en) Data communication system, data transmission apparatus, data reception apparatus and method, and computer program
JP3906678B2 (en) Data communication system, data transmission apparatus, data reception apparatus and method, and computer program
Wagner et al. Towards an RTP Profile for IPTV

Legal Events

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

Ref document number: 10829552

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10829552

Country of ref document: EP

Kind code of ref document: A1