Did you install an interrupt callback, and is it being called? 

You should expect your installed callback will be called every av_read_frame() 
loop.

In my version using the change from the gist, I simply check the time since the 
last callback call, and if that time duration above a threshold my callback 
returns non-zero – indicating to av_read_frame() to return with AVERROR_EXIT. 

 

If we are talking about a dropped communication, this is how one would test 
that: the time between receiving data exceeds a threshold, which is the same as 
the time between calls to the callback.  What one’s  software does in response 
to a timeout is another matter. Ffmpeg does nothing. In my code, I wait a 
user-settable duration and then do a fresh play request on that same url. 

 

*       Basically I'm trying to run an intercom style system

 

It sounds like  you may want your I/O with something like server side events or 
WebSockets, in order to persist an open connection. 

This may be of interest:

https://aquil.io/articles/a-comparison-between-websockets-server-sent-events-and-polling

 

If need be, the contents of av_read_frame() is not very large, you could write 
your own variant for server side events or WebSockets.

For that, this may be of interest:

https://titanwolf.org/Network/Articles/Article?AID=c64234bb-6547-4e1b-9abc-73e2cc56d9c1

 

There may already be support for SSE and WebSockets in ffmpeg. I’m not very 
experienced with them, and do not track them.

 

From: Libav-user <[email protected]> On Behalf Of Simon Brown
Sent: Friday, November 12, 2021 7:33 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice 
and libavfilter. <[email protected]>
Subject: Re: [Libav-user] AVIOInterruptCB and how to use it

 

On Thu, 11 Nov 2021 at 22:06, <[email protected] 
<mailto:[email protected]> > wrote:

You may need a modified version of av_read_frame(). See this:

 

https://gist.github.com/bsenftner/ba3d493fa36b0b201ffd995e8c2c60a2

 

That’s for an earlier version of the libs, but you can see at line 31, the 
modification is simply providing a hook for the interrupt callback.

 

-Blake

 

Thanks, that was really useful.  And I notice that my version of the code 
doesn't have those lines in, so I added them in.

 

And I get the same result.  I've rebuilt ffmpeg and re-installed the libraries 
following that change, and so I thought I'd also try seeing what happened if I 
just ran it using ffmpeg commandline.

 

The result was almost identical, but I put loglevel debug on to see what it was 
doing in av_read_frame when it hung, and I get NOTHING.  So I'm back at square 
one.

 

Basically I'm trying to run an intercom style system, where data is sent when 
the push to talk button is on, and then the stream is stopped when it gets 
released.  But when you press to talk again the whole thing is stalled and 
won't restart.  I'm using the Opus codec.

 

Cheers,

Simon 

_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to