A question about WASAPI
5 months, 1 week ago Edited by Minh Nguyen on Sept. 20, 2017, 12:07 p.m.
I'm dealing with something in WASAPI that need some help. Basically I have to create my own video decoder that use only the source reader. I have successfully decode the video stream using h264 decoder and also 2 audio streams, one is sfx stream and the other is the language stream. The problem is I have to synchronize them. So I read some articles that says the video should sync to the audio because the response time of the human ears is way faster than the eyes, somewhere 5ms. So basically what I did is right before I want to sample a new video frame, I take the presentation time of the current video sample and the other two audio samples and compare them like this
Basically what is checks for is if the presentation time of the current audio frames is earlier than the video frame's, we don't sample for a new video frame. And this works well, the 2 audio streams seems to be synchronized perfectly with the video. So my question is, is this the correct way of doing it? I suspect that this is not how it should be done, because MFT has Media session that supports synchronized playback of the streams using a presentation clock (media session is kinda cloudy for me), but the platform I'm writing for does not support it. Maybe I have actually use the presentation clock manually and synchronize them? Sorry for the question not being relevant to the handmade hero, but I think this is the best place I can get an answer on this