[issue2212] rtsp punch packets sent to wrong IP
New submission from John Wimer j...@god.vtic.net: The rtsp code includes support for punch packets to open some NATs when starting the rtp streaming. However, it ignores the source attribute in the Transport header [RFC 2326 section 12.39]. The attached patch sends the punch packets to the ip address specified in the Transport line, falling back the rtsp server's ip if no source is specified. -- files: 0001-Send-punch-packets-to-the-RTP-source-address-if-it-i.patch messages: 11841 priority: normal status: new substatus: new title: rtsp punch packets sent to wrong IP topic: rtsp type: patch FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212 From 7776d24d5251f86cc4988b2d0b177a70d9fde4a8 Mon Sep 17 00:00:00 2001 From: John Wimer j...@god.vtic.net Date: Fri, 3 Sep 2010 09:55:04 +0200 Subject: [PATCH] Send punch packets to the RTP source address if it is specified --- libavformat/rtsp.c | 19 --- libavformat/rtsp.h |4 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index c3f4d00..5d87dd3 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -701,7 +701,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) get_word_sep(buf, sizeof(buf), ;,, p); get_sockaddr(buf, th-destination); } +} else if (!strcmp(parameter, source)) { +if (*p == '=') { +p++; +get_word_sep(buf, sizeof(buf), ;,, p); +strncpy(th-source, buf, sizeof(th-source) - 1); +} } + while (*p != ';' *p != '\0' *p != ',') p++; if (*p == ';') @@ -1154,9 +1161,15 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port, case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; -/* XXX: also use address if specified */ -ff_url_join(url, sizeof(url), rtp, NULL, host, -reply-transports[0].server_port_min, NULL); +/* Use source address if specified */ +if (reply-transports[0].source[0]) { +ff_url_join(url, sizeof(url), rtp, NULL, +reply-transports[0].source, +reply-transports[0].server_port_min, NULL); +} else { +ff_url_join(url, sizeof(url), rtp, NULL, host, +reply-transports[0].server_port_min, NULL); +} if (!(rt-server_type == RTSP_SERVER_WMS i 1) rtp_set_remote_url(rtsp_st-rtp_handle, url) 0) { err = AVERROR_INVALIDDATA; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index c6c3972..24d5e3b 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -66,6 +66,9 @@ enum RTSPControlTransport { #define RTSP_RTP_PORT_MIN 5000 #define RTSP_RTP_PORT_MAX 1 +/** Space for text ip address (max of INET_ADDRSTRLEN INET6_ADDRSTRLEN) */ +#define MAX_ADDRSTR_LEN 46 + /** * This describes a single item in the Transport: line of one stream as * negotiated by the SETUP RTSP command. Multiple transports are comma- @@ -97,6 +100,7 @@ typedef struct RTSPTransportField { int ttl; struct sockaddr_storage destination; /** destination IP address */ +char source[MAX_ADDRSTR_LEN + 1]; /** source IP address */ /** data/packet transport protocol; e.g. RTP or RDT */ enum RTSPTransport transport; -- 1.7.0.4
[issue2212] rtsp punch packets sent to wrong IP
Martin Storsjö mar...@martin.st added the comment: Looks good to me. Luca, Ronald, ok with applying it? -- nosy: +lu_zero, mstorsjo, rbultje FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2211] DV 4:1:1 decodes with scrambled macroblock order
Niobos nio...@dest-unreach.be added the comment: And I refined it further to this line of code: libavcodec/dvdata.c:258 /* 576i50 25Mbps 4:1:1 is a special case */ if (dsf == 1 stype == 0 frame[5] 0x07) { return dv_profiles[2]; } The comment seems to be correct: it is a special case ;-) I'll try to figure out if the frame[5]0x07 condition is over-generic, or if the file is just wrong. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2211
[issue2199] problems with using -ss option when transcoding from *.vob to *.avi
Carl Eugen Hoyos ceho...@rainbow.studorg.tuwien.ac.at added the comment: ffmpeg -ss 0:17:47 -i /second/film.vob -vn -f null - seems to be the minimal command line to reproduce your problem. Now please cut the input file as explained on http://ffmpeg.org/bugreports.html so it is still long enough to reproduce the problem and upload the cut sample into a new directory issue2199 on ftp://ffmpeg.org/MPlayer/incoming/ (write-only). FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2199
[issue2205] AV desynchronisation when moving within the *.avi that was cut with -ss option
Carl Eugen Hoyos ceho...@rainbow.studorg.tuwien.ac.at added the comment: Do mplayer -demuxer lavf or ffplay allow seeking? How does ffplay's ouput look like if you unsuccessfully try to seek? FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2205
[issue2211] DV 4:1:1 decodes with scrambled macroblock order
Niobos nio...@dest-unreach.be added the comment: cfr http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-September/095984.html FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2211
[issue2212] rtsp punch packets sent to wrong IP
Ronald S. Bultje rsbul...@gmail.com added the comment: +} else if (!strcmp(parameter, source)) { +if (*p == '=') { (This should be fixed, this is hideous, all over that function, but that's ok for now.) -/* XXX: also use address if specified */ -ff_url_join(url, sizeof(url), rtp, NULL, host, -reply-transports[0].server_port_min, NULL); +/* Use source address if specified */ +if (reply-transports[0].source[0]) { +ff_url_join(url, sizeof(url), rtp, NULL, +reply-transports[0].source, +reply-transports[0].server_port_min, NULL); +} else { +ff_url_join(url, sizeof(url), rtp, NULL, host, +reply-transports[0].server_port_min, NULL); +} Please separate the reindenting from the function change while committing. +/** Space for text ip address (max of INET_ADDRSTRLEN INET6_ADDRSTRLEN) */ +#define MAX_ADDRSTR_LEN 46 Please use INET6_ADDRSTRLEN. If undefined, in os_support.h, set it to INET_ADDRSTRLEN. If undefined, set it to some random number, e.g. 46. Don't hardcode this stuff unnecessarily. General idea sounds good to me. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2212] rtsp punch packets sent to wrong IP
Martin Storsjö mar...@martin.st added the comment: -/* XXX: also use address if specified */ -ff_url_join(url, sizeof(url), rtp, NULL, host, -reply-transports[0].server_port_min, NULL); +/* Use source address if specified */ +if (reply-transports[0].source[0]) { +ff_url_join(url, sizeof(url), rtp, NULL, +reply-transports[0].source, +reply-transports[0].server_port_min, NULL); +} else { +ff_url_join(url, sizeof(url), rtp, NULL, host, +reply-transports[0].server_port_min, NULL); +} Please separate the reindenting from the function change while committing. Ah, yes, I missed that. +/** Space for text ip address (max of INET_ADDRSTRLEN INET6_ADDRSTRLEN) */ +#define MAX_ADDRSTR_LEN 46 Please use INET6_ADDRSTRLEN. If undefined, in os_support.h, set it to INET_ADDRSTRLEN. If undefined, set it to some random number, e.g. 46. Don't hardcode this stuff unnecessarily. In his defense, he asked about this, and I suggested this solution, since it is independent of both v4 and v6, not littering general code with references to whichever address family has the largest addresses at the moment. But if you prefer that we use INET6_ADDRSTRLEN straight away, I'm ok with that too. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2213] Freeze when connecting to FMS server (RTMP protocol)
New submission from Boris b0rl...@yahoo.com: Both ffmpeg and ffprobe freeze often when connecting to a stream on fms server via rtmp:// url. Reproduces best on fms 3.5, but also happens on 3.0. The reason is apparently the audio stream (or rather lack thereof). The freeze occurs inside the av_find_stream_info loop (libavformat/utils.c:2238 in revision 25029). It sees two streams. Stream #0 (video) is successfully detected as flv. However in case fms doesn't transmit audio (because it's been switched off on client, or it detected silence), has_codec_parameters always returns false and the loop goes on until buffer fills up. Simply disabling checks for all audio streams and supplying -an parameter works fine and no freezes occur. The best way to reproduce is streaming a soundless video through fms (e.g. default 'live' app). I realize this is probably not trivial to fix properly. But at least you could skip the audio stream detection in case -an has been supplied. Here's the ffmpeg version details. Let me know which additional info would help. FFmpeg version SVN-r25029, Copyright (c) 2000-2010 the FFmpeg developers built on Sep 3 2010 16:10:01 with gcc 4.4.3 configuration: libavutil 50.24. 0 / 50.24. 0 libavcore 0. 6. 0 / 0. 6. 0 libavcodec52.87. 0 / 52.87. 0 libavformat 52.78. 3 / 52.78. 3 libavdevice 52. 2. 1 / 52. 2. 1 libavfilter1.38. 1 / 1.38. 1 libswscale 0.11. 0 / 0.11. 0 -- messages: 11851 priority: normal status: new substatus: new title: Freeze when connecting to FMS server (RTMP protocol) topic: avformat, ffmpeg type: bug FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2213
[issue2213] Freeze when connecting to FMS server (RTMP protocol)
Boris b0rl...@yahoo.com added the comment: However in case fms doesn't transmit audio (because it's been switched off on client, or it detected silence), has_codec_parameters always returns false and the loop goes on until buffer fills up. -- I was referring to has_codec_parameters for Stream #1 (the audio stream). FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2213
[issue2212] rtsp punch packets sent to wrong IP
Ronald S. Bultje rsbul...@gmail.com added the comment: I think we'd like to use the IPv6 API where-ever possible, including here. If it's unavailable, os_support should provide a fallback for the IPv4 API. If that's unavailable, it should not be compiled in the first place because the whole networking stack will be disabled (--disable=network). FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2212] rtsp punch packets sent to wrong IP
Luca Barbato lu_z...@gentoo.org added the comment: On 09/03/2010 02:29 PM, Martin Storsjö wrote: In his defense, he asked about this, and I suggested this solution, since it is independent of both v4 and v6, not littering general code with references to whichever address family has the largest addresses at the moment. But if you prefer that we use INET6_ADDRSTRLEN straight away, I'm ok with that too. I have no strong opinion regarding the macro value, INET6_ADDRSTRLEN seems fine if is always defined. The rest of the patch looks ok lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2212] rtsp punch packets sent to wrong IP
John Wimer j...@god.vtic.net added the comment: updated patch to use INET6_ADDRSTRLEN. A second whitespace-changes-only patch to follow. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212 From 8f9ea392e2f1def2fe4f74bac6a2ddc47946b706 Mon Sep 17 00:00:00 2001 From: John Wimer j...@god.vtic.net Date: Fri, 3 Sep 2010 18:37:13 +0200 Subject: [PATCH 1/2] Send punch packets to the RTP source address if it is specified in the Transport header --- libavformat/os_support.h |6 ++ libavformat/rtsp.c | 15 ++- libavformat/rtsp.h |1 + 3 files changed, 21 insertions(+), 1 deletions(-) diff --git a/libavformat/os_support.h b/libavformat/os_support.h index 5c9e81b..3207123 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -55,6 +55,12 @@ typedef int socklen_t; #define closesocket close #endif +#ifndef INET6_ADDRSTRLEN +# if defined(INET_ADDRSTRLEN) +#define INET6_ADDRSTRLEN INET_ADDRSTRLEN +# endif +#endif + #if CONFIG_FFSERVER #if !HAVE_POLL_H typedef unsigned long nfds_t; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index be3eee6..4ab2c33 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -701,7 +701,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) get_word_sep(buf, sizeof(buf), ;,, p); get_sockaddr(buf, th-destination); } +} else if (!strcmp(parameter, source)) { +if (*p == '=') { +p++; +get_word_sep(buf, sizeof(buf), ;,, p); +av_strlcpy(th-source, buf, sizeof(th-source)); +} } + while (*p != ';' *p != '\0' *p != ',') p++; if (*p == ';') @@ -1154,9 +1161,15 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port, case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; -/* XXX: also use address if specified */ +/* Use source address if specified */ +if (reply-transports[0].source[0]) { +ff_url_join(url, sizeof(url), rtp, NULL, +reply-transports[0].source, +reply-transports[0].server_port_min, NULL); +} else { ff_url_join(url, sizeof(url), rtp, NULL, host, reply-transports[0].server_port_min, NULL); +} if (!(rt-server_type == RTSP_SERVER_WMS i 1) rtp_set_remote_url(rtsp_st-rtp_handle, url) 0) { err = AVERROR_INVALIDDATA; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index c6c3972..c577618 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -97,6 +97,7 @@ typedef struct RTSPTransportField { int ttl; struct sockaddr_storage destination; /** destination IP address */ +char source[INET6_ADDRSTRLEN + 1]; /** source IP address */ /** data/packet transport protocol; e.g. RTP or RDT */ enum RTSPTransport transport; -- 1.7.0.4
[issue2212] rtsp punch packets sent to wrong IP
John Wimer j...@god.vtic.net added the comment: whitespace cleanup FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212 From 3b9d391d562b9d8c835837db40b0664910372433 Mon Sep 17 00:00:00 2001 From: John Wimer j...@god.vtic.net Date: Fri, 3 Sep 2010 18:39:57 +0200 Subject: [PATCH 2/2] re-indent --- libavformat/rtsp.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 4ab2c33..1be5a39 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1167,9 +1167,9 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port, reply-transports[0].source, reply-transports[0].server_port_min, NULL); } else { -ff_url_join(url, sizeof(url), rtp, NULL, host, -reply-transports[0].server_port_min, NULL); -} +ff_url_join(url, sizeof(url), rtp, NULL, host, +reply-transports[0].server_port_min, NULL); +} if (!(rt-server_type == RTSP_SERVER_WMS i 1) rtp_set_remote_url(rtsp_st-rtp_handle, url) 0) { err = AVERROR_INVALIDDATA; -- 1.7.0.4
[issue2212] rtsp punch packets sent to wrong IP
Ronald S. Bultje rsbul...@gmail.com added the comment: +#ifndef INET6_ADDRSTRLEN +# if defined(INET_ADDRSTRLEN) +#define INET6_ADDRSTRLEN INET_ADDRSTRLEN +# endif +#endif The inner if/endif aren't necessary (I was wrong there earlier). Otherwise OK. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2212] rtsp punch packets sent to wrong IP
John Wimer j...@god.vtic.net added the comment: new version of 0001 patch, where it doesn't bother checking for INET_ADDRSTRLEN. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212 From 583ff7440e7a62d0623f25de4e9b9499f5a5ed9a Mon Sep 17 00:00:00 2001 From: John Wimer j...@god.vtic.net Date: Fri, 3 Sep 2010 20:49:55 +0200 Subject: [PATCH 1/2] Send punch packets to the RTP source address if it is specified in the Transport header --- libavformat/os_support.h |4 libavformat/rtsp.c | 15 ++- libavformat/rtsp.h |1 + 3 files changed, 19 insertions(+), 1 deletions(-) diff --git a/libavformat/os_support.h b/libavformat/os_support.h index 5c9e81b..1330d3d 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -55,6 +55,10 @@ typedef int socklen_t; #define closesocket close #endif +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN INET_ADDRSTRLEN +#endif + #if CONFIG_FFSERVER #if !HAVE_POLL_H typedef unsigned long nfds_t; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index be3eee6..4ab2c33 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -701,7 +701,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) get_word_sep(buf, sizeof(buf), ;,, p); get_sockaddr(buf, th-destination); } +} else if (!strcmp(parameter, source)) { +if (*p == '=') { +p++; +get_word_sep(buf, sizeof(buf), ;,, p); +av_strlcpy(th-source, buf, sizeof(th-source)); +} } + while (*p != ';' *p != '\0' *p != ',') p++; if (*p == ';') @@ -1154,9 +1161,15 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port, case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; -/* XXX: also use address if specified */ +/* Use source address if specified */ +if (reply-transports[0].source[0]) { +ff_url_join(url, sizeof(url), rtp, NULL, +reply-transports[0].source, +reply-transports[0].server_port_min, NULL); +} else { ff_url_join(url, sizeof(url), rtp, NULL, host, reply-transports[0].server_port_min, NULL); +} if (!(rt-server_type == RTSP_SERVER_WMS i 1) rtp_set_remote_url(rtsp_st-rtp_handle, url) 0) { err = AVERROR_INVALIDDATA; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index c6c3972..c577618 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -97,6 +97,7 @@ typedef struct RTSPTransportField { int ttl; struct sockaddr_storage destination; /** destination IP address */ +char source[INET6_ADDRSTRLEN + 1]; /** source IP address */ /** data/packet transport protocol; e.g. RTP or RDT */ enum RTSPTransport transport; -- 1.7.0.4
[issue2212] rtsp punch packets sent to wrong IP
Luca Barbato lu_z...@gentoo.org added the comment: On 09/03/2010 08:52 PM, John Wimer wrote: John Wimer j...@god.vtic.net added the comment: new version of 0001 patch, where it doesn't bother checking for INET_ADDRSTRLEN. Looks ok -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2212] rtsp punch packets sent to wrong IP
Ronald S. Bultje rsbul...@gmail.com added the comment: OK from me too. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2212] rtsp punch packets sent to wrong IP
Ronald S. Bultje rsbul...@gmail.com added the comment: Applied, thanks. -- status: new - closed substatus: new - fixed FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2212
[issue2088] Compilation error of inline assembly in dsputil_mmx.c
Mathias Krause mathias.kra...@secunet.com added the comment: I ran into the same problem on Debain, also with gcc 4.3.2. This really looks like a compiler problem but at least I've a workaround for it :) With the attached patch ffmpeg 0.6 compiles fine with --enable-pic for me. Maybe pogo11 gives it a shot. FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2088 This patch splits up the inline assembly in transpose4x4() because otherwise some versions of gcc (at least Debian's 4.3.2) aren't able to handle the amount of variables to assign registers to when compiling this code with -fPIC. Signed-Off: Mathias Krause mathias.kra...@secunet.com diff -Nrup a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c --- a/libavcodec/x86/dsputil_mmx.c 2010-04-17 04:04:30.0 +0200 +++ b/libavcodec/x86/dsputil_mmx.c 2010-09-03 21:14:43.0 +0200 @@ -725,15 +725,23 @@ static void h263_v_loop_filter_mmx(uint8 static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ... -movd %4, %%mm0\n\t -movd %5, %%mm1\n\t -movd %6, %%mm2\n\t -movd %7, %%mm3\n\t +movd %0, %%mm0\n\t +movd %1, %%mm1\n\t +movd %2, %%mm2\n\t +movd %3, %%mm3\n\t punpcklbw %%mm1, %%mm0 \n\t punpcklbw %%mm3, %%mm2 \n\t movq %%mm0, %%mm1 \n\t punpcklwd %%mm2, %%mm0 \n\t punpckhwd %%mm2, %%mm1 \n\t + : /* nothing */ +: m (*(uint32_t*)(src + 0*src_stride)), + m (*(uint32_t*)(src + 1*src_stride)), + m (*(uint32_t*)(src + 2*src_stride)), + m (*(uint32_t*)(src + 3*src_stride)) +); + +__asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ... movd %%mm0, %0\n\t punpckhdq %%mm0, %%mm0 \n\t movd %%mm0, %1\n\t @@ -745,10 +753,6 @@ static inline void transpose4x4(uint8_t =m (*(uint32_t*)(dst + 1*dst_stride)), =m (*(uint32_t*)(dst + 2*dst_stride)), =m (*(uint32_t*)(dst + 3*dst_stride)) -: m (*(uint32_t*)(src + 0*src_stride)), - m (*(uint32_t*)(src + 1*src_stride)), - m (*(uint32_t*)(src + 2*src_stride)), - m (*(uint32_t*)(src + 3*src_stride)) ); }
[issue2159] SVN 24744: missing dependency for muxer rtp
Martin Storsjö mar...@martin.st added the comment: Fixed in SVN rev 25036. -- status: new - closed substatus: new - fixed FFmpeg issue tracker iss...@roundup.ffmpeg.org https://roundup.ffmpeg.org/issue2159