Synchronize and PushSource filter
- From: "Hugo" <hchartier@xxxxxxxxx>
- Date: 22 Nov 2006 12:48:53 -0800
Hi,
I have a directshow client/server application using a custom video
codec (not a standard directshow filter). The server part capture
video and audio data from differents capture sources and I extract
frame from the graph using the SampleGrabber filter and compress video
frame using the custom made codec. So the graph look lilke this :
** Video Stream
[Camera (YUV I420)] --> [SampleGrabber] --> [Null Renderer]
** Audio Stream
[AudioInput] --> [AudioCodec(GSM 6.10)] --> [SampleGrabber] --> [Null
Renderer]
For each data stream there's a different graph. The samples aren't
rendered server side, they are either saved to disk or sent over the
network.
Now for the hard part. I have to playback the samples on a seperate
client application, to do that I wrote a DirectShow PushSource filter,
that play sample queued on a list. Each samples are stored with a 64
bits timestamp
For playback I have a graph per view, that means there can be many
video/audio streams per view. The graph looks like this :
** Video Streams
[Custom MemorySourceFilter] --> [AVI Decompressor] --> [ColorSpace
Converter] --> [VMR9]
[Custom MemorySourceFilter] --> [AVI Decompressor] --> [ColorSpace
Converter] -->
** Audio Streams
[Custom MemorySourceFilter] --> [ACM Wrapper(Back to PCM)] --> [Default
Directsound Device]
[Custom MemorySourceFilter] --> [ACM Wrapper(Back to PCM)] --> [Default
Directsound Device]
[Custom MemorySourceFilter] --> [ACM Wrapper(Back to PCM)] --> [Default
Directsound Device]
For the video samples they are decompressed back to YUV I420 format
before going into the MemorySourceFilter.
This can be difficult synchronizing all this, but for now let's just
say I have one video stream and one audio stream. I need to
synchronize both of them, but the problem is whenever there's some
delay in either in the data transmission, I have to wait for some time
until I received the requested sample. For now I wait in the derived
DoProcessingLoop(), but doing so cause the whole playback graph to
pause for some time. As I understand this, when I call the
IMediaSample::SetTime method, directshow expect that next sample will
be availlable at the endtime, and won't let go until I give a
IMediaSample to play with.
Am I doing something wrong here? Does a IAsyncRead will be better for
my need? I get chunky video/audio playback right now because I have to
actually wait for the sample to be transmitted. Do I need to buffer
some data? I waiting to have at least 2 samples in the buffer before
actually stop waiting and start sending the sample in the graph
(CPushSource::Deliver). Is there a way to tell directshow that there's
no sample available at this time? Do I need to play audio and video in
a separate graph?
If you know anything about this, let me know.
Thank you.
.
- Prev by Date: Re: VOIP Softphone
- Next by Date: Re: mmioOpen
- Previous by thread: VOIP Softphone
- Next by thread: Regarding APIs to apply gain for the recording signal
- Index(es):
Relevant Pages
|