[theora-dev] ogg/theora decoder skipping frames

Conrad Parker conrad at metadecks.org
Sat Nov 8 00:05:11 PST 2008


2008/11/6 salsaman <salsaman at gmail.com>:
> Hi all,
> I have been working on an ogg/theora demuxer/decoder plugin for LiVES
> (http://lives.sourceforge.net). The decoder has a very simple interface, in
> fact there are only two major functions: - a function to get details (frame
> size, fps, palette, etc) from a URL; - a function to get a given frame from
> a specified URL and copy the resulting frame into memory buffers.
>
> The code can be seen here:
>
> http://lives.cvs.sourceforge.net/viewvc/lives/lives-plugins/plugins/decoders/ogg_theora_decoder.c?view=log
>
> The function which is causing problems is get_frame(). Here the first pass
> will seek to the keyframe before the target frame, then decode until we
> reach the target frame, at which point the frame is output. The output is
> done by way of ogg_data_process() which in turn calls ogg_theora_read().
>
> So far so good. However, on the second and subsequent frames, assuming we
> are playing forwards sequentially, a shortcut is taken - at line 960:
>
> if
> (tframe>last_frame&&((tframe-last_frame<=max_frame_diff||kframe==last_kframe)))
> {
>
> here, tframe is our target frame, (static) last_frame is the last frame
> output, and max_frame_diff is the keyframe skip / 2
> If we are playing sequentially, then this shortcut will be taken - it sets
> cont(inue) to TRUE and drops back into ogg_data_process(), and processing
> should continue exactly where we left off last time. However what I see is
> this - I am using 3 test clips. On one of the clips, playbck works
> perfectly; however, on the other two clips, it looks like frames are being
> skipped - the clip plays back too fast, with distortion, and we reach EOF
> too soon.
>
> Maybe somebody can take a quick look at the code and tell me where I am
> going wrong ?

can you post links to the 3 files? it might be easier to debug if we
can reproduce the problem, or at least look at the file contents.
Also, does this happen when viewing any frame offsets in those files,
or for particular frames?

Conrad.


More information about the theora-dev mailing list