[Live-devel] newbie problem delivering frames to parser

Ross Finlayson finlayson at live.com
Fri Jul 16 09:16:01 PDT 2004


>I am a newbie using live.com, and I've been trying to adapt the
>testMPEG1or2AudioVideoStreamer program so as to acquire the video and 
>audio data from the
>output of my application instead of a stored file. To begin with, I 
>started with the video
>stream and left the audio stuff for the future.

Remember that the input to "testMPEG1or2AudioVideoStreamer" must be a MPEG 
*Program Stream*.  If your input is, instead, a Video Elementary Stream, 
then you must instead use the "testMPEG1or2VideoStreamer" test program.

>compiles ok, but, when executing the main loop, the BANK_SIZE sanity check 
>of the
>StreamParser warns me every three frames:
>
>#StreamParser# store 115200, read 38400, SUM 153600 BANK_SIZE 150000
>StreamParser::afterGettingBytes() warning: read 34800 bytes; expected no 
>more than 34800

You're using an old version of the "LIVE.COM Streaming Media" code.  Please 
upgrade to the latest version.

>I understand that this is the point when a Bank is swapped for the other, 
>so I thought
>that this warning was not a problem at all.

No, if you still get this error message after upgrading to the latest 
version of the code (which you will - see below), then you have a real 
problem: This error message indicates that the input source (in your case, 
your "RPVRFramedSource", is delivering more data than the maximum that was 
asked for.

I.e., in your "RPVRFramedSource" (as in all "FramedSource"s), you *must* 
ensure that the number of bytes delivered ("fFrameSize", which you set) 
does not exceed the maximum asked for ("fMaxSize", which you read).  (Also, 
if you wanted to deliver more than "fMaxSize", you must also set 
"fNumTruncatedBytes" accordingly.)

>void RPVRFramedSource::doGetNextFrame()
>{
>  fTo=picture->data[0];

This is wrong.  "fTo" is an address to which your data must be 
*copied*.  The variable "fTo" itself is not modified.

>  fFrameSize=size;
>  if(fFrameSize>fMaxSize)
>         fNumTruncatedBytes=fFrameSize-fMaxSize;

As noted above, "fFrameSize" must be set to a value no larger than "fMaxSize".

So, correct code would be:

         fFrameSize = size;
         if (fFrameSize > fMaxSize) {
                 fNumTruncatedBytes = fFrameSize - fMaxSize;
                 fFrameSize = fMaxSize;
         }
         memmove(fTo, data, fFrameSize);

I hope this helps.


	Ross Finlayson
	LIVE.COM
	<http://www.live.com/>



More information about the live-devel mailing list