This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
drift between video and audio stream in example player #2
Labels
help wanted
Extra attention is needed
Another question after spending more time with the video player example.
When playing longer videos I notice a slight drift between the video and the audio stream over time. This becomes even more pronounced when I add some extra image processing. I think I understand what the issue is: Essentially the video frame processing and the audio playing take place on their own go routines without any synchronization between them. So I guess the video processing could fall behind, while the audio processing keeps up? I understand that the player is just a very simple example, so this behavior is probably not surprising. Nevertheless any recommendation how to synchronize audio and video better would be great.
Also, just for my better understanding, I noticed that
media.ReadPacket()
will return audio and video packets at random for all open streams. Most of the time video and audio packets will alternate perfectly although every once in a while I see 2 video packets for 1 audio packet. What is the rational here in terms of stream synchronization?The text was updated successfully, but these errors were encountered: