[FFmpeg-devel] How to pass ref_frame_count to vo_vdpau during config()

Stephen Warren swarren
Thu Dec 4 23:35:50 CET 2008


Hi.

I have a question regarding initialization of vo_vdpau in MPlayer, and how this interacts with ffmpeg.

Right now, vo_vdpau always allocates 17 video surfaces for H.264 decode (16 reference + 1 being decoded). This is the theoretical maximum for H.264, and can end up wasting a lot of memory, because many streams only use 4 or 5 reference frames.

Now, the stream contains a field that ffmpeg parses (h->sps.ref_frame_count). vo_vdpau could use this value to allocate the correct number of video surfaces.

However, this value isn't accessible by an MPlayer vo module during its config() call. Does anyone know how to obtain the value? (This was stored as a global variable in an early version of our patches, but obviously that solution is nasty.)

I suppose alternatives could be:

1) Allocate surfaces dynamically in vo_vdpau's get_image() function. This would adjust to exact actual usage, but would defer out-of-memory errors until some potentially random point during stream playback.

2) Allocate surfaces in vo_vdpau's draw_slice() function. This has access to h->sps.ref_frame_count, because it's passed in the vdpau_render_state_t. This function could immediately allocate the full number of frames required as a one-time action. However, it still defers out-of-memory errors until a time after initialization.

Does anyone have any thoughts on this?

Thanks.

-- 
nvpublic





More information about the ffmpeg-devel mailing list