Commit Graph

104 Commits

Author SHA1 Message Date
John Brooks 525c5b08fb rtpdec: only use RTCP for PTS when synchronizing multiple streams
RTCP timestamps are only necessary to synchronize time between
multiple streams. For a single stream, the RTP packet timestamp
provides more reliable timing. As a result, single-stream RTP
sessions should now have accurate and monotonic PTS.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:47:28 +02:00
John Brooks 12348ca25e rtpdec: unwrap RTP timestamps for PTS calculation
The timestamp field in RTPDemuxContext was unused before this.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:31:17 +02:00
John Brooks b8a1b880ee rtpdec: Simplify finalize_packet
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-11 14:26:37 +02:00
Reimar Döffinger bb3244dee2 Replace all usage of strcasecmp/strncasecmp
All current usages of it are incompatible with localization.
For example strcasecmp("i", "I") != 0 is possible, but would
break many of the places where it is used.

Instead use our own implementations that always treat the data
as ASCII.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 11:52:57 +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
John Brooks 07b77fe387 rtpdec: Read the packet length for all RTCP packet types
This allows skipping past unsupported RTCP packet types, as
RFC 3550 section 6.1 mandates.

Currently this only has any practical effect if a sender puts
an unrecognized type before RTCP_BYE in a compounded packet, or
(incorrectly) does not put RTCP_SR first.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:37:42 +03:00
John Brooks 5d6ecf5345 rtpdec: Fix the minimum packet length for RTCP SR packets
We actually read 20 bytes of these packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:37:39 +03:00
Diego Biurrun 4cc843facd rtp: remove disabled code 2011-07-21 23:03:10 +02:00
Mans Rullgard 0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Mans Rullgard 5e1166b31b Mark some variables with av_unused
Most of these variables are only used in av_dlog statements, some
are required but not used by other macros.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-06-03 12:59:05 +01:00
Diego Biurrun 046f081b46 configure: Do not unconditionally add -D_POSIX_C_SOURCE to CPPFLAGS.
Adding _POSIX_C_SOURCE to CPPFLAGS globally produces all sorts of problems
since it causes certain system functions to be hidden on some (BSD) systems.
The solution is to only add the flag on systems that really require it, i.e.
glibc-based ones.

This change makes BSD systems compile out-of-the-box without the need for
adding specific flags manually.  It also allows dropping a number of flags
set manually on a file-per-file basis, but were only present to work around
breakage introduced by the presence of _POSIX_C_SOURCE.

Also add _XOPEN_SOURCE to CPPFLAGS for glibc systems.  We use XSI extensions
in several places already, so it is preferable to define it globally instead
of littering source files with individual #defines only needed for glibc.
2011-05-12 11:41:59 +02:00
Anton Khirnov 925e908bc7 avio: make url_write() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 403ee835e7 avio: make url_open_dyn_packet_buf internal.
It doesn't look fit to be a part of the public API.

Adding a temporary hack to ffserver to be able to use it, should be
cleaned up when somebody is up for it.
2011-04-03 22:47:32 +02:00
Anton Khirnov 6dc7d80de7 avio: avio_ prefix for url_close_dyn_buf 2011-04-03 22:47:05 +02:00
Anton Khirnov b92c545282 avio: avio_ prefix for url_open_dyn_buf 2011-04-03 22:46:56 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Anton Khirnov b7f2fdde74 avio: rename put_flush_packet -> avio_flush
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-16 22:59:39 -04:00
Anton Khirnov 77eb5504d3 avio: avio: avio_ prefixes for put_* functions
In the name of consistency:
put_byte           -> avio_w8
put_<type>         -> avio_w<type>
put_buffer         -> avio_write

put_nbyte will be made private
put_tag will be merged with avio_put_str

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-21 14:25:15 -05:00
Anton Khirnov ae628ec1fd avio: rename ByteIOContext to AVIOContext.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:15 -05:00
Luca Barbato dfd2a005eb Replace dprintf with av_dlog
dprintf clashes with POSIX.1-2008
2011-01-29 23:55:37 +01:00
Diego Elio Pettenò 119cc033fc Make RTPFirstDynamicPayloadHandler static to rtpdec.c
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-25 01:45:34 +00:00
Diego Elio Pettenò 69ad22c7a7 Make ff_realmedia_mp3_dynamic_handler static.
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-25 01:37:32 +00:00
Martin Storsjö 79d482b108 rtpdec: Don't set RTP timestamps if they already are set by the depacketizer
For MS-RTSP, we don't always get RTCP packets (never?), so the earlier
timestamping code never wrote anything into pkt->pts. The rtpdec_asf
depacketizer just sets the dts of the packet, so if the generic RTP
timestamping is used, too, we get inconsistent timestamps.

Therefore, skip the generic RTP timestamp algorithm if the depacketizer
already has set something.

This fixes "Invalid timestamps" warnings, present since SVN rev 26187.

Originally committed as revision 26241 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-06 11:33:06 +00:00
Martin Storsjö 3a1cdcc798 rtpdec: Emit timestamps for packets before the first RTCP packet, too
Emitted timestamps in each stream start from 0, for the first received
RTP packet. Once an RTCP packet is received, that one is used for
sync, emitting timestamps that fit seamlessly into the earlier ones.

Originally committed as revision 26187 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-01 22:27:16 +00:00
Martin Storsjö bbd8f5477d rtsp: Don't set the RTP time base from the sample rate if no sample rate is set
This also reverts SVN rev 26016, which incorrectly overwrote the time base
with 90 kHz for all streams, regardless of what was set by the SDP parsing.

The stream that triggered the fix in 26016 still works after this commit.

Originally committed as revision 26022 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-15 21:06:25 +00:00
Luca Barbato a4a3bade0a Reinstate default time_base for rtp streams
The generic default is 0/0 and that obviously triggers once the value is used.

Originally committed as revision 26016 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-15 17:16:37 +00:00
Martin Storsjö 86b6e387cc rtsp/rtpdec: Set the AVStream time_base directly in rtsp when it is known
This fixes cases where the RTP time base and the sample rate of the stream
differ. Previously, the AVStream time_base was unconditionally set to
the sample rate (which initially was set to one value when parsing the
rtpmap field in the SDP, but later overridden by an a=SampleRate field).

Additionally, this makes the code actually use the stream time base set
in rtpmap for video codecs, instead of hardcoding it to always be 90 kHz.

Originally committed as revision 25908 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-07 13:29:44 +00:00
Martin Storsjö 2eeefe205f rtpdec: Handle MP3 in RealRTSP
This fixes playback of a RealRTSP/MP3 URL from the RTSP samples on
MultimediaWiki.

Originally committed as revision 25906 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-07 13:28:13 +00:00
Martin Storsjö 4838cdab21 rtpdec: Skip padding bytes at the end of packets
Originally committed as revision 25896 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-06 12:43:38 +00:00
Martin Storsjö 1e515c4280 rtpdec: Add functions for finding depacketizers by name or payload id
Originally committed as revision 25891 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-05 19:39:50 +00:00
Martin Storsjö 35014efcc6 rtpdec: Add a dynamic payload handler for the x-Purevoice format, RFC 2658
This fixes roundup issue 2390.

Originally committed as revision 25889 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-05 19:37:45 +00:00
Martin Storsjö 946df0598b rtpdec: Return AVERROR(EAGAIN) for mpegts parsing errors
This indicates that there was no error that needs to be reported to the
caller, so we can move on to parse the next packet immediately, if
available. The only error code that ff_mpegts_parse_packet can return
indicates that there was no packet to return from the provided data, for
which it returns -1.

Originally committed as revision 25496 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-15 21:32:21 +00:00
Martin Storsjö 65cdee9c95 rtpdec: Don't use the no reordering codepath if there already is a queue
Originally committed as revision 25462 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-13 08:47:34 +00:00
Martin Storsjö ddcf841191 rtpdec: Handle wrapping seq numbers in has_next_packet properly
Originally committed as revision 25461 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-13 08:15:39 +00:00
Martin Storsjö d678a6fd82 rtpdec: Parse the next packet in the sequence if it is available, if the previous packet didn't return any data
Originally committed as revision 25460 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-13 08:14:30 +00:00
Martin Storsjö 91ec7aea20 rtpdec: Return AVERROR(EAGAIN) if out of data for mpegts, pass returned error codes through
Originally committed as revision 25459 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-13 08:13:53 +00:00
Martin Storsjö f6e138b4f4 rtpdec: Don't call the depacketizer to return more data unless it actually said it has more data
It may have returned a negative number for an error (e.g. AVERROR(EAGAIN),
if more data is required for it to be able to return a complete packet).

Originally committed as revision 25458 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-13 08:13:07 +00:00
Martin Storsjö 4ffff36751 rtpdec: Split out storing of the depacketization return value to a separate function
This makes the code less fragile and easier to understand.

Originally committed as revision 25457 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-13 08:12:23 +00:00
Martin Storsjö b7952ed184 rtpdec: Set prev_ret properly when parsing more data from mpegts RTP packets
Originally committed as revision 25404 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-08 08:40:08 +00:00
Martin Storsjö 45658b7414 rtpdec: Store the previous return value for mpegts when it was -1, too
Originally committed as revision 25403 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-08 07:28:17 +00:00
Robert Schlabbach 243ac3fdaa rtpdec: Keep track of the previous return value from rtp_parse_packet_internal for mpegts packets
Patch by Robert Schlabbach, robert_s at gmx dot net

Originally committed as revision 25402 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-08 07:26:42 +00:00
Robert Schlabbach 9446b4bbbc rtpdec: Handle RTP header extension
This fixes roundup issue 2270.

Patch by Robert Schlabbach, robert_s at gmx dot net

Originally committed as revision 25372 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-06 16:59:14 +00:00
Martin Storsjö 3ece3e4c56 Add RTP depacketization of the X-QT QuickTime format
Originally committed as revision 25371 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-06 12:42:18 +00:00
Martin Storsjö 58ee09911e rtpdec: Reorder received RTP packets according to the seq number
Reordering is enabled only when receiving over UDP.

Originally committed as revision 25294 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-01 17:50:24 +00:00
Martin Storsjö 0260741876 rtpdec: Split out the part of rtp_parse_packet that does the parsing of new packets
Originally committed as revision 25293 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-01 17:46:10 +00:00
Martin Storsjö ad4ad27fb6 rtsp/rtpdec: Allow rtp_parse_packet to take ownership of the packet buffer
Do the same change for ff_rdt_parse_packet, too, to keep the interfaces
similar.

Originally committed as revision 25289 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-01 17:43:27 +00:00
Martin Storsjö 0048a2a8d3 Handle G.722 in RTP, and all the exceptions mandated in RFC 3551
Originally committed as revision 25125 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-09-15 17:35:39 +00:00
Josh Allmann b20359f51a rtsp: Return AVERROR_EOF when all streams have received an RTCP BYE packet
Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 24965 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-29 10:25:16 +00:00
Josh Allmann 682d28a965 Reindent
Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 24964 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-29 10:20:18 +00:00
Josh Allmann ff328c0225 rtpdec: Read RTCP compound packets
Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 24963 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-29 10:19:44 +00:00