Re: How to know when WriteStreamSample has written the sample to d
- From: tunah1@xxxxxxxxx
- Date: Tue, 17 Mar 2009 00:34:27 -0700 (PDT)
On 14 Mar, 14:30, Fredrik <c...@xxxxxxx> wrote:
Thank you for your answer.
The problem is not the timestamps. They are read from source file in the
correct order and written to the asf-file. Like I said the problem is that
when we are writing to a slow disk, the writer operation is slower than the
filereader.
This means that the wmwriter starts buffering and it's eating memory until
the machine is out of it. That's what I must prevent.
I was hoping that it's somehow possible to control that buffering but I have
come up empty reading the docs.
One solution could for example be if there was a possiblity to monitor the
"buffering" and stop pushing samples with writestreamsample when the buffer
is getting high.
Like I said it should be ideal to get the reader to be synhronous (I know
the packets from the source file always arrives in the correct order) but I
have not figured out how to do it. There's doesnt seem to be any callback for
when samples are written or when the output buffer is growing.
There's of course not an option that the writer starts dropping samples, the
whole idea iis that an file in our own format should be exported to an
asf-file.
Do you have any idea of how this could be done or is there really no way to
do this with the wmfsdk?
I've written capture functionality using IWMWriterAdvanced. While
doing so I had a bunch of debug logging to make sure nothing went
wrong. One thing I noticed is the following:
// Write sample
wmWriterAdvanced->WriteStreamSample( ... );
QWORD writerTime = 0;
wmWriterAdvanced->GetWriterTime(&writerTime);
If you print writerTime here, you'll probably find that it doesn't
change every time that you call WriteStreamSample.
It will change when the thread that does the actual writing updates
it, though. Atleast that's what I can gather looking at the output.
I suppose you could check the writer time if you want to block until
samples are actually written.
If it doesn't help you, perhaps take a look at the
IWMWriterAdvanced::GetStatistics . Maybe you can introduce some
waiting based on the contents of that structure.
.
- Follow-Ups:
- References:
- How to know when WriteStreamSample has written the sample to disk?
- From: Fredrik
- Re: How to know when WriteStreamSample has written the sample to disk?
- From: Alessandro Angeli
- Re: How to know when WriteStreamSample has written the sample to d
- From: Fredrik
- How to know when WriteStreamSample has written the sample to disk?
- Prev by Date: Windows Media Player Online Stores
- Next by Date: Re: How to know when WriteStreamSample has written the sample to d
- Previous by thread: Re: How to know when WriteStreamSample has written the sample to d
- Next by thread: Re: How to know when WriteStreamSample has written the sample to d
- Index(es):
Relevant Pages
|