<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi there,<div><br></div><div>Using ffmpeg to grab RTSP stream.</div><div>During one case, av_read_pause is used with intention to perform av_read_play when the trigger for play comes to control flow.</div><div><br></div><div>In RTPS terms (confirmed with wireshark and RTSP server logs). (C)lient here is ffmpeg.</div><div><br></div><div>C->S: PAUSE</div>          CSeq: 5<br>          Session: 423132DA  <div>S->C: RTSP/1.0 200 OK</div><div>          CSeq: 5<br>          Session: 423132DA    <br>C->S: RTSP/1.0 501 Not Implemented</div><div><br></div><div>AFAIK PAUSE is C->S only and client shouldn't issue anything after it. Could anyone share any advise in which direction to continue with analysis? Some more info below.</div><div><br></div><div>The flow is (in general)</div><div>avformat_open_input - opens rtsp stream<br></div><div>av_read_frame - to grab frames and put on them on queue for processing<br></div><div>and somewhere on the way - av_read_pause is issued</div><div><br></div><div>Curious observation is that the av_read_pause never returned several times to the calling thread during this exercise (maybe I'm using it wrong?)<br></div><div><br></div><div>I'm trying to debug what's happening on the way in order to determine what I'm doing wrong.</div><div><br></div><div>After browsing and chasing possible source, I found in /libavformat/rtsp.c (FFMPEG) the int ff_rtsp_read_reply(...) and following parts:<br></div><div><br></div><div>in a parsing loop:</div><div><br></div><div><div>  if (line_count == 0) {</div><div>        /* get reply code */</div><div>        get_word(buf1, sizeof(buf1), &p);</div><div>        if (!strncmp(buf1, "RTSP/", 5)) {</div><div>            get_word(buf1, sizeof(buf1), &p);</div><div>            reply->status_code = atoi(buf1);</div><div>            av_strlcpy(reply->reason, p, sizeof(reply->reason));</div><div>        } else {</div><div>            av_strlcpy(reply->reason, buf1, sizeof(reply->reason)); // method</div><div>            get_word(buf1, sizeof(buf1), &p); // object</div><div>            request = 1;</div><div>        }</div><div>    }</div></div><div><br></div><div>So it seems a "RTSP/whatever" from Server triggers 'request =1' setting, hence:</div><div><br></div>if (request) {<br>//(...)<br>    if (!strcmp(reply->reason, "OPTIONS")) {<br>        snprintf(buf, sizeof(buf), "RTSP/1.0 200 OK\r\n");<br>        if (reply->seq)<br>            av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", reply->seq);<br>        if (reply->session_id[0])<br>            av_strlcatf(buf, sizeof(buf), "Session: %s\r\n",<br>                                          reply->session_id);<br>    } else {<br>        snprintf(buf, sizeof(buf), "RTSP/1.0 501 Not Implemented\r\n");<br>    }<br>// (...)</div><div dir="ltr">    /* If method is set, this is called from ff_rtsp_send_cmd,<br>     * where a reply to exactly this request is awaited. For<br>     * callers from within packet receiving, we just want to<br>     * return to the caller and go back to receiving packets. */<br>    if (method)<br>        goto start;<br>    return 0;<br>}<div><br></div><div>So it seems in this case if S->C: OPTIONS, ffmpeg rtsp client creates 501 Not Implemented  message and in any other case - it should end-up in mutual Client-Serwer 200 OK. So in my scenario, if anything, RTSP/1.0 200 OK should be seen, yet I still do get this 501 after PAUSE.</div><div><br></div><div>Which seems harmless, yet weird anyway as after succesful PAUSE client shouldn't be issuing anything else. Still I may have missed logic blocking issuing this C->S RTSP/1.0 200 in response to S->C RTSP/1.0 200 response. </div><div><br></div><div>I am using ffmpeg source from December's release, so possibly will re-check on latest master. <br></div><div><br></div><div>Where else I could look to debug the issue properly? I am assuming it's the usage of libav that's flawed and trying narrow down the problem.</div><br class="gmail-Apple-interchange-newline"></div><div>Any tips would be much appreciated.</div><div>Michał</div><div dir="ltr"><br></div></div></div></div></div></div></div></div>