[Libav-user] interrupt_callback issue

Selmeci Tamás tselmeci at open-st.eu
Mon Nov 25 14:44:19 CET 2013

On 11/22/2013 5:03 PM, Selmeci Tamás wrote:

> The idea is to use the interrupt callback functionality and interrupt
> av_read_frame if it would last too long.


> However, the next read operation
> will not call interrupt_cb(...) any more and returns with error. And all
> consecutive reads do fail. I can't interrupt the read operation.

Okay, inspecting the source code I've realized this is not really a bug, 
instead a feature. When a function exits with AVERROR_EXIT, it must 
terminate. So the interrupt is irreversible.

Is there any way I can interrupt blocking waits (e.g. on sockets) 
without destroying the current read context? The reason for this is that 
I have only a specified amount of time (10 ms) to perform reads on the 
stream, and if no data is available I don't want to let ffmpeg run in 
endless loops. Passing "timeout" in an AVDict is not really okay, since 
its smallest duration is 100ms (there's a poll in ff_network_wait_fd) 
which is far too long for me.

I'm inspecting retry_transfer_wrapper, tcp_read, 
ff_network_wait_fd_timeout, ffurl_read functions...

Selmeci Tamás

More information about the Libav-user mailing list