diff mbox

[FFmpeg-devel] patch for Sricam, Floureon, etc. IP cameras

Message ID CAFKHHPkuqom48=r=vih3Q_XHz0J9Xe5BSD2JBQ_v-4md=c+_jQ@mail.gmail.com
State New
Headers show

Commit Message

John Comeau Dec. 30, 2016, 10:32 p.m. UTC
these cameras return `Transport: RTP/AVP` for a SETUP request of
RTP/AVP/TCP, yet they only use TCP transport.

`make check` still passes after patch.

Comments

compn Dec. 31, 2016, 2:05 p.m. UTC | #1
On Fri, 30 Dec 2016 14:32:06 -0800
John Comeau <jc@unternet.net> wrote:

> diff --git a/TODO.txt b/TODO.txt
> new file mode 100644
> index 0000000000..1b0c64c186
> --- /dev/null
> +++ b/TODO.txt
> @@ -0,0 +1 @@
> +2016-12-06: Fix assembly for NASM. See
> http://stackoverflow.com/questions/36854583/compiling-ffmpeg-for-kali-linux-2


this change looks unrelated.

-compn
John Comeau Dec. 31, 2016, 4:18 p.m. UTC | #2
right, you can ignore that, I meant to snip it from the patch. sorry about that.

On Sat, Dec 31, 2016 at 6:05 AM, compn <tempn@mi.rr.com> wrote:
> On Fri, 30 Dec 2016 14:32:06 -0800
> John Comeau <jc@unternet.net> wrote:
>
>> diff --git a/TODO.txt b/TODO.txt
>> new file mode 100644
>> index 0000000000..1b0c64c186
>> --- /dev/null
>> +++ b/TODO.txt
>> @@ -0,0 +1 @@
>> +2016-12-06: Fix assembly for NASM. See
>> http://stackoverflow.com/questions/36854583/compiling-ffmpeg-for-kali-linux-2
>
>
> this change looks unrelated.
>
> -compn
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/TODO.txt b/TODO.txt
new file mode 100644
index 0000000000..1b0c64c186
--- /dev/null
+++ b/TODO.txt
@@ -0,0 +1 @@ 
+2016-12-06: Fix assembly for NASM. See http://stackoverflow.com/questions/36854583/compiling-ffmpeg-for-kali-linux-2
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c6292c5543..fac625a121 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1554,6 +1554,20 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
             goto fail;
         }
 
+        /* If the server responded with another lower transport mode
+         * than what we requested, complain but attempt to continue.
+         * Cheap IP cameras like Sricam SP005, for example, respond with
+         * `Transport: RTP/AVP` for a SETUP request of RTP/AVP/TCP
+         * yet is sending over TCP anyway */
+        if (reply->transports[0].lower_transport != lower_transport) {
+            av_log(s, AV_LOG_ERROR, "Nonmatching transport in server reply\n");
+            av_log(s, AV_LOG_DEBUG, "We asked for %d and got %d\n",
+                   lower_transport,
+                   reply->transports[0].lower_transport);
+            av_log(s, AV_LOG_DEBUG, "Mask is %d\n", rt->lower_transport_mask);
+            reply->transports[0].lower_transport = lower_transport;
+        }
+
         /* XXX: same protocol for all streams is required */
         if (i > 0) {
             if (reply->transports[0].lower_transport != rt->lower_transport ||
@@ -1566,14 +1580,6 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
             rt->transport = reply->transports[0].transport;
         }
 
-        /* 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;
-        }
-
         switch(reply->transports[0].lower_transport) {
         case RTSP_LOWER_TRANSPORT_TCP:
             rtsp_st->interleaved_min = reply->transports[0].interleaved_min;