Audio and Video Synchronization series----A simple synchronization algorithm

Source: Internet
Author: User
On the sending side:
The same time stamp (System time) for audio/video frames at the same moment
Receiving Party:
Save two queues, Audio/video for audio and video that have not been played
1. When each audio frame is received, traverse the video queue at this time to compare the time stamp of this audio frame with the timestamp of each video frame:
1) If the audio frame time is in front of this video frame, the frame plays the audio
2) If the time stamp of the audio and video differs from an acceptable error, the audio/video is played simultaneously (and the video frame is removed from the TV queue)
3) If the video time is before, play the video frame (and delete the video frame from the TV queue)
If the last frame in the video queue is before the audio frame, and the frames in the entire video queue are played, then the video queue will be empty, then the audio queue will be placed.
2. A similar processing is done when the video frame is received by the docking.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.