Splitter Tips

Splitter Tips

I'm writing a media streaming client based on the IPP 5.0 Media Samples. Currently, I want to play MPEG-4 and MP3 media over RTP. I've written a splitter that receives data over RTP and my program (currently just a slightly modified version of simple_player + my splitter) plays the video.

However, video playback is choppy. I have a cache which is just a UMC::LinearBuffer which is filled as frames come in from RTP. A call to GetNextVideoData() unlocks the used output data (thus allowing incoming data to be put there) and locks the not-yet-processed output data. For the first few seconds or so, the video will play fine, but then it pauses, then speeds up to catch up, then pauses, and so on. If I use UMC::SampleBuffer, playback is slow - about 1 frame per second.

I'm not sure what's causing this exactly. I've set the framerate correctly (and also tried setting it to zero). I'm setting the presentation time correctly, although I'm not sure if the MPEG-4 decoder uses my splitter-specified PTS anyway. AVI splitter, MPEG2-PS splitter, and MP4 splitter all have different ways of handling their data, so I'm not sure which one is the best example, although it seems to me that MP4 splitter should be just like using UMC::SampleBuffer for my cache, so I'm perplexed.

Any tips for properly feeding the MPEG-4 decoder (or decoders in general)?


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Scott,

could you please share some bitstream with us, it can helpin investigation of the issue?

There are also comment from our experts:
seems there is thread conflict when attempt to lock buffers. Could you consider to modify your code to avoid thread deadlocks in a way demonstarted below:


for input buffer

     do {
           ret = m_pVideoBuffer->LockInputBuffer(&in);
           if(ret == UMC_NOT_ENOUGH_BUFFER)
     } while(!m_bStop && retBuff == UMC_NOT_ENOUGH_BUFFER);

and for output buffer

     do {
           ret = m_pVideoBuffer->LockOutputBuffer(&out);
           if(ret == UMC_NOT_ENOUGH_BUFFER)
     } while(!m_bStop && retBuff == UMC_NOT_ENOUGH_DATA);

We also will be glad to get your feedback about UMC media sample.


Thanks for the suggestion; I was doing that on the output buffer but not the input one. However, my situation remains unchanged.

I've attached a bitstream received over RTP. Each buffer was saved to disk after it was put in the cache.

Note: the file starts with an MPEG4 Visual Object Sequence header (0x000001b0) which is not recognized by the MPEG2 Splitter's file detector. Adding a check for this in UMC::MPEG2Splitter::DetectSystem which returns MPEG4_PURE_VIDEO_STREAM allows the file to play fine (although a bit fast) in simple_player:

if (0x000001b0 == ((code1 << 24) | (code2 >> 8))) return MPEG4_PURE_VIDEO_STREAM;

There may be a better way to do this, but this works.


Leave a Comment

Please sign in to add a comment. Not a member? Join today