Movatterモバイル変換


[0]ホーム

URL:


CN105516777A - Synchronizing method and device between media streams - Google Patents

Synchronizing method and device between media streams
Download PDF

Info

Publication number
CN105516777A
CN105516777ACN201510932581.7ACN201510932581ACN105516777ACN 105516777 ACN105516777 ACN 105516777ACN 201510932581 ACN201510932581 ACN 201510932581ACN 105516777 ACN105516777 ACN 105516777A
Authority
CN
China
Prior art keywords
clock
time
system clock
value
equipment
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201510932581.7A
Other languages
Chinese (zh)
Other versions
CN105516777B (en
Inventor
谭春宏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp LtdfiledCriticalGuangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201510932581.7ApriorityCriticalpatent/CN105516777B/en
Publication of CN105516777ApublicationCriticalpatent/CN105516777A/en
Application grantedgrantedCritical
Publication of CN105516777BpublicationCriticalpatent/CN105516777B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种媒体流间同步的方法和装置,方法包括:在所述多台多媒体设备进行系统时钟同步后,所述多台多媒体设备根据同步后的系统时钟同步启动各自的自有时钟;所述多台多媒体设备根据所述自有时钟进行媒体流间的同步。本发明技术方案提高了媒体流间同步的可靠性,提升了智能多媒体系统的用户体验。

The invention discloses a method and device for synchronizing media streams. The method includes: after the system clocks of the multiple multimedia devices are synchronized, the multiple multimedia devices start their own clocks synchronously according to the synchronized system clocks. ; The multiple multimedia devices synchronize media streams according to their own clocks. The technical scheme of the invention improves the reliability of the synchronization between media streams, and improves the user experience of the intelligent multimedia system.

Description

Translated fromChinese
一种媒体流间同步的方法和装置Method and device for synchronizing media streams

技术领域technical field

本发明涉及多媒体技术领域,具体涉及一种媒体流间同步的方法和装置。The invention relates to the field of multimedia technology, in particular to a method and device for synchronizing media streams.

背景技术Background technique

智能多媒体系统作为智能家居的一种,往往由多台智能多媒体设备组成,这些智能多媒体设备可以通过网络同步被控制执行某项操作,比如同步播放某一歌曲,将每一个设备的媒体数据传输看做一条媒体流,那么多个设备之间的同步播放就可以理解为流间同步。As a kind of smart home, the smart multimedia system is often composed of multiple smart multimedia devices. These smart multimedia devices can be controlled to perform certain operations through the network synchronization, such as synchronously playing a certain song, and transmitting the media data of each device to watch. Make a media stream, then the synchronous playback between multiple devices can be understood as inter-stream synchronization.

现有技术方案均使用系统时钟作为流间同步的基础,通过对智能多媒体系统中所有设备进行系统时钟同步,而后基于系统时钟取得发送端发送媒体数据的发送时间,根据网络延迟估算出接收端播放该媒体数据的参考播放时间,接收端通过比对播放参考时间与本机系统时钟的时间来实现流间的同步播放。The existing technical schemes all use the system clock as the basis for inter-stream synchronization. By synchronizing the system clock of all devices in the intelligent multimedia system, and then obtaining the sending time of the media data sent by the sending end based on the system clock, and estimating the playback time of the receiving end according to the network delay. The reference playback time of the media data, the receiving end realizes synchronous playback between streams by comparing the playback reference time with the time of the local system clock.

然而,往往系统时钟并不只用于进行播放,比如闹钟等功能就需要用到系统时钟,这就需要在某些情况下多媒体系统中的设备向局域网外部进行时钟同步,而现有基于系统时钟的流间同步方案并不允许时钟的改变,因为时钟的改变会影响到发送端估算的参考播放时间在接收端的使用,会造成多媒体设备之间无法同步。However, often the system clock is not only used for playing, such as the alarm clock and other functions need to use the system clock, which requires the equipment in the multimedia system to synchronize the clock to the outside of the LAN in some cases, while the existing system clock-based The inter-stream synchronization scheme does not allow clock changes, because clock changes will affect the use of the reference playback time estimated by the sending end at the receiving end, which will cause synchronization between multimedia devices.

发明内容Contents of the invention

本发明实施例提供一种媒体流间同步的方法和装置,以便提高媒体流间同步的可靠性。Embodiments of the present invention provide a method and device for synchronizing media streams, so as to improve the reliability of synchronizing media streams.

为解决上述技术问题及达到上述有益效果,本发明提供一种媒体流间同步的方法,用于包括多台多媒体设备的多媒体系统,所述方法包括:在所述多台多媒体设备进行系统时钟同步后,所述多台多媒体设备根据同步后的系统时钟同步启动各自的自有时钟;所述多台多媒体设备根据所述自有时钟进行媒体流间的同步。In order to solve the above-mentioned technical problems and achieve the above-mentioned beneficial effects, the present invention provides a method for synchronizing media streams, which is used in a multimedia system including multiple multimedia devices. The method includes: performing system clock synchronization on the multiple multimedia devices Afterwards, the multiple multimedia devices synchronously start their own clocks according to the synchronized system clock; the multiple multimedia devices perform synchronization among media streams according to the self-owned clocks.

本发明还提供一种媒体流间同步的装置,用于包括多台多媒体设备的多媒体系统,所述装置包括:启动模块,用于在所述多台多媒体设备进行系统时钟同步后,是所述多台多媒体设备根据同步后的系统时钟同步启动各自的自有时钟;同步模块,用于使所述多台多媒体设备根据所述自有时钟进行媒体流间的同步。The present invention also provides a device for synchronizing media streams, which is used in a multimedia system including multiple multimedia devices. Multiple multimedia devices start their own clocks synchronously according to the synchronized system clock; a synchronization module is used to make the multiple multimedia devices synchronize media streams according to their own clocks.

相对现有技术,本发明采用多媒体系统的多台多媒体设根据已经同步的系统时钟,同步启动各自的自有时钟,根据所述自有时钟进行媒体流间的同步的技术方案,改变了媒体流间同步与系统时钟的强相关性,避免了流间同步被其他需要调节到系统时钟的功能所影响,即便有部分设备的系统时钟被改变,也不容易影响到媒体流间的同步,从而提高了媒体流间同步的可靠性,提升了智能多媒体系统的用户体验。Compared with the prior art, the present invention adopts a plurality of multimedia devices of the multimedia system to synchronously start their own clocks according to the synchronized system clock, and carry out the technical scheme of synchronizing between media streams according to the self-owned clocks, changing the media stream The strong correlation between inter-stream synchronization and system clock prevents inter-stream synchronization from being affected by other functions that need to be adjusted to the system clock. Even if the system clock of some devices is changed, it is not easy to affect the synchronization between media streams, thereby improving This improves the reliability of synchronization between media streams and improves the user experience of the intelligent multimedia system.

附图说明Description of drawings

为了更清楚地说明本发明实施例技术方案,下面将对实施例和现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings that are required in the description of the embodiments and prior art. Obviously, the accompanying drawings in the following description are only some implementations of the present invention For example, those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1是本发明实施例提供的媒体流间同步的方法的流程示意图;FIG. 1 is a schematic flow diagram of a method for synchronizing media streams provided by an embodiment of the present invention;

图2是本发明实施例提供的媒体流间同步的装置的结构示意图。FIG. 2 is a schematic structural diagram of an apparatus for synchronizing media streams according to an embodiment of the present invention.

具体实施方式detailed description

本发明实施例提供一种媒体流间同步的方法,以解决提高媒体流间同步的可靠性的问题。本发明实施例还提供相应的装置。An embodiment of the present invention provides a method for synchronizing media streams to solve the problem of improving the reliability of synchronizing media streams. The embodiment of the present invention also provides a corresponding device.

为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is an embodiment of a part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

下面通过具体实施例,分别进行详细的说明。In the following, specific examples will be used to describe in detail respectively.

实施例一、Embodiment one,

请参考图1,本发明实施例提供一种媒体流间同步的方法,用于包括多台多媒体设备的多媒体系统,所述多媒体设备可以通常所说的智能多媒体设备,该多媒体系统也可以称为智能多媒体系统。所述方法可包括:Please refer to FIG. 1, an embodiment of the present invention provides a method for synchronizing media streams, which is used in a multimedia system including multiple multimedia devices. The multimedia devices can be commonly referred to as intelligent multimedia devices, and the multimedia system can also be called Intelligent multimedia system. The method may include:

110、在所述多台多媒体设备进行系统时钟同步后,所述多台多媒体设备根据同步后的系统时钟同步启动各自的自有时钟。110. After the system clocks of the multiple multimedia devices are synchronized, the multiple multimedia devices synchronously start their own clocks according to the synchronized system clocks.

为了避免媒体流间同步与系统时钟的强相关导致的不可靠问题,本发明实施例中,在多台多媒体设备之间首先进行系统时钟同步,然后,基于已经同步的系统时钟,各台多媒体设备同步启动各自的自有时钟,以便后续跟进自有时钟进行媒体流间的同步。所说的自有时钟启动后的时间值增长不以所述系统时钟为参考,例如,自有时钟可以与计数器相关联,即,使用计数器的计数来实现自有时钟随时间的均速增长。这里的计数器可以为软件计数器,也可以为硬件的晶体振荡器产生的计数。可以理解,本发明实施例中的自有时钟可以由软件来实现,也可以由硬件来实现。In order to avoid the unreliable problem caused by the strong correlation between the synchronization of media streams and the system clock, in the embodiment of the present invention, the system clock synchronization is first performed among multiple multimedia devices, and then, based on the synchronized system clock, each multimedia device Synchronously start their own clocks, so as to follow up the own clocks for synchronization between media streams. The increase of the time value after the own clock is started does not take the system clock as a reference, for example, the own clock may be associated with a counter, that is, the count of the counter is used to realize the average speed increase of the own clock over time. The counter here can be a software counter or a count generated by a hardware crystal oscillator. It can be understood that the own clock in this embodiment of the present invention may be implemented by software or by hardware.

120、所述多台多媒体设备根据所述自有时钟进行媒体流间的同步。120. The multiple multimedia devices synchronize media streams according to their own clocks.

与现有技术中根据系统时钟进行媒体流间同步不同的是,本发明实施例中,多台多媒体设备根据自有时钟进行媒体流间的同步。由于自有时钟的时间增长不依赖于系统时钟,而是按照关联的计数器进行增长,因此,即便某一台或某几台设备与系统外部的一些设备进行同步而改变了系统时钟,也不会影响多媒体系统内多媒体流间的同步。Different from the synchronization between media streams performed according to a system clock in the prior art, in the embodiment of the present invention, multiple multimedia devices perform synchronization among media streams according to their own clocks. Since the time increase of its own clock does not depend on the system clock, but increases according to the associated counter, even if one or several devices synchronize with some devices outside the system and change the system clock, it will not Affects synchronization between multimedia streams within a multimedia system.

通常多媒体系统内包括一台作为主导设备的多媒体设备,和多台作为非主导设备的多媒体设备。一些实施例中,上述步骤120具体可以包括:Generally, a multimedia system includes one multimedia device as a leading device, and multiple multimedia devices as non-leading devices. In some embodiments, the above step 120 may specifically include:

1201、所述主导设备获取当前系统时钟的系统时间作为消息的发送时间;1201. The master device acquires the system time of the current system clock as the sending time of the message;

1202、所述主导设备分别发送指令消息给所述多媒体系统中的其它多媒体设备,所述指令消息中包括所述发送时间和延迟值,所述延迟值表示接收到所述指令消息的多媒体设备与所述主导设备之间的时间延迟;1202. The master device sends an instruction message to other multimedia devices in the multimedia system respectively, the instruction message includes the sending time and a delay value, and the delay value indicates that the multimedia device that receives the instruction message is related to a time delay between said master devices;

1203、接收到所述指令消息的多媒体设备根据所述指令消息中的发送时间和延迟值确定自有时钟的启动时间,在所述启动时间按照预设的初始值启动自有时钟。1203. The multimedia device that has received the instruction message determines the start time of its own clock according to the sending time and delay value in the instruction message, and starts its own clock according to a preset initial value at the start time.

可见,可以通过主导设备发起自有时钟的启动操作,各台多媒体设备根据网络间的延迟值确定自己启动自有时钟的启动时间,保证各台多媒体设备同时启动自有时钟。通常,可以给启动的自有时钟赋予一个初始值,例如0。It can be seen that the start-up operation of the self-owned clock can be initiated by the leading device, and each multimedia device determines the start-up time of its own clock according to the delay value between networks, so as to ensure that each multimedia device starts its own clock at the same time. Usually, an initial value, such as 0, can be given to the self-clock that starts.

1204、所述多台多媒体设备记录各自启动自有时钟的启动时间以及启动自有时钟的初始值。1204. The plurality of multimedia devices record the starting time of starting their own clocks and the initial value of starting their own clocks.

可选的,所述多台多媒体设备可以将各自启动自有时钟的启动时间以及启动自有时钟的初始记录下来,以便于作为后续进行时钟校正等操作的依据。Optionally, the plurality of multimedia devices may record the starting time of starting their own clocks and the initial starting time of their own clocks, so as to be used as a basis for subsequent operations such as clock correction.

可见,根据自有时钟进行媒体流间的同步,就可以改变媒体流间同步与系统时钟的强相关性,避免流间同步被其他需要调节到系统时钟的功能所影响,即便有部分设备的系统时钟被改变,也不容易影响到媒体流间的同步,从而提高媒体流间同步的可靠性,提升智能多媒体系统的用户体验。It can be seen that the synchronization between media streams based on its own clock can change the strong correlation between the synchronization between media streams and the system clock, and prevent the synchronization between streams from being affected by other functions that need to be adjusted to the system clock, even if there are some devices in the system. The clock is changed, and it is not easy to affect the synchronization between the media streams, thereby improving the reliability of the synchronization between the media streams and improving the user experience of the intelligent multimedia system.

可选的,在本发明的一些实施例中,为了减少时钟偏差,进一步提高媒体流间同步的可靠性,本发明实施例方法还可以包括以下自有时钟的校正步骤:Optionally, in some embodiments of the present invention, in order to reduce clock deviation and further improve the reliability of synchronization between media streams, the method in the embodiment of the present invention may also include the following self-clock correction steps:

所述多台多媒体设备根据所述系统时钟校正各自的自有时钟在运行过程中产生的偏差。The plurality of multimedia devices correct deviations of their own clocks during operation according to the system clocks.

假设所述第一设备是所述多台多媒体设备中的任一台,本步骤等价为:第一设备根据所述系统时钟校正所述自有时钟在运行过程中产生的偏差。Assuming that the first device is any one of the multiple multimedia devices, this step is equivalent to: the first device corrects the deviation of the self-owned clock during operation according to the system clock.

只需间歇的通过系统时钟来校正自有时钟在运行过程中产生的偏差,就可以进一步的提高媒体流间同步的可靠性。The reliability of synchronization between media streams can be further improved by only intermittently using the system clock to correct the deviation of its own clock during operation.

可见,只需间歇的通过系统时钟来校正自有时钟在运行过程中产生的偏差,就可以进一步提高可靠性。It can be seen that the reliability can be further improved only by intermittently using the system clock to correct the deviation generated by the own clock during operation.

为便于更好的理解本发明实施例提供的技术方案,下面通过一个具体场景下的实施方式为例进行介绍。In order to facilitate a better understanding of the technical solutions provided by the embodiments of the present invention, an implementation manner in a specific scenario is used as an example to introduce below.

场景例一、自有时钟的启动。Scenario 1: Start of own clock.

步骤A:智能多媒体系统内的设备间进行系统时钟同步。Step A: System clock synchronization among devices in the intelligent multimedia system.

步骤B:将自有时钟与系统中的计数器相关联,即:使用计数器的计数来实现自有时钟随时间的均速增长。这里的计数器可以为软件计数器,也可以为硬件的晶体振荡器产生的计数,等等。Step B: associate the own clock with the counter in the system, that is, use the count of the counter to realize the average speed increase of the own clock over time. The counter here can be a software counter, or a count generated by a hardware crystal oscillator, and so on.

步骤C:智能多媒体系统中的主导设备获取当前系统时钟的系统时间,作为发送启动自有时钟的指令消息的发送时间,叠加网络传输延迟、系统处理延迟、时间余量等参考因素计算出延迟值,并将发送时间叠加延迟值得出执行启动自有时钟的指令消息的执行时间。Step C: The leading device in the intelligent multimedia system obtains the system time of the current system clock, and uses it as the sending time of the command message to start its own clock, and calculates the delay value by superimposing reference factors such as network transmission delay, system processing delay, and time margin , and add the sending time to the delay value to obtain the execution time of executing the instruction message that starts its own clock.

步骤C:主导设备向智能多媒体系统内的所有设备发送指令消息。指令消息中包括执行时间。但需要说明,发送给不同设备的指令消息,其包括的执行时间可能不同。Step C: The master device sends instruction messages to all devices in the intelligent multimedia system. The execution time is included in the instruction message. However, it should be noted that the execution time included in the instruction message sent to different devices may be different.

步骤D:智能多媒体设备接收到启动自有时钟的指令消息后在执行时间以约定的自有时钟的初始值(V_start)启动自有时钟。这里的初始值一般为0,当然也可以是其他约定好的值。Step D: After the smart multimedia device receives the instruction message to start its own clock, it starts its own clock at the execution time with the agreed initial value (V_start) of its own clock. The initial value here is generally 0, of course, it can also be other agreed values.

步骤E:记录启动自有时钟时系统时钟的时间(T_start),以及启动自有时钟的初始值(V_start),用于后续进行自有时钟的校正计算。Step E: Record the time (T_start) of the system clock when the self-owned clock is started, and the initial value (V_start) of the self-owned clock when it is started, for subsequent correction calculation of the self-owned clock.

场景例二、自有时钟的校正。Scenario 2: Calibration of self-owned clock.

步骤A:智能多媒体系统内的设备间进行系统时钟同步。Step A: System clock synchronization among devices in the intelligent multimedia system.

步骤B:判断上一次自有时钟的校正到本次自有时钟的校正之间系统时钟是否发生过改变,如果本次是首次自有时钟的校正,则判断启动自有时钟到首次自有时钟的校正之间系统时钟是否发生过改变,如果发生过改变,则转至步骤C,如果没有发生过改变,则转至步骤G。Step B: Determine whether the system clock has changed between the last calibration of the self-owned clock and the current calibration of the self-owned clock. If this is the first calibration of the self-owned clock, judge whether the self-owned clock is started to the first self-owned clock Check whether the system clock has been changed between the corrections, if so, go to step C, if not, go to step G.

步骤C:获取自有时钟的当前值(V_current),由自有时钟的当前值(V_current)及自有时钟的初始值(V_start)计算出自有时钟的运行值(V_diff=V_current-V_start)。Step C: Obtain the current value (V_current) of the self-owned clock, and calculate the operating value of the self-owned clock (V_diff=V_current-V_start) from the current value (V_current) of the self-owned clock and the initial value (V_start) of the self-owned clock.

步骤D:根据自有时钟的值的增长与系统时钟的时间增长的对应关系,换算出自有时钟的运行值(V_diff)所对应的系统时钟的时间增长值(T_diff)。Step D: According to the corresponding relationship between the value increase of the own clock and the time increase of the system clock, convert the time increase value (T_diff) of the system clock corresponding to the operation value (V_diff) of the own clock.

步骤E:获取已经改变过的系统时钟的当前值(T_current),计算出在已经改变过的系统时钟的时间轴上,启动自有时钟时系统时钟的时间(T_start_calculate=T_current–T_diff)。Step E: Obtain the current value (T_current) of the changed system clock, and calculate the time of the system clock when the own clock is started on the time axis of the changed system clock (T_start_calculate=T_current-T_diff).

步骤F:用在已经改变过的系统时钟的时间轴上,计算出的启动自有时钟时系统时钟的时间(T_start_calculate)替换记录的启动自有时钟时系统时钟的时间(T_start=T_start_calculate)。而后转至步骤K。Step F: Replace the recorded time of the system clock when the self-clock is started (T_start=T_start_calculate) with the calculated time of the system clock when the self-clock is started (T_start_calculate) on the time axis of the changed system clock. Then go to step K.

步骤G:获取系统时钟的当前值(T_current),读取记录的启动自有时钟时系统时钟的时间(T_start),计算出启动自有时钟到当前的系统时钟的时间增长值(T_diff=T_current–T_start)。Step G: Obtain the current value of the system clock (T_current), read the recorded time (T_start) of the system clock when the own clock is started, and calculate the time increment value from the start of the own clock to the current system clock (T_diff=T_current– T_start).

步骤H:根据自有时钟的值的增长与系统时钟的时间增长的对应关系,换算出系统时钟的时间增长值(T_diff)所对应的自有时钟的运行值(V_diff)。Step H: According to the corresponding relationship between the increase of the value of the own clock and the time increase of the system clock, convert the running value (V_diff) of the own clock corresponding to the time increase value (T_diff) of the system clock.

步骤I:读取记录的启动自有时钟的初始值(V_start),计算出当前系统时钟的时间对应的正确的自有时钟的值应该为(V_current_calculate=V_start+V_diff)。Step 1: read the recorded initial value (V_start) of starting the self-owned clock, and calculate the correct value of the self-owned clock corresponding to the time of the current system clock should be (V_current_calculate=V_start+V_diff).

步骤J:获取自有时钟的当前值(V_current),与计算出的当前系统时钟的时间对应的正确的自有时钟的值(V_current_calculate)进行比对,如果二者差值没有超过一定的阀值,则不需要校正,如果二者差值超过一定的阀值,则停止自有时钟,并以计算出的当前系统时钟的时间对应的正确的自有时钟的值(V_current_calculate)作为初始值,在当前重新启动自有时钟。而后转至步骤K。Step J: Obtain the current value of the own clock (V_current), compare it with the correct value of the own clock (V_current_calculate) corresponding to the calculated current system clock time, if the difference between the two does not exceed a certain threshold , then no correction is required. If the difference between the two exceeds a certain threshold, the own clock is stopped, and the correct value of the own clock (V_current_calculate) corresponding to the calculated current system clock time is used as the initial value. Currently restarts own clock. Then go to step K.

步骤K:等待一定的时间间隔,再次进行自有时钟校正,转至步骤A。Step K: Wait for a certain time interval, perform self-clock calibration again, and go to step A.

概括来说,上述校正步骤包括:In summary, the above correction steps include:

判断当前的校正时间段内,所述系统时钟是否发生过改变;Judging whether the system clock has changed during the current correction time period;

如果发生过改变,获取当前时间所述自有时钟的当前值;根据所述自有时钟的当前值和所述自有时钟启动时的初始值,计算所述自有时钟的运行值;根据所述自有时钟和所述系统时钟的时间增长的对应关系,以及所述自有时钟的运行值,计算所述系统时钟对应的时间增长值;获取当前时间所述系统时钟的当前值,根据所述系统时钟对应的时间增长值,计算所述系统时钟改变后的时间轴上启动所述自有时钟的变后初始值;利用所述变后初始值替换记录中的所述自有时钟启动时的初始值;If there has been a change, obtain the current value of the self-owned clock at the current time; calculate the running value of the self-owned clock according to the current value of the self-owned clock and the initial value when the self-owned clock starts; The corresponding relationship between the self-owned clock and the time growth of the system clock, and the operating value of the self-owned clock, calculate the time growth value corresponding to the system clock; obtain the current value of the system clock at the current time, according to the The time growth value corresponding to the system clock, calculate the initial value after starting the self-owned clock on the time axis after the system clock is changed; use the initial value after the change to replace the start-up time of the self-owned clock in the record initial value;

如果没有发生过改变,获取当前时间所述系统时钟的当前值,以及获取所述自有时钟的启动时间;计算所述系统时钟从所述启动时间到当前时间的时间增长值;根据所述自有时钟和所述系统时钟的时间增长的对应关系,以及所述时间增长值,计算所述自有时钟的理论运行值;根据所述自有时钟启动时的初始值和所述理论运行值,计算所述自有时钟在当前时间的理论值;根据所述理论值对所述自有时钟的当前值进行校正;If no change has occurred, obtain the current value of the system clock at the current time, and obtain the startup time of the self-owned clock; calculate the time growth value of the system clock from the startup time to the current time; There is a corresponding relationship between the time growth of the clock and the system clock, and the time growth value, and the theoretical operating value of the own clock is calculated; according to the initial value of the self clock when it is started and the theoretical operating value, calculating the theoretical value of the self-owned clock at the current time; correcting the current value of the self-owned clock according to the theoretical value;

其中,所述根据所述理论值对所述自有时钟的当前值进行校正可包括:计算所述理论值与所述自有时钟的当前值的差值;在所述差值大于设定阈值时,停止所述自有时钟,以所述理论值作为初始值在当前时间重启自有时钟。Wherein, the correcting the current value of the self-owned clock according to the theoretical value may include: calculating the difference between the theoretical value and the current value of the self-owned clock; when the difference is greater than a set threshold , stop the self-owned clock, and restart the self-owned clock at the current time with the theoretical value as the initial value.

由上可见,本发明实施例技术方案中,由于所提供的用于媒体流间同步的自有时钟的时间值的增长不再以系统时钟为参考,而是以软件计数或晶振计数等作为参考。这样则改变了媒体流间同步与系统时钟的强相关性,避免了流间同步被其他需要调节到系统时钟的功能所影响,从而提高了媒体流间同步的可靠性,也提升了智能多媒体系统的用户体验。可选的,只需间歇的通过系统时钟来校正自有时钟在运行过程中产生的偏差,就可以进一步提高可靠性。It can be seen from the above that in the technical solution of the embodiment of the present invention, since the increase of the time value of the self-owned clock used for synchronization between media streams is no longer referenced by the system clock, but by software counting or crystal oscillator counting, etc. . In this way, the strong correlation between the synchronization between media streams and the system clock is changed, and the synchronization between streams is prevented from being affected by other functions that need to be adjusted to the system clock, thereby improving the reliability of synchronization between media streams and improving the intelligent multimedia system. user experience. Optionally, the reliability can be further improved by only intermittently using the system clock to correct the deviation of the own clock during operation.

为了更好的实施本发明实施例的上述方案,下面还提供用于配合实施上述方案的相关装置。In order to better implement the above solutions of the embodiments of the present invention, related devices for coordinating the implementation of the above solutions are also provided below.

实施例二、Embodiment two,

请参考图2,本发明实施例提供一种媒体流间同步的装置200,用于包括多台多媒体设备的多媒体系统,所述装置200可包括:Please refer to FIG. 2 , an embodiment of the present invention provides an apparatus 200 for synchronizing media streams, which is used in a multimedia system including multiple multimedia devices. The apparatus 200 may include:

启动模块201,用于在所述多台多媒体设备进行系统时钟同步后,是所述多台多媒体设备根据同步后的系统时钟同步启动各自的自有时钟,所述自有时钟启动后的时间值增长不以所述系统时钟为参考;The starting module 201 is configured to start the respective own clocks of the multiple multimedia devices synchronously according to the synchronized system clocks after the system clocks of the multiple multimedia devices are synchronized, and the time value of the self-owned clocks after starting Growth is not referenced to said system clock;

同步模块202,用于使所述多台多媒体设备根据所述自有时钟进行媒体流间的同步。The synchronization module 202 is configured to enable the multiple multimedia devices to synchronize media streams according to their own clocks.

其中,所述自有时钟可以与计数器相关联;即,使用计数器的计数来实现自有时钟随时间的均速增长。Wherein, the self-owned clock may be associated with a counter; that is, the count of the counter is used to realize the average speed increase of the self-owned clock over time.

在本发明一些实施例中,所述多台多媒体设备包括主导设备,所述启动模块201包括:获取单元,用于使所述主导设备获取当前系统时钟的系统时间作为消息发送时间;发送单元,用于使所述主导设备分别发送指令消息给所述多媒体系统中的其它多媒体设备,所述指令消息中包括所述发送时间和延迟值,所述延迟值表示接收到所述指令消息的多媒体设备与所述主导设备之间的时间延迟;接收单元,用于使接收到所述指令消息的多媒体设备根据所述指令消息中的发送时间和延迟值确定自有时钟的启动时间,在所述启动时间按照预设的初始值启动自有时钟;还可以包括:记录单元,用于使所述多台多媒体设备记录各自启动自有时钟的启动时间以及启动自有时钟的初始值。In some embodiments of the present invention, the multiple multimedia devices include a master device, and the startup module 201 includes: an acquisition unit, configured to enable the master device to acquire the system time of the current system clock as the message sending time; a sending unit, It is used to make the master device send instruction messages to other multimedia devices in the multimedia system, the instruction messages include the sending time and delay value, and the delay value indicates that the multimedia device that received the instruction message Time delay with the master device; a receiving unit, configured to enable the multimedia device that receives the instruction message to determine the start time of its own clock according to the sending time and delay value in the instruction message, and when the start The time starts its own clock according to a preset initial value; it may also include: a recording unit, configured to enable the plurality of multimedia devices to record the start time of each starting their own clock and the initial value of starting their own clock.

在本发明一些实施例中,装置200还包括:In some embodiments of the present invention, the device 200 also includes:

校正模块203,用于使第一设备根据所述系统时钟校正所述自有时钟在运行过程中产生的偏差,所述第一设备是所述多台多媒体设备中的任一台。The correction module 203 is configured to enable the first device to correct the deviation of the own clock generated during operation according to the system clock, the first device being any one of the multiple multimedia devices.

在本发明一些实施例中,所述校正模块203可包括:判断单元,用于判断当前的校正时间段内,所述系统时钟是否发生过改变;获取单元,用于如果所述判断单元判断发生过改变,获取当前时间所述自有时钟的当前值;第一计算单元,用于根据所述自有时钟的当前值和所述自有时钟启动时的初始值,计算所述自有时钟的运行值;第二计算单元,用于根据所述自有时钟和所述系统时钟的时间增长的对应关系,以及所述自有时钟的运行值,计算所述系统时钟对应的时间增长值;第三计算单元,用于获取当前时间所述系统时钟的当前值,根据所述系统时钟对应的时间增长值,计算所述系统时钟改变后的时间轴上启动所述自有时钟的变后初始值;替换单元,用于利用所述变后初始值替换记录中的所述自有时钟启动时的初始值。In some embodiments of the present invention, the correction module 203 may include: a judging unit for judging whether the system clock has changed within the current correction time period; obtain the current value of the self-owned clock at the current time; the first calculation unit is configured to calculate the current value of the self-owned clock according to the current value of the self-owned clock and the initial value when the self-owned clock starts Running value; a second calculation unit, configured to calculate the time growth value corresponding to the system clock according to the corresponding relationship between the time growth of the self-owned clock and the system clock, and the running value of the self-owned clock; Three calculation units, used to obtain the current value of the system clock at the current time, and calculate the initial value after starting the self-owned clock on the time axis after the system clock is changed according to the time growth value corresponding to the system clock ; A replacement unit, configured to use the changed initial value to replace the initial value when the own clock starts in the record.

在本发明一些实施例中,所述校正模块203可以包括:判断单元,用于判断当前的校正时间段内,所述系统时钟是否发生过改变;获取单元,用于如果所述判断单元判断没有发生过改变,获取当前时间所述系统时钟的当前值,以及获取所述自有时钟的启动时间;第一计算单元,用于计算所述系统时钟从所述启动时间到当前时间的时间增长值;第二计算单元,用于根据所述自有时钟和所述系统时钟的时间增长的对应关系,以及所述时间增长值,计算所述自有时钟的理论运行值;第三计算单元,用于根据所述自有时钟启动时的初始值和所述理论运行值,计算所述自有时钟在当前时间的理论值;校正单元,用于根据所述理论值对所述自有时钟的当前值进行校正。进一步的,所述校正单元,具体可以用于计算所述理论值与所述自有时钟的当前值的差值;在所述差值大于设定阈值时,停止所述自有时钟,以所述理论值作为初始值在当前时间重启自有时钟。In some embodiments of the present invention, the correction module 203 may include: a judging unit, configured to judge whether the system clock has been changed within the current correction time period; an acquiring unit, configured to determine if the judging unit has not has changed, obtain the current value of the system clock at the current time, and obtain the start time of the own clock; the first calculation unit is used to calculate the time growth value of the system clock from the start time to the current time ; The second calculation unit is used to calculate the theoretical operating value of the own clock according to the corresponding relationship between the time growth of the self-owned clock and the system clock, and the time growth value; the third calculation unit uses Calculate the theoretical value of the self-owned clock at the current time according to the initial value when the self-owned clock is started and the theoretical operating value; the correction unit is used to correct the current value of the self-owned clock according to the theoretical value value is corrected. Further, the correction unit can specifically be used to calculate the difference between the theoretical value and the current value of the self-owned clock; when the difference is greater than a set threshold, stop the self-owned clock, so that The above theoretical value is used as the initial value to restart the own clock at the current time.

可以理解,本发明实施例装置的各个功能模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可参照上述方法实施例中的相关描述,此处不再赘述。It can be understood that the functions of each functional module of the device in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment, and the specific implementation process can refer to the relevant description in the above method embodiment, and will not be repeated here.

由上可见,在本发明的一些可行的实施方式中,采用多媒体系统的多台多媒体设根据已经同步的系统时钟,同步启动各自的自有时钟,根据所述自有时钟进行媒体流间的同步的技术方案,其中,自有时钟启动后的时间值增长不以所述系统时钟为参考,这样,就改变了媒体流间同步与系统时钟的强相关性,避免了流间同步被其他需要调节到系统时钟的功能所影响,即便有部分设备的系统时钟被改变,也不容易影响到媒体流间的同步,从而提高了媒体流间同步的可靠性,提升了智能多媒体系统的用户体验。As can be seen from the above, in some feasible embodiments of the present invention, multiple multimedia devices using a multimedia system start their own clocks synchronously according to the synchronized system clock, and perform synchronization between media streams according to the self-owned clocks. The technical solution, wherein, the time value increase after the self-owned clock is started does not take the system clock as a reference, so that the strong correlation between the synchronization between media streams and the system clock is changed, and the synchronization between streams is prevented from being adjusted by other needs Affected by the function of the system clock, even if the system clock of some devices is changed, it will not easily affect the synchronization between media streams, thereby improving the reliability of synchronization between media streams and improving the user experience of the intelligent multimedia system.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详细描述的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述动作顺序的限制,因为依据本发明,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because Certain steps may be performed in other orders or simultaneously in accordance with the present invention. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can include: ROM, RAM, disk or CD, etc.

以上对本发明实施例所提供的一种媒体流间同步的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The method and device for synchronizing between media streams provided by the embodiment of the present invention are described above in detail. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The description of the above embodiment is only for helping Understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification is not It should be understood as a limitation of the present invention.

Claims (10)

CN201510932581.7A2015-12-142015-12-14Synchronous method and apparatus between a kind of Media StreamExpired - Fee RelatedCN105516777B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201510932581.7ACN105516777B (en)2015-12-142015-12-14Synchronous method and apparatus between a kind of Media Stream

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201510932581.7ACN105516777B (en)2015-12-142015-12-14Synchronous method and apparatus between a kind of Media Stream

Publications (2)

Publication NumberPublication Date
CN105516777Atrue CN105516777A (en)2016-04-20
CN105516777B CN105516777B (en)2017-10-17

Family

ID=55724364

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201510932581.7AExpired - Fee RelatedCN105516777B (en)2015-12-142015-12-14Synchronous method and apparatus between a kind of Media Stream

Country Status (1)

CountryLink
CN (1)CN105516777B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108366283A (en)*2018-02-122018-08-03苏州佳世达电通有限公司The media sync playback method of more equipment rooms
CN114499732A (en)*2022-02-092022-05-13中央广播电视总台Clock calibration method and device, computer equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101410773A (en)*2003-07-282009-04-15索诺斯公司System and method for synchronizing operations among multiple independently clocked digital data processing devices
EP2150062A1 (en)*2008-07-282010-02-03Harris CorporationImproved method, system and apparatus for synchronizing signals
US20110276648A1 (en)*2010-05-072011-11-10Microsoft CorporationClock synchronization for shared media playback
CN103338204A (en)*2013-07-052013-10-02曾德钧Audio synchronization output method and system
CN104581189A (en)*2014-12-292015-04-29上海智物信息技术有限公司Multi-screen controlling method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101410773A (en)*2003-07-282009-04-15索诺斯公司System and method for synchronizing operations among multiple independently clocked digital data processing devices
EP2150062A1 (en)*2008-07-282010-02-03Harris CorporationImproved method, system and apparatus for synchronizing signals
US20110276648A1 (en)*2010-05-072011-11-10Microsoft CorporationClock synchronization for shared media playback
CN103338204A (en)*2013-07-052013-10-02曾德钧Audio synchronization output method and system
CN104581189A (en)*2014-12-292015-04-29上海智物信息技术有限公司Multi-screen controlling method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108366283A (en)*2018-02-122018-08-03苏州佳世达电通有限公司The media sync playback method of more equipment rooms
CN108366283B (en)*2018-02-122021-01-05苏州佳世达电通有限公司Media synchronous playing method among multiple devices
CN114499732A (en)*2022-02-092022-05-13中央广播电视总台Clock calibration method and device, computer equipment and readable storage medium
CN114499732B (en)*2022-02-092023-11-17中央广播电视总台Clock calibration method, clock calibration device, computer equipment and readable storage medium

Also Published As

Publication numberPublication date
CN105516777B (en)2017-10-17

Similar Documents

PublicationPublication DateTitle
US10666417B1 (en)Time synchronization using timestamp exchanges
US9967084B2 (en)Synchronising devices using clock signal time difference estimation
US10594424B2 (en)Time synchronization slave apparatus capable of adjusting time synchronization period, and method of determining time synchronization period
EP2738971A1 (en)Mehtod and device for clock synchronization
EP3813319B1 (en)Message transmission method, device, network side apparatus and storage medium
CN106533399B (en)Circuit and method for modifying clock signal and device for executing time-sensitive task
CN103842918A (en)Time control device, time control method, and program
JP2019501458A (en) Data processing method and apparatus
US20250158798A1 (en)Synchronising Devices Using Clock Signal Delay Comparison
CN109379158A (en)Time synchronization method, device and equipment for newly added nodes in storage cluster
CN105516777B (en)Synchronous method and apparatus between a kind of Media Stream
CN107947888A (en)A kind of task level synchronous method based on network service
CN113424466A (en)Method and device for clock synchronization
CN102916799A (en)Method for time synchronization of network time protocol (NTP) server
US10680972B2 (en)State report control method and apparatus
CN112703705A (en)Communication device, communication system, communication method, and communication program
CN109525347B (en) Time synchronization method and device
CN102355317B (en)Processing method of phase jump and apparatus thereof
CN112272070B (en) Method, system, device and readable storage medium for accurate time synchronization of SAS expander
WO2016177240A1 (en)Frequency synchronization method and device
CN107995681B (en)Time synchronization method and device for wireless sensor network
CN114363873B (en) Bluetooth connection parameter updating method, device, electronic device and storage medium
CN105681016A (en)Time synchronization method and device
CN112152744A (en)Clock synchronization method and device, FPGA chip and optical fiber communication network
CN111193570A (en)Method, device, system, medium and electronic equipment for executing instructions

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CP01Change in the name or title of a patent holder
CP01Change in the name or title of a patent holder

Address after:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CF01Termination of patent right due to non-payment of annual fee
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20171017


[8]ページ先頭

©2009-2025 Movatter.jp