Audio/Video Synchronization series-a simple synchronization algorithm

Source: Internet
Author: User
In the sender:
The same timestamp (system time) is used for audio/video frames at the same time point)
Receiver:
Stores two queues. Audio and Video are used to store the audio and video that have not been played.
1. When an audio frame is received, traverse the video queue and compare the time stamp of the audio frame with the time stamp of each video frame:
1) if the audio Frame Time is before the video frame, the frame plays the audio
2) If the time stamp difference between the audio and the video is within an acceptable error, the audio/video will be played simultaneously (and the video frame will be deleted from the video Queue)
3) if the video time is earlier, play the video frame (and delete the video frame from the video Queue)
If the time of the last frame in the video queue is before this audio frame, the video queue will be empty after the frames in the entire video queue are played, put the audio into the audio queue.
2. perform similar operations when receiving video frames.

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.