[FFmpeg-trac] #7810(undetermined:new): ffmpeg will automatically pause (Konx KW01 gen2)
FFmpeg
trac at avcodec.org
Thu Apr 25 01:09:26 EEST 2019
#7810: ffmpeg will automatically pause (Konx KW01 gen2)
-------------------------------------+-------------------------------------
Reporter: branqueira | Owner:
Type: defect | Status: new
Priority: normal | Component:
| undetermined
Version: unspecified | Resolution:
Keywords: rtsp | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by branqueira):
I found the cause of the problem, the answer is in the log file
"trace3.log"
We want to use tcp instead of udp and ffmpeg responds : "Nonmatching
transport in server reply".
This means that the server wants to use udp while the client
(rtsp_transport tcp) only uses tcp.
{{{
/* Fail if the server responded with another lower transport mode
* than what we requested. */
if (reply->transports[0].lower_transport != lower_transport) {
av_log(s, AV_LOG_ERROR, "Nonmatching transport in server
reply\n");
err = AVERROR_INVALIDDATA;
goto fail;
}
}}}
The ffmpeg client sends this SETUP request:
{{{
SETUP rtsp://5.51.X.Y:554/onvif1/track1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 4
User-Agent: Lavf58.26.101
}}}
The client requests to use tcp (RTP / AVP / TCP)
The server responds with:
{{{
Transport:
RTP/AVP;unicast;destination=82.255.9.82;source=192.168.1.100;interleaved=0-1
}}}
note the server didn't add TCP (RTP/AVP)
if we read the specification https://www.ietf.org/rfc/rfc2326.txt page 58,
we see that the default transport protocol is UDP when nothing is
specified.
this value is retrieved in the "rtsp_parse_transport" method
{{{
if (!av_strcasecmp (transport_protocol, "rtp")) {
get_word_sep(profile, sizeof(profile), "/;,", &p);
printf("********** profile : %s\n", profile);
lower_transport[0] = '\0';
/* rtp/avp/<protocol> */
if (*p == '/') {
printf("********** protocol");
get_word_sep(lower_transport, sizeof(lower_transport),
";,", &p);
}
th->transport = RTSP_TRANSPORT_RTP;
}}}
we try to recover the transport protocol but since * p is not equal to "/"
the value of lower_transport is empty.
then we define the value of the protocol but since lower_transport is
empty:
{{{
if (!av_strcasecmp(lower_transport, "TCP"))
th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
else
th->lower_transport = RTSP_LOWER_TRANSPORT_UDP;
}}}
UDP is chosen
By doing a hack to test my reasoning by modifying the code slightly:
{{{
if (!av_strcasecmp(lower_transport, "TCP"))
th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
else
th->lower_transport = RTSP_LOWER_TRANSPORT_TCP; //beurg
dirty hack, it's just for test
}}}
Now it's work
In conclusion, ffmpeg respects the specification, it is not the case of my
camera :(
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7810#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list