Commit Graph

125 Commits

Author SHA1 Message Date
lemonlinger@gmail.com 2cf94485de avformat/rtpproto: when local rtp port and local rtcp port are not specified, try to make two successive ports and retry 3 times when failed
some video players on Android will not send udp hole punching messages if the rtcp port and rtp port are not two successive integers.
So, if the video player is behind NAT, it could not receive and rtp messages via udp

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-25 22:40:21 +02:00
Michael Niedermayer e1ec7990fe Merge commit '4b054a3400f728c54470ee6a1eefe1d82420f6a2'
* commit '4b054a3400f728c54470ee6a1eefe1d82420f6a2':
  rtpproto: Check the right feature detection macro

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-16 12:31:15 +02:00
Martin Storsjö 4b054a3400 rtpproto: Check the right feature detection macro
IPPROTO_IPV6 is unrelated here (it's only used in udp.c for
multicast sockopts), check for support for the sockaddr_in6
struct itself.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-15 15:35:41 +03:00
Michael Niedermayer 2c959eccc6 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpproto: Check for the right feature when reading a sockaddr_in6

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-15 11:34:30 +02:00
Dave Yeo c3386bd5b4 rtpproto: Check for the right feature when reading a sockaddr_in6
Some systems, such as OS/2, define AF_INET6 without a full
implementation.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-15 10:31:43 +03:00
Michael Niedermayer 2425be894a Merge commit '6b58e11a8331690ec32e9869db89ae10c54614e9'
* commit '6b58e11a8331690ec32e9869db89ae10c54614e9':
  rtpproto: Add an option for writing return packets to the address of the last received packets

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-14 12:38:11 +02:00
Michael Niedermayer 1a01f367a4 Merge commit '2427ac6ccd868811d1fe9df7c64c50ca58abe6f6'
* commit '2427ac6ccd868811d1fe9df7c64c50ca58abe6f6':
  rtpproto: Update the parameter documentation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-14 12:30:40 +02:00
Martin Storsjö 6b58e11a83 rtpproto: Add an option for writing return packets to the address of the last received packets
If we've received packets on the same socket before, the return
packets are sent to that address. If we've only received packets
on the other socket, try to guess the source port for the other
one assuming the basic +1/-1 logic.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-14 11:21:32 +03:00
Martin Storsjö 2427ac6ccd rtpproto: Update the parameter documentation
Move the sources documentation up below the marker for deprecated
otpions. Also mention the new block parameter, that was added
in 749722209.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-13 22:16:53 +03:00
Michael Niedermayer 0f5a40c2a4 Merge commit 'ee37d5811caa8f4ad125a37fe6ce3f9e66cd72f2'
* commit 'ee37d5811caa8f4ad125a37fe6ce3f9e66cd72f2':
  rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 13:51:44 +02:00
Michael Niedermayer 2ee58af53e Merge commit '1851e1d05d06f6ef3436c667e4354da0f407b226'
* commit '1851e1d05d06f6ef3436c667e4354da0f407b226':
  rtpproto: Check the size before reading buf[1]

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 13:24:57 +02:00
Michael Niedermayer fcccb4c11d Merge commit 'b7e6da988bfd5def40ccf3476eb8ce2f98a969a5'
* commit 'b7e6da988bfd5def40ccf3476eb8ce2f98a969a5':
  rtpproto: Move rtpproto specific function declarations to a separate header

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 12:03:24 +02:00
Michael Niedermayer d6b37de4d4 Merge commit '892b0be1dfbdeaf71235fb6c593286e4f5c7e4ec'
* commit '892b0be1dfbdeaf71235fb6c593286e4f5c7e4ec':
  rtpproto: Simplify the rtp_read function by looping over the fds

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 11:58:17 +02:00
Michael Niedermayer b39f012dee Merge commit '7531588fffbca1f0afdcc06635999c00dfc16ca6'
* commit '7531588fffbca1f0afdcc06635999c00dfc16ca6':
  rtpproto: Remove a misplaced comment

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 11:53:54 +02:00
Michael Niedermayer d2c613dd14 Merge commit '54e03ff6af8a070f1055edd26028f3f7b2e2ca8e'
* commit '54e03ff6af8a070f1055edd26028f3f7b2e2ca8e':
  rtpproto: Support nonblocking reads

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 11:47:42 +02:00
Martin Storsjö ee37d5811c rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url
A separate rtcp port can already be set when opening the rtp
protocol normally, but when doing port setup as in RTSP (where
we first need to open the local ports and pass them to the peer,
and only then receive the remote peer port numbers), we didn't
check the same url parameter as in the normal open routine.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-01 10:26:17 +03:00
Martin Storsjö 1851e1d05d rtpproto: Check the size before reading buf[1]
I doubt that anyone ever would try to send a 1 byte packet
via the RTP protocol, but check just in case - it shouldn't
crash at least.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-01 09:41:21 +03:00
Martin Storsjö b7e6da988b rtpproto: Move rtpproto specific function declarations to a separate header
Mixing these with the rtp depacketizer functions in rtpdec.h is
no good.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-31 21:12:34 +03:00
Martin Storsjö 892b0be1df rtpproto: Simplify the rtp_read function by looping over the fds
This avoids having duplicate code where only the fd parameter
differs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-31 21:12:34 +03:00
Martin Storsjö 7531588fff rtpproto: Remove a misplaced comment
The fdset is a pollfd array nowadays, and it is already populated
at this point.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-31 21:12:34 +03:00
Martin Storsjö 54e03ff6af rtpproto: Support nonblocking reads
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-31 21:12:34 +03:00
Michael Niedermayer 0b712f5d5e Merge commit '74972220909787af5a3ffe66f7fa8041827c2bd2'
* commit '74972220909787af5a3ffe66f7fa8041827c2bd2':
  rtpproto: Support more than one SSM include address, support excludes

Conflicts:
	libavformat/rtpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 11:51:14 +02:00
Ed Torbett 7497222090 rtpproto: Support more than one SSM include address, support excludes
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 22:58:55 +03:00
Michael Niedermayer 4835332537 Merge commit '36fb0d02a1faa11eaee51de01fb4061ad6092af9'
* commit '36fb0d02a1faa11eaee51de01fb4061ad6092af9':
  rtsp: Support multicast source filters (RFC 4570)
  rtpproto: Check the source IP if one single source has been specified
  rtpproto: Support IGMPv3 source specific multicast inclusion

Conflicts:
	libavformat/rtpproto.c
	libavformat/rtsp.c
	libavformat/rtsp.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-20 10:39:53 +02:00
Martin Storsjö 4d97ca040b rtpproto: Check the source IP if one single source has been specified
If another peer is sending unicast packets to the same port that
we are listening on, those packets can end up being received despite
using source specific multicast. For those cases, manually check the
source address of received packets against the intended source address.

This only handles the case when the source list is one single IP
address for now, which probably is the most common case.

Based on a patch by Ed Torbett.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-19 12:02:09 +03:00
Ed Torbett 336353deaa rtpproto: Support IGMPv3 source specific multicast inclusion
Blocking/exclusion is not supported yet.

The rtp protocol parameter takes the same form as the existing
sources parameter for the udp protocol.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-19 12:00:49 +03:00
Ed Torbett 7203dbde39 avformat/rt*p: Joining a SSM multicast group using an SDP (Issue #2171)
Passes Source-Specific Multicast parameters read from an sdp file through to the UDP socket code,
allowing source-specific multicast streams to be correctly received. As an integral part of this
change, additional checking (currently only enabled in the case of SSM streams, but probably
useful in similar scenarios) has been added to the RTP protocol handler to distinguish UDP packets
arriving from multiple sources to the same port and process only the expected packets
(those transmitted from the expected UDP source address). This resolves an issue identified
when multiple instances of FFmpeg subscribe to different Source-Specific Multicast streams
but with each sharing the same destination port.

Signed-off-by: Edward Torbett <ed.torbett@simulation-systems.co.uk>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-18 18:01:31 +02:00
Michael Niedermayer 7897919a88 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacdec: Fix an off-by-one overwrite when switching to LTP profile from MAIN.
  x86inc: fix stack alignment on win64
  rtpproto: Remove unused defines

Conflicts:
	libavcodec/aacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-13 12:23:48 +01:00
Martin Storsjö 29d2595ad7 rtpproto: Remove unused defines
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 16:01:24 +02:00
Michael Niedermayer 6c180b35c4 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpegvideo_enc: don't use deprecated avcodec_encode_video().
  cmdutils: refactor -codecs option.
  avconv: make -shortest a per-output file option.
  lavc: add avcodec_descriptor_get_by_name().
  lavc: add const to AVCodec* function parameters.
  swf(dec): replace CODEC_ID with AV_CODEC_ID
  dvenc: don't use deprecated AVCODEC_MAX_AUDIO_FRAME_SIZE
  rtmpdh: Do not generate the same private key every time when using libnettle
  rtp: remove ff_rtp_get_rtcp_file_handle().
  rtsp.c: use ffurl_get_multi_file_handle() instead of ff_rtp_get_rtcp_file_handle()
  avio: add (ff)url_get_multi_file_handle() for getting more than one fd
  h264: vdpau: fix crash with unsupported colorspace
  amrwbdec: Decode the fr_quality bit properly

Conflicts:
	Changelog
	cmdutils.c
	cmdutils_common_opts.h
	doc/ffmpeg.texi
	ffmpeg.c
	ffmpeg.h
	ffmpeg_opt.c
	libavcodec/h264.c
	libavcodec/options.c
	libavcodec/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-18 15:20:32 +02:00
Jordi Ortiz a2dd4f7780 rtp: remove ff_rtp_get_rtcp_file_handle().
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-17 22:15:56 +03:00
Jordi Ortiz d6b9da1178 avio: add (ff)url_get_multi_file_handle() for getting more than one fd
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-17 22:14:30 +03:00
Michael Niedermayer 4da42ebe44 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  MS Screen 1 decoder
  aacdec: Fix popping channel layouts.
  av_gettime: support Win32 without gettimeofday()
  Use av_gettime() in various places
  Move av_gettime() to libavutil
  dct-test: use emms_c() from libavutil instead of duplicating it
  mov: fix operator precedence bug
  mathematics.h: remove a couple of math defines
  Remove unnecessary inclusions of [sys/]time.h
  lavf: remove unnecessary inclusions of unistd.h
  bfin: libswscale: add const where appropriate to fix warnings
  bfin: libswscale: remove unnecessary #includes
  udp: Properly check for invalid sockets
  tcp: Check the return value from getsockopt
  network: Use av_strerror for getting error messages
  udp: Properly print error from getnameinfo
  mmst: Use AVUNERROR() to convert error codes to the right range for strerror
  network: Pass pointers of the right type to get/setsockopt/ioctlsocket on windows
  rtmp: Reduce the number of idle posts sent by sleeping 50ms

Conflicts:
	Changelog
	configure
	libavcodec/aacdec.c
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/dct-test.c
	libavcodec/version.h
	libavformat/riff.c
	libavformat/udp.c
	libavutil/Makefile
	libswscale/bfin/yuv2rgb_bfin.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-20 20:47:46 +02:00
Mans Rullgard 6501dcfb5e Remove unnecessary inclusions of [sys/]time.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 11:46:46 +01:00
Mans Rullgard 4e5a514813 lavf: remove unnecessary inclusions of unistd.h
These files do not use anything provided by unistd.h.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 11:46:30 +01:00
Michael Niedermayer 8c1ebdcea2 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  shorten: Use separate pointers for the allocated memory for decoded samples.
  atrac3: Fix crash in tonal component decoding.
  ws_snd1: Fix wrong samples counts.
  movenc: Don't set a default sample duration when creating ismv
  rtp: Factorize the check for distinguishing RTCP packets from RTP
  golomb: avoid infinite loop on all-zero input (or end of buffer).
  bethsoftvid: synchronize video timestamps with audio sample rate
  bethsoftvid: add audio stream only after getting the first audio packet
  bethsoftvid: Set video packet duration instead of accumulating pts.
  bethsoftvid: set packet key frame flag for audio and I-frame video packets.
  bethsoftvid: fix read_packet() return codes.
  bethsoftvid: pass palette in side data instead of in a separate packet.
  sdp: Ignore RTCP packets when autodetecting RTP streams
  proresenc: initialise 'sign' variable
  mpegaudio: replace memcpy by SIMD code
  vc1: prevent using last_frame as a reference for I/P first frame.

Conflicts:
	libavcodec/atrac3.c
	libavcodec/golomb.h
	libavcodec/shorten.c
	libavcodec/ws-snd1.c
	tests/ref/fate/bethsoft-vid

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-17 00:35:06 +01:00
Martin Storsjö 298a587f44 rtp: Factorize the check for distinguishing RTCP packets from RTP
The binary doesn't change after this patch.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-16 17:45:33 +01:00
Michael Niedermayer 3edff185ab Merge remote-tracking branch 'qatar/master'
* qatar/master: (21 commits)
  ipmovie: do not read audio packets before the codec is known
  truemotion2: check size before GetBitContext initialisation
  avio: Only do implicit network initialization for network protocols
  avio: Add an URLProtocol flag for indicating that a protocol uses network
  adpcm: ADPCM Electronic Arts has always two channels
  matroskadec: Fix a bug where a pointer was cached to an array that might later move due to a realloc()
  fate: Add missing reference file from 9b4767e4.
  mov: Support MOV_CH_LAYOUT_USE_DESCRIPTIONS for labeled descriptions.
  4xm: Prevent buffer overreads.
  mjpegdec: parse RSTn to prevent skipping other data in mjpeg_decode_scan
  vp3: add fate test for non-zero last coefficient
  vp3: fix streams with non-zero last coefficient
  swscale: remove unused U/V arguments from yuv2rgb_write().
  timer: K&R formatting cosmetics
  lavf: cosmetics, reformat av_read_frame().
  lavf: refactor av_read_frame() to make it easier to understand.
  Report an error if pitch_lag is zero in AMR-NB decoder.
  Revert "4xm: Prevent buffer overreads."
  4xm: Prevent buffer overreads.
  4xm: pass the correct remaining buffer size to decode_i2_frame().
  ...

Conflicts:
	libavcodec/4xm.c
	libavcodec/mjpegdec.c
	libavcodec/truemotion2.c
	libavformat/ipmovie.c
	libavformat/mov_chan.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-06 02:45:12 +01:00
Martin Storsjö 32b83aeec1 avio: Add an URLProtocol flag for indicating that a protocol uses network
This definition is in two files, since the definitions will move
to the private header at the next bump.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-05 23:56:52 +02:00
Michael Niedermayer 7b0b10ce41 Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits)
  rtpenc: Add support for G726 audio
  rtpdec: Interpret the different G726 names as bits_per_coded_sample
  rtpenc: Change rtp_send_samples to handle sample sizes other than even bytes
  rtpenc: Cast a rescaling parameter to int64_t
  h264: cap max has_b_frames at MAX_DELAYED_PIC_COUNT - 1.
  ARM: fix indentation in ff_dsputil_init_neon()
  ARM: NEON put/avg_pixels8/16 cosmetics
  ARM: add remaining NEON avg_pixels8/16 functions
  ARM: clean up NEON put/avg_pixels macros
  fate: split acodec-pcm into individual tests
  swscale: #include "libavutil/mathematics.h"
  pmpdec: don't use deprecated av_set_pts_info.
  rv34: align temporary block of "dct" coefs
  Add PlayStation Portable PMP format demuxer
  proto: Realign struct initializers
  proto: Use .priv_data_size to allocate the private context
  mmsh: Properly clean up if the second ffurl_alloc failed
  rtmp: Clean up properly if the handshake failed
  md5proto: Remove the get_file_handle function
  applehttpproto: Use the close function if the open function fails
  ...

Conflicts:
	libavcodec/vble.c
	libavformat/mmsh.c
	libavformat/pmpdec.c
	libavformat/udp.c
	tests/ref/acodec/pcm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-02 00:51:11 +01:00
Martin Storsjö 7e58050590 proto: Use .priv_data_size to allocate the private context
This simplifies the open functions by avoiding one function
call that needs error checking, reducing the amount of
extra bulk code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-01 13:47:26 +02:00
Michael Niedermayer 5f268ca5c5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavf: pass options from AVFormatContext to avio.
  avformat: Use avio_open2, pass the AVFormatContext interrupt_callback onwards
  avio: add avio_open2, taking an interrupt callback and options
  avio: add support for passing options to protocols.
  avio: add and use ffurl_protocol_next().
  avformat: Pass the interrupt callback on to chained muxers/demuxers
  avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
  avformat: Use ff_check_interrupt
  avio: Add an internal utility function for checking the new interrupt callback
  avio: Add AVIOInterruptCB
  texi2html: remove stray \n
  doc: prettyfy the texi2html documentation
  swscale: handle unaligned buffers in yuv2plane1

Conflicts:
	libavformat/avformat.h
	libavformat/avio.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-14 00:33:39 +01:00
Anton Khirnov ddffc2fdc3 avio: add support for passing options to protocols.
Not used anywhere yet, support for passing options from avio_open() will
follow.
2011-11-13 13:14:39 +01:00
Martin Storsjö 6f1b7b3944 avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
Change all uses of these function to pass the relevant
callback on.
2011-11-13 13:12:17 +01:00
Martin Storsjö 9957cdbfd5 avformat: Use ff_check_interrupt 2011-11-13 13:08:13 +01:00
Michael Niedermayer f884ef00de Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
  tiffenc: initialize forgotten avctx.
  avplay: free the active audio packet at exit.
  avplay: free rdft data used for spectrogram analysis.
  log.h: make AVClass a named struct
  fix ac3 encoder documentation
  vc1: more prettyprinting cosmetics
  vc1: prettyprint some tables
  vc1: K&R formatting cosmetics
  AVOptions: bump minor and add APIchanges entry.
  cmdutils/avtools: simplify show_help() by using av_opt_child_class_next()
  AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_*
  Remove all uses of deprecated AVOptions API.
  AVOptions: add av_opt_next, deprecate av_next_option.
  AVOptions: add functions for evaluating option strings.
  AVOptions: split get_number().
  AVOptions: add av_opt_get*, deprecate av_get*.
  AVOptions: add av_opt_set*().
  AVOptions: add new API for enumerating children.
  rv34: move inverse transform functions to DSP context
  flvenc: Write the right metadata entry count
  ...

Conflicts:
	avconv.c
	cmdutils.c
	doc/APIchanges
	ffplay.c
	ffprobe.c
	libavcodec/ac3dec.c
	libavcodec/h264.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mpeg12enc.c
	libavcodec/options.c
	libavdevice/libdc1394.c
	libavdevice/v4l2.c
	libavfilter/vf_drawtext.c
	libavformat/flvdec.c
	libavformat/mpegtsenc.c
	libavformat/options.c
	libavutil/avutil.h
	libavutil/opt.c
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-13 06:00:03 +02:00
Martin Storsjö bfc6db4477 rtpdec: Add ff_ prefix to all nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:12 +03:00
Michael Niedermayer 158eb8599a rtp: disable udp fifos, the rtp code cannot work with the fifos in its current form as rtp bypasses the public API.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-25 16:37:12 +02:00
Michael Niedermayer 4095fa9038 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dnxhddec: optimise dnxhd_decode_dct_block()
  rtp: remove disabled code
  eac3enc: use different numbers of blocks per frame to allow higher bitrates
  dnxhd: add regression test for 10-bit
  dnxhd: 10-bit support
  dsputil: update per-arch init funcs for non-h264 high bit depth
  dsputil: template get_pixels() for different bit depths
  dsputil: create 16/32-bit dctcoef versions of some functions
  jfdctint: add 10-bit version
  mov: add clcp type track as Subtitle stream.
  mpeg4: add Mpeg4 Profiles names.
  mpeg4: decode Level Profile for MPEG4 Part 2.
  ffprobe: display bitstream level.
  imgconvert: remove unused glue and xglue macros

Conflicts:
	libavcodec/dsputil_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-22 12:08:52 +02:00
Diego Biurrun 4cc843facd rtp: remove disabled code 2011-07-21 23:03:10 +02:00