<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:560334502;
        mso-list-type:hybrid;
        mso-list-template-ids:1224498822 -886002500 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Did you install an interrupt callback, and is it being called? <o:p></o:p></p><p class=MsoNormal>You should expect your installed callback will be called every av_read_frame() loop.<o:p></o:p></p><p class=MsoNormal>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. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><ul style='margin-top:0in' type=disc><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Basically I'm trying to run an intercom style system<o:p></o:p></li></ul><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoNormal>It sounds like  you may want your I/O with something like server side events or WebSockets, in order to persist an open connection. <o:p></o:p></p><p class=MsoNormal>This may be of interest:<o:p></o:p></p><p class=MsoNormal><a href="https://aquil.io/articles/a-comparison-between-websockets-server-sent-events-and-polling">https://aquil.io/articles/a-comparison-between-websockets-server-sent-events-and-polling</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal>For that, this may be of interest:<o:p></o:p></p><p class=MsoNormal><a href="https://titanwolf.org/Network/Articles/Article?AID=c64234bb-6547-4e1b-9abc-73e2cc56d9c1">https://titanwolf.org/Network/Articles/Article?AID=c64234bb-6547-4e1b-9abc-73e2cc56d9c1</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>There may already be support for SSE and WebSockets in ffmpeg. I’m not very experienced with them, and do not track them.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b>From:</b> Libav-user <libav-user-bounces@ffmpeg.org> <b>On Behalf Of </b>Simon Brown<br><b>Sent:</b> Friday, November 12, 2021 7:33 AM<br><b>To:</b> This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user@ffmpeg.org><br><b>Subject:</b> Re: [Libav-user] AVIOInterruptCB and how to use it<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Thu, 11 Nov 2021 at 22:06, <<a href="mailto:bsenftner@earthlink.net">bsenftner@earthlink.net</a>> wrote:<o:p></o:p></p></div><div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>You may need a modified version of av_read_frame(). See this:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><a href="https://gist.github.com/bsenftner/ba3d493fa36b0b201ffd995e8c2c60a2" target="_blank">https://gist.github.com/bsenftner/ba3d493fa36b0b201ffd995e8c2c60a2</a><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-Blake<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p></div></div></blockquote><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Cheers,<o:p></o:p></p></div><div><p class=MsoNormal>Simon <o:p></o:p></p></div></div></div></div></body></html>