Hi Nathan,

I've only done a bit of libav programming, but just some thoughts that
might help.

How are you doing the throttling? AFAIK there is no functionality in libav
to help throttle decoding to match presentation time, but I could easily be
wrong.

The send/receive API is conducive to using multiple "queue feeder"/producer
threads. My initial thought would be to use 2 threads:

Thread1 (decoder): calls receive_packet and send_packet. send_packet will
return EAGAIN when the decoder buffer is full (nonblocking) so you will
need to handle this, probably by pausing and waiting for a callback from
thread2 to try again once it has pulled a decoded frame from buffer.

Thread2 (presenter): call receive_frame until you get a frame. Sleep until
its presentation time and present, at which point go back to calling
receive_frame. This is the thread that will introduce throttling (by not
calling receive during its Sleep phase, letting the decoder buffer fill up)

I am not sure how big the buffer that the h264 encoder is, you might need
to create a buffer of your own if you want something larger. In which case
you might need 3 threads.

Erik

On Wed, Jan 3, 2018 at 8:38 AM, Nathan Blane <[email protected]> wrote:

> Hello,
>
> I'm trying to decode and play an h264 video that plays at 24fps. When I
> just decode and play the video myself, it just gets through the video as
> fast as possible, which makes sense, but when I try and throttle the frame
> rate myself, it only occasionally decodes and plays the frame. I'm
> wondering what I'm doing wrong. I've looked for examples on the web and I
> can't seem to find any that are doing what I'm trying to do.
>
> Thanks!
> _______________________________________________
> libav-api mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-api
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api

Reply via email to