A data synchronization method
By adjusting the timestamps and rates at the receiving and sending ends, the problem of data synchronization issues in many-to-one communication between audio and video devices was solved, achieving data time synchronization between devices and improving data processing quality.
Patent Information
- Application Number
- CN202310284781.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-22
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2043-03-22
AI Technical Summary
In many-to-one communication, the data between audio and video devices fails to synchronize, resulting in data playback at different times, which presents synchronization difficulties and pain points.
The receiving device obtains the data reception timestamp and preset synchronization timestamp, and determines the theoretical processing position based on the device's data processing speed. The processing position is then adjusted according to the deviation of the processing position to achieve data synchronization. The sending device adjusts the acquisition rate to synchronize the data by comparing the local timestamp and the communication timestamp.
It enables data time synchronization between multiple devices, improving data processing quality.
Smart Images

Figure CN116319833B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, in particular to a data synchronization method. BACKGROUND
[0002] At present, with the development of the Internet and communication technology, communication modes are diversified, such as many-to-one, one-to-one, one-to-many and the like.
[0003] At present, when the audio and video voice device performs many-to-one communication, there may be a situation that the data between the opposite end devices is not synchronized, which may cause the data sent by multiple devices at the same time point to be played at different time points, and the audio and video data synchronization is a difficulty and pain point. Therefore, there is an urgent need for a data synchronization method. SUMMARY
[0004] The present application provides a data synchronization method to solve the problem that the data cannot be synchronized in the communication process in the prior art.
[0005] To achieve the above object, the technical scheme adopted by the embodiments of the present application is as follows:
[0006] In a first aspect, the embodiments of the present application provide a data synchronization method applied to a receiving end device in a communication system, and the method comprises:
[0007] receiving first data sent by a sending end and obtaining a receiving timestamp of the first data;
[0008] determining a theoretical processing position of preset data according to the receiving timestamp of the first data, a preset synchronization timestamp, and a data processing speed of the receiving end device;
[0009] determining a processing position deviation of the first data according to the theoretical processing position of the preset data and an actual processing position of the preset data;
[0010] adjusting the processing position of the first data according to the processing position deviation;
[0011] processing the first data by using the adjusted processing position of the first data.
[0012] Optionally, before receiving the first data sent by the receiving sending end and obtaining the receiving timestamp of the first data, the method further comprises:
[0013] receiving the preset data and obtaining a receiving timestamp of the preset data;
[0014] determining the receiving timestamp of the preset data as the preset synchronization timestamp.
[0015] Optionally, the determining the theoretical processing position of the preset data according to the receiving timestamp of the first data, the preset synchronization timestamp, and the data processing speed of the receiving end device comprises:
[0016] determining a time difference according to the receiving timestamp of the first data and the preset synchronization timestamp;
[0017] determining the theoretical processing position of the preset data according to the time difference and the data processing speed of the receiving end device.
[0018] Optionally, the adjusting the processing position of the first data according to the processing position deviation comprises:
[0019] if the processing position deviation is greater than 0, deleting the data packet at a preset position in front of the first data, and moving the processing position of the first data forward according to the processing position deviation; wherein the length of the preset position is equal to the length of the processing position deviation.
[0020] Optionally, the adjusting the processing position of the first data according to the processing position deviation further comprises:
[0021] if the processing position deviation is less than 0, moving the processing position of the first data backward according to the processing position deviation.
[0022] Optionally, the adjusting the processing position of the first data according to the processing position deviation further comprises:
[0023] if the processing position deviation is equal to 0, keeping the processing position of the first data unchanged.
[0024] In a second aspect, an embodiment of the present application provides a data synchronization method applied to a sending end device in a communication system, and the method comprises:
[0025] collecting second data, and obtaining a local timestamp and a communication timestamp when the second data is collected;
[0026] comparing the local timestamp and the communication timestamp;
[0027] if the local timestamp is not equal to the communication timestamp, adjusting a preset collection rate;
[0028] collecting the second data according to the adjusted collection rate;
[0029] sending the collected second data to a receiving end device.
[0030] Optionally, if the local timestamp is not equal to the communication timestamp, adjusting a preset collection rate comprises:
[0031] if the local timestamp is greater than the communication timestamp, then the preset acquisition rate is adjusted by decreasing.
[0032] Optionally, if the local timestamp is not equal to the communication timestamp, then adjusting the preset acquisition rate further comprises:
[0033] if the local timestamp is less than the communication timestamp, then the preset acquisition rate is adjusted by increasing.
[0034] Optionally, the method further comprises:
[0035] if the local timestamp is equal to the communication timestamp, then the second data is acquired at the preset acquisition rate.
[0036] Compared with the prior art, the present application has the following beneficial effects:
[0037] The present application provides a data synchronization method, by receiving the first data sent by the sending end, and obtaining the receiving timestamp of the first data; according to the receiving timestamp of the first data, the preset synchronization timestamp, and the data processing speed of the receiving end device, determining the theoretical processing position of the preset data; according to the theoretical processing position of the preset data and the actual processing position of the preset data, determining the processing position deviation of the first data; adjusting the processing position of the first data according to the processing position deviation; and processing the first data by using the adjusted processing position of the first data. Thus, taking the processing time of the preset data as a reference, the time synchronization of multiple first data is realized, the data synchronization between multiple devices is realized, and the data processing quality is improved. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0039] Figure 1 A structural schematic diagram of a communication system is provided for the embodiments of the present application;
[0040] Figure 2 A flowchart of a data synchronization method applied to a receiving end device is provided for the embodiments of the present application;
[0041] Figure 3 A flowchart of a method for determining a preset synchronization timestamp is provided for the embodiments of the present application;
[0042] Figure 4 A flowchart of a method for determining a theoretical processing position of preset data is provided for an embodiment of the present application;
[0043] Figure 5 A flowchart of a data synchronization method applied to a sending end device is provided for an embodiment of the present application;
[0044] Figure 6 A schematic diagram of a data synchronization device is provided for an embodiment of the present application;
[0045] Figure 7 A schematic diagram of another data synchronization device is provided for an embodiment of the present application;
[0046] Figure 8 A schematic diagram of a receiving end device is provided for an embodiment of the present application;
[0047] Figure 9 A schematic diagram of a sending end device is provided for an embodiment of the present application.
[0048] Figures: 100-sending end device, 200-receiving end device, 601-receiving module, 602-first determining module, 603-second determining module, 604-first adjusting module, 605-processing module, 701-acquiring module, 702-comparing module, 703-second adjusting module, 704-acquiring module, 705-sending module, 801-first processor, 802-first sender, 803-first receiver, 901-second processor, 902-second sender, 903-second receiver. DETAILED DESCRIPTION
[0049] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0050] Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without making creative efforts fall within the scope of protection of the present application.
[0051] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, thus, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0052] In addition, the terms "first", "second", etc., if used, are merely used to distinguish and describe, and should not be understood as indicating or implying relative importance.
[0053] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0054] In order to synchronize data between multiple devices and improve data processing quality, the present application provides a data synchronization method.
[0055] Before explaining a data synchronization method provided in an embodiment of the present application, the communication system to which the data synchronization method is applied is first explained. Figure 1 This is a schematic diagram of the structure of a communication system provided in an embodiment of the present application. Figure 1 As shown, the communication system includes: a sending end device 100 and a receiving end device 200, and multiple sending end devices 100 are communicatively connected to the receiving end device 200.
[0056] It should be noted that Figure 1 The structure shown represents the connection relationship when any device in the communication system acts as a receiving end. In an actual communication system, any device can act as a receiving end, any device can also act as a sending end, and all devices are connected to each other.
[0057] For example, the communication system may be an intercom communication system, a voice conference communication system, a video conference communication system, or the like.
[0058] Taking a video conferencing communication system as an example, video devices can communicate with each other. When one of the video devices acts as a data receiver, the other video devices act as data transmitters.
[0059] The following is an explanation of a data synchronization method applied to a receiving device provided in an embodiment of the present application through a specific example. Figure 2 This is a flow chart of a data synchronization method applied to a receiving device provided in an embodiment of the present application. The execution subject of this method is a receiving device in a communication system, and the receiving device can be a device with sending, receiving, and processing functions. Figure 2 As shown, the method includes:
[0060] S101: Receive first data sent by a sending end, and obtain a receiving timestamp of the first data.
[0061] The receiving timestamp of the first data is the timestamp of the communication system when the receiving end receives the first data.
[0062] S102, determining a theoretical processing position of the preset data according to the receiving timestamp of the first data, the preset synchronization timestamp, and a data processing speed of the receiving end device.
[0063] The preset synchronization timestamp is a communication system reference timestamp for clock synchronization.
[0064] The theoretical processing position of the preset data is determined according to the receiving timestamp of the first data, the preset synchronization timestamp, and the data processing speed of the receiving end device, with the preset synchronization timestamp as a reference.
[0065] Since the preset synchronization timestamp is a communication system reference timestamp, and the receiving timestamp of the first data is a timestamp of the communication system when the first data is received by the receiving end, the theoretical processing position of the preset data is a preset data processing position determined based on the clock of the communication system.
[0066] S103, determining a processing position deviation of the first data according to the theoretical processing position of the preset data and an actual processing position of the preset data.
[0067] The actual processing position of the preset data is determined based on the local clock.
[0068] The processing position deviation of the first data represents a deviation between the preset data processing position determined based on the clock of the communication system and the preset data processing position determined based on the local clock, i.e., a clock deviation between the clock of the communication system and the local clock.
[0069] For example, the actual processing position of the preset data minus the theoretical processing position of the preset data is the processing position deviation of the first data.
[0070] S104, adjusting the processing position of the first data according to the processing position deviation.
[0071] In the embodiments of the present application, the clock deviation between the clock of the communication system and the local clock is represented by the processing position deviation. Therefore, adjusting the processing position of the first data according to the processing position deviation can adjust the clock deviation between the clock of the communication system and the local clock when the first data is actually processed, with the local clock as a reference.
[0072] S105, processing the first data by using the adjusted processing position of the first data.
[0073] The processing position of the first data is adjusted according to the local clock, and is consistent with the processing position of the preset data. The first data is processed by using the adjusted processing position of the first data, and the processing time of the first data and the preset data is synchronized.
[0074] Further, a plurality of first data sent by a plurality of sending ends is received, and the data synchronization processing of the above steps is performed on the plurality of first data, and the processing time of the plurality of first data and the preset data is synchronized. That is, the processing time of the plurality of first data is synchronized with reference to the processing time of the preset data, so that the data of the plurality of devices is synchronized, and the data processing quality is improved.
[0075] To sum up, in the embodiment, the first data sent by the sending end is received, and the receiving timestamp of the first data is obtained; the theoretical processing position of the preset data is determined according to the receiving timestamp of the first data, the preset synchronization timestamp, and the data processing speed of the receiving end device; the processing position deviation of the first data is determined according to the theoretical processing position of the preset data and the actual processing position of the preset data; the processing position of the first data is adjusted according to the processing position deviation; and the first data is processed by using the adjusted processing position of the first data. Thus, the processing time of the plurality of first data is synchronized with reference to the processing time of the preset data, so that the data of the plurality of devices is synchronized, and the data processing quality is improved.
[0076] In the above Figure 2 Based on the corresponding embodiment, the embodiment of the present application further provides a method for determining a preset synchronization timestamp. Figure 3 A flowchart of a method for determining a preset synchronization timestamp provided by the embodiment of the present application is shown in FIG. 2. As shown in FIG. 2, before the first data sent by the sending end is received and the receiving timestamp of the first data is obtained in S101, the method further includes: Figure 3
[0077] S201, receiving the preset data and obtaining the receiving timestamp of the preset data.
[0078] For example, the preset data is data sent by a preset sending end device. The preset sending end device is a sending end device corresponding to the first packet data received by the receiving end device after the receiving end device is powered on. That is, the sending end device of the first sending data is taken as a reference for data synchronization.
[0079] S202, determining the receiving timestamp of the preset data as the preset synchronization timestamp.
[0080] For example, the receiving timestamp of the first packet data of the preset data is determined as the preset synchronization timestamp. That is, the receiving timestamp of the first packet data received by the plurality of sending end devices is taken as a reference for the time synchronization of the plurality of first data.
[0081] In summary, in the embodiment, the preset data is received, and a receiving timestamp of the preset data is acquired; the receiving timestamp of the preset data is determined as the preset synchronization timestamp. Thus, the preset synchronization timestamp is accurately determined.
[0082] In the above Figure 2 Based on the corresponding embodiment, the embodiment of the application further provides a method for determining a theoretical processing position of preset data. Figure 4 A flowchart of a method for determining a theoretical processing position of preset data provided by the embodiment of the application is shown in FIG. 2. As shown in FIG. 2, in S102, the theoretical processing position of the preset data is determined according to the receiving timestamp of the first data, the preset synchronization timestamp, and the data processing speed of the receiving end device, which includes: Figure 4
[0083] S301, determining a time difference according to the receiving timestamp of the first data and the preset synchronization timestamp.
[0084] The receiving timestamp of the first data and the preset synchronization timestamp are both timestamps of a communication system, and thus the determined time difference is a time difference of the communication system. The time difference represents a time from receiving the first packet of preset data to the current time with reference to a clock of the communication system.
[0085] S302, determining the theoretical processing position of the preset data according to the time difference and the data processing speed of the receiving end device.
[0086] The theoretical processing position of the preset data can be determined by multiplying the time difference and the data processing speed of the receiving end device. Since the time difference represents a time from receiving the first packet of preset data to the current time with reference to the clock of the communication system, the theoretical processing position represents a data processing position relative to the first packet of preset data with reference to the clock of the communication system.
[0087] For example, if the data is audio data, the time difference is a preset data playing time length with reference to the clock of the communication system, the data processing speed is an audio data playing speed, and the theoretical processing position of the preset data is a theoretical playing position of the audio data.
[0088] In summary, in the embodiment, the time difference is determined according to the receiving timestamp of the first data and the preset synchronization timestamp; and the theoretical processing position of the preset data is determined according to the time difference and the data processing speed of the receiving end device. Thus, the theoretical processing position of the preset data is accurately determined.
[0089] In the above Figure 2 Based on the corresponding embodiment, in S104 of the embodiment of the application, adjusting the processing position of the first data according to the processing position deviation includes:
[0090] If the processing position deviation is greater than 0, a data packet of a preset position in front of the first data is deleted, and the processing position of the first data is moved forward according to the processing position deviation; wherein the length of the preset position is equal to the length of the processing position deviation.
[0091] For example, taking the data as audio data, if the processing position deviation is greater than 0, it means that the preset audio data is played faster than the communication clock, and the audio data packet corresponding to the theoretical playing position has been played. In order to make the first audio data and the preset audio data play synchronously (i.e., make the first audio data play synchronously with reference to the local clock), the data of the first audio data that has passed the playing opportunity is deleted with reference to the preset audio data, and the remaining first audio data is kept consistent with the preset audio data for playing, thereby realizing the synchronization of the first audio data and the preset audio data.
[0092] Specifically, a data packet of a preset position in front of the first data is deleted, wherein the length of the preset position is equal to the length of the processing position deviation, that is, the data packet that has passed the playing opportunity is deleted. And the playing position of the first data is moved forward, and the moving length is equal to the processing position deviation.
[0093] For example, the actual playing position of the preset audio data is 22 seconds, and the theoretical playing position obtained by receiving the first audio data is 20 seconds, so the first 2 seconds of the first audio data are deleted, and the playing starts from the 3rd second of the first audio data.
[0094] In summary, in the embodiment, if the processing position deviation is greater than 0, a data packet of a preset position in front of the first data is deleted, and the processing position of the first data is moved forward according to the processing position deviation; wherein the length of the preset position is equal to the length of the processing position deviation. Thus, in the case that the processing position deviation is greater than 0, the data synchronization of the first data and the preset data is realized.
[0095] In the above Figure 2 Based on the corresponding embodiment, the embodiment of the present application further includes, in the step S104 of adjusting the processing position of the first data according to the processing position deviation, the following steps:
[0096] If the processing position deviation is less than 0, the processing position of the first data is moved backward according to the processing position deviation.
[0097] For example, taking the audio data as an example, if the processing position deviation is less than 0, it indicates that the preset audio data is played slower than the communication clock, and the audio data packet corresponding to the theoretical playing position has not been played. Therefore, taking the preset audio data as a reference, the first data can be delayed and played. The first audio data is consistent with the preset audio data and is played, thereby realizing the synchronization of the first audio data and the preset audio data.
[0098] Specifically, the playing position of the first data is moved backward, and the moving length is equal to the processing position deviation.
[0099] For example, the actual playing position of the preset audio data is 18 seconds, and the theoretical playing position obtained by receiving the first audio data is 20 seconds. The first audio data is not played first, and is played after being delayed for 2 seconds, so that when the first audio data is played, the actual playing position of the preset audio data is 20 seconds.
[0100] In summary, in the embodiment, if the processing position deviation is less than 0, the processing position of the first data is moved backward according to the processing position deviation. Thus, in the case that the processing position deviation is less than 0, the data synchronization of the first data and the preset data is realized.
[0101] In the above Figure 2 Based on the corresponding embodiment, the embodiment of the present application further includes the following steps in the step S104 of adjusting the processing position of the first data according to the processing position deviation.
[0102] If the processing position deviation is equal to 0, the processing position of the first data is kept unchanged.
[0103] If the processing position deviation is equal to 0, it indicates that the first audio data and the preset audio data have been synchronized, and the processing position of the first data is unchanged.
[0104] The data synchronization method applied to the sending end device provided by the embodiment of the present application is explained and described by a specific example as follows. Figure 5 The flowchart of the data synchronization method applied to the sending end device provided by the embodiment of the present application is shown in the figure. The execution subject of the method is a sending end device in a communication system, which can be a device with sending, receiving and processing functions. As shown in the figure, the method includes the following steps. Figure 5
[0105] S401, collecting second data, obtaining local time stamp and communication time stamp when the second data is collected.
[0106] When the receiving end device collects the second data, the local time stamp and the communication time stamp when each packet of the second data is collected are obtained in real time.
[0107] The local timestamp is a timestamp of the local clock when the second data is collected, and the communication timestamp is a timestamp of the communication clock when the second data is collected.
[0108] S402, comparing the local timestamp with the communication timestamp.
[0109] S403, adjusting the preset collection rate if the local timestamp is not equal to the communication timestamp.
[0110] If the local timestamp is not equal to the communication timestamp, it indicates that the local clock is not synchronized with the communication clock. In order to synchronize the multiple sending end devices as much as possible, the preset collection rate is adjusted based on the communication timestamp.
[0111] The preset collection rate is a current collection rate of the sending end device.
[0112] S404, collecting the second data according to the adjusted collection rate.
[0113] According to the adjusted collection rate, the second data collected by the sending end device can be synchronized with the communication clock.
[0114] S405, sending the collected second data to the receiving end device.
[0115] In the embodiment, the second data is collected, the local timestamp and the communication timestamp when the second data is collected are obtained, the local timestamp and the communication timestamp are compared, the preset collection rate is adjusted if the local timestamp is not equal to the communication timestamp, the second data is collected according to the adjusted collection rate, and the collected second data is sent to the receiving end device. Thus, by comparing the local timestamp with the communication timestamp and adjusting the preset collection rate, the data time synchronization based on the communication clock is realized.
[0116] In the above Figure 5 Based on the corresponding embodiment, in the embodiment, if the local timestamp is not equal to the communication timestamp, the preset collection rate is adjusted in S503, and the adjusting includes:
[0117] If the local timestamp is greater than the communication timestamp, the preset collection rate is adjusted by decreasing.
[0118] If the local timestamp is greater than the communication timestamp, it indicates that the current data collection is too fast, and the preset collection rate needs to be adjusted by decreasing to synchronize the data collection with the communication clock.
[0119] For example, when the preset collection rate is adjusted by decreasing, one rate adjustment can be set, or multiple rate adjustments can be set.
[0120] In summary, in the embodiment, if the local timestamp is less than the communication timestamp, the preset acquisition rate is adjusted in a decreasing manner. Thus, the acquisition data is kept synchronized with the communication clock.
[0121] In the above Figure 5 Based on the corresponding embodiment, in the embodiment, if the local timestamp is not equal to the communication timestamp, the preset acquisition rate is adjusted, and the method further includes:
[0122] If the local timestamp is less than the communication timestamp, the preset acquisition rate is adjusted in an increasing manner.
[0123] If the local timestamp is less than the communication timestamp, it indicates that the current acquisition data is too slow, and the preset acquisition rate needs to be adjusted in an increasing manner, so that the acquisition data is kept synchronized with the communication clock.
[0124] For example, when the preset acquisition rate is adjusted in an increasing manner, one rate adjustment can be set, or multiple rate adjustments can be set.
[0125] In summary, in the embodiment, if the local timestamp is greater than the communication timestamp, the preset acquisition rate is adjusted in an increasing manner. Thus, the acquisition data is kept synchronized with the communication clock.
[0126] In the above Figure 5 Based on the corresponding embodiment, the method further includes:
[0127] If the local timestamp is equal to the communication timestamp, the second data is acquired at the preset acquisition rate.
[0128] If the local timestamp is equal to the communication timestamp, it indicates that the acquisition data is already kept synchronized with the communication clock. Therefore, the acquisition rate does not need to be adjusted, and the second data continues to be acquired at the preset acquisition rate.
[0129] Further, the acquired second data is sent to the receiving end device.
[0130] The following describes a data synchronization device, a device, and a storage medium provided by the present application, and the specific implementation process and technical effects are described above. The following will not be described again.
[0131] Figure 6 A schematic diagram of a data synchronization device provided by an embodiment of the present application is shown in FIG. 1. The device is applied to a receiving end device in a communication system, and includes: Figure 6
[0132] The receiving module 601 receives the first data sent by the sending end and acquires the receiving timestamp of the first data.
[0133] The first determining module 602 is configured to determine a theoretical processing position of the preset data according to a receiving timestamp of the first data, a preset synchronization timestamp, and a data processing speed of the receiving end device.
[0134] The second determining module 603 is configured to determine a processing position deviation of the first data according to the theoretical processing position of the preset data and an actual processing position of the preset data.
[0135] The first adjusting module 604 is configured to adjust the processing position of the first data according to the processing position deviation.
[0136] The processing module 605 is configured to process the first data by using the adjusted processing position of the first data.
[0137] Further, the receiving module 601 is further configured to receive the preset data and acquire a receiving timestamp of the preset data; and determine the receiving timestamp of the preset data as the preset synchronization timestamp.
[0138] Further, the first determining module 602 is specifically configured to determine a time difference according to the receiving timestamp of the first data and the preset synchronization timestamp; and determine the theoretical processing position of the preset data according to the time difference and the data processing speed of the receiving end device.
[0139] Further, the first adjusting module 604 is specifically configured to, if the processing position deviation is greater than 0, delete a data packet at a preset position in front of the first data, and move the processing position of the first data forward according to the processing position deviation; wherein a length of the preset position is equal to a length of the processing position deviation.
[0140] Further, the first adjusting module 604 is specifically configured to, if the processing position deviation is less than 0, move the processing position of the first data backward according to the processing position deviation.
[0141] Further, the first adjusting module 604 is specifically configured to, if the processing position deviation is equal to 0, keep the processing position of the first data unchanged.
[0142] Figure 7 Another schematic diagram of a data synchronization device provided by an embodiment of the present application is shown in FIG. 7, which is applied to a sending end device in a communication system, and the device comprises: Figure 7
[0143] The acquisition module 701 is configured to collect second data, and acquire a local timestamp and a communication timestamp when the second data is collected.
[0144] The comparison module 702 is configured to compare the local timestamp and the communication timestamp.
[0145] The second adjusting module 703 is configured to adjust the preset collection rate if the local timestamp is not equal to the communication timestamp.
[0146] The collection module 704 is configured to collect the second data according to the adjusted collection rate.
[0147] The sending module 705 is configured to send the collected second data to the receiving end device.
[0148] Further, the second adjusting module 703 is specifically configured to decrease the preset collection rate if the local timestamp is greater than the communication timestamp.
[0149] Further, the second adjusting module 703 is specifically configured to increase the preset collection rate if the local timestamp is less than the communication timestamp.
[0150] Further, the second adjusting module 703 is specifically configured to collect the second data at the preset collection rate if the local timestamp is equal to the communication timestamp.
[0151] Figure 8 A schematic diagram of a receiving end device provided by an embodiment of the present application is shown in FIG. 8. The receiving end device can be a device with processing, sending and receiving functions. As shown in FIG. 8: Figure 8
[0152] The receiving end device includes a first processor 801, a first sender 802 and a first receiver 803. The first processor 801 is in communication connection with the first sender 802 and the first receiver 803 through a bus.
[0153] The first receiver 803 is configured to receive a signal sent by another terminal device and transmit the signal to the first processor 801. The first processor 801 is configured to execute the method embodiments described above. The specific implementation manners and technical effects are similar, and thus will not be described herein again. The first sender 802 is configured to send a processing result of the first processor 801 to another terminal device.
[0154] Figure 9 A schematic diagram of a sending end device provided by an embodiment of the present application is shown in FIG. 9. The sending end device can be a device with processing, sending and receiving functions. As shown in FIG. 9: Figure 9
[0155] The sending end device includes a second processor 901, a second sender 902 and a second receiver 903. The second processor 901 is in communication connection with the second sender 902 and the second receiver 903 through a bus.
[0156] The second receiver 903 is configured to receive signals transmitted by other terminal devices and transmit the signals to the second processor 901. The second processor 901 is configured to perform the above-described method embodiments. The specific implementation manners and technical effects are similar, and will not be described here again. The second transmitter 902 is configured to transmit the processing result of the second processor 901 to other terminal devices.
[0157] Optionally, the present application also provides a program product, for example, a computer readable storage medium, comprising a program which, when executed by a processor, is configured to perform the above-described method embodiments.
[0158] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described embodiments of the apparatus are merely schematic, and the division of the units is merely logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0159] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0160] In addition, each functional unit in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function units.
[0161] The integrated unit implemented in the form of software function units can be stored in a computer readable storage medium. The software function unit stored in the storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute part of the steps of the method described in the various embodiments of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, and various media that can store program codes.
Claims
1. A method of data synchronization, the method comprising: A receiving end device applied to a communication system, the method comprising: receiving first data sent by a sending end and obtaining a receiving timestamp of the first data; determining a theoretical processing position of preset data according to the receiving timestamp of the first data, a preset synchronization timestamp, and a data processing speed of the receiving end device; wherein the theoretical processing position of the preset data is a preset data processing position determined based on a clock of the communication system; determining a processing position deviation of the first data according to the theoretical processing position of the preset data and an actual processing position of the preset data; wherein the actual processing position of the preset data is a preset data processing position determined based on a local clock; adjusting the processing position of the first data according to the processing position deviation; processing the first data by using the adjusted processing position of the first data.
2. The method of claim 1, wherein, Before the receiving first data sent by the sending end and obtaining the receiving timestamp of the first data, the method further comprises: receiving the preset data and obtaining a receiving timestamp of the preset data; determining the receiving timestamp of the preset data as the preset synchronization timestamp.
3. The method of claim 1, wherein, The determining the theoretical processing position of preset data according to the receiving timestamp of the first data, a preset synchronization timestamp, and a data processing speed of the receiving end device comprises: determining a time difference according to the receiving timestamp of the first data and the preset synchronization timestamp; determining the theoretical processing position of the preset data according to the time difference and the data processing speed of the receiving end device.
4. The method of claim 1, wherein, The adjusting the processing position of the first data according to the processing position deviation comprises: if the processing position deviation is greater than 0, deleting data packets at a preset position in front of the first data and moving the processing position of the first data forward according to the processing position deviation; wherein the length of the preset position is equal to the length of the processing position deviation.
5. The method of claim 1, wherein, The adjusting the processing position of the first data according to the processing position deviation further comprises: if the processing position deviation is less than 0, moving the processing position of the first data backward according to the processing position deviation.
6. The method of claim 1, wherein, The adjusting the processing position of the first data according to the processing position deviation further comprises: if the processing position deviation is equal to 0, keeping the processing position of the first data unchanged.
7. A data synchronization method, characterized by, A sending end device applied to a communication system, the method comprising: collecting second data, obtaining a local timestamp and a communication timestamp when the second data is collected, wherein the local timestamp is a timestamp of a local clock when the second data is collected; the communication timestamp is a timestamp of a communication clock when the second data is collected; comparing the local timestamp and the communication timestamp; if the local timestamp is not equal to the communication timestamp, adjusting a preset collection rate; collecting the second data according to the adjusted collection rate; sending the collected second data to a receiving end device.
8. The method of claim 7, wherein, If the local timestamp is not equal to the communication timestamp, adjusting a preset collection rate, comprising: if the local timestamp is greater than the communication timestamp, then decreasing the preset acquisition rate.
9. The method of claim 7, wherein, if the local timestamp is not equal to the communication timestamp, then adjusting the preset acquisition rate, further comprising: if the local timestamp is less than the communication timestamp, then increasing the preset acquisition rate.
10. The method of claim 7, wherein, The method further comprises: if the local timestamp is equal to the communication timestamp, then acquiring the second data at the preset acquisition rate.
Citation Information
Patent Citations
Audio and video synchronizing method and electronic device
CN103747316A
Audio / video synchronization method and device
CN104618786A