summaryrefslogtreecommitdiff
path: root/libavformat/rtsp.c
Commit message (Collapse)AuthorAge
* rtsp: Parse SSRC attributes in the SDPMartin Storsjö2016-05-11
| | | | | | | | | | | | | When feeding input RTP packets to the depacketizer via custom IO, it needs to pick the right stream using the payload type for RTP packets, and using the SSRC for RTCP packets. If the first packet is an RTCP packet, we don't (currently) know the SSRC yet and thus can't pick the right RTP depacketizer to handle it. By parsing the SSRC attribute in the SDP, we can map initial RTCP packets to the right stream. Signed-off-by: Martin Storsjö <martin@martin.st>
* avio: Copy URLContext generic options into child URLContextsMartin Storsjö2016-03-24
| | | | | | | | | | | | | | | Since all URLContexts have the same AVOptions, such AVOptions will be applied on the outermost context only and removed from the dict, while they probably make sense on all contexts. This makes sure that rw_timeout gets propagated to the innermost URLContext (to make sure it gets passed to the tcp protocol, when opening a http connection for instance). Alternatively, such matching options would be kept in the dict and only removed after the ffurl_connect call. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* lavf: add a protocol whitelist/blacklist for file opened internallyAnton Khirnov2016-02-22
| | | | | | | | Should make the default behaviour safer for careless callers that open random untrusted files. Bug-Id: CVE-2016-1897 Bug-Id: CVE-2016-1898
* urlprotocol: receive a list of protocols from the callerAnton Khirnov2016-02-22
| | | | | This way, the decisions about which protocols are available for use in any given situations can be delegated to the caller.
* rtsp: free opts dictionary on failure of getnameinfoGanesh Ajjanagadde2015-12-07
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Log getaddrinfo failuresLuca Barbato2015-11-25
| | | | And forward the logging contexts when needed.
* rtsp: Do not assume getnameinfo cannot failLuca Barbato2015-11-25
| | | | And properly report the error when it happens.
* rtsp: Allow $ as interleaved packet indicator before a complete response headerMartin Storsjö2015-10-23
| | | | | | | | | | | | | | | Some RTSP servers ("HiIpcam/V100R003 VodServer/1.0.0") respond to our keepalive GET_PARAMETER request by a truncated RTSP header (lacking the final empty line to indicate a complete response header). Prior to 764ec70149, this worked just fine since we reacted to the $ as interleaved packet indicator anywhere. Since $ is a valid character within the response header lines, 764ec70149 changed it to be ignored there. But to keep compatibility with such broken servers, we need to at least allow reacting to it at the start of lines. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: warning when max_delay reachedEloi BAIL2015-09-16
| | | | | | | | | packets are queued due to packet reordering until the queue reach its maximal size or max delay is reached. This commit adds a warning trace when max delay is reached. Signed-off-by: Eloi BAIL <eloi.bail@savoirfairelinux.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Only interpret $ as interleaved packet indicator at the start of repliesMartin Storsjö2015-07-30
| | | | | | | | | | | | Allow $ as character anywhere within normal RTSP replies - both within the lines, and as the first character of RTSP header lines. (The existing old comment indicated that an inline packet could start at any line within a RTSP reply header, but that doesn't sound valid to me, and I'm not sure if the existing code handled that correctly either.) CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Make sure we don't write too many transport entries into a fixed-size ↵Martin Storsjö2015-04-24
| | | | | | | array CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Don't warn about unparsed time rangesMartin Storsjö2015-04-23
| | | | | | | | | | | | | | | | | | | This removes the error logging added in 4e54432164. This avoids warnings about "Invalid interval start specification 'now'" for live rtsp streams. We only try to parse some of the many valid values for time ranges in RTSP - the other ones are fully valid but not interesting for the use case in rtsp.c, so we shouldn't warn about them. (Parsing the time ranges is needed to allow seeking, but e.g. setting the current realtime clock for the start time doesn't make sense. av_parse_time has got a different mode for parsing absolute times as well, which can handle the special case "now", but that doesn't make much sense for this particular use in rtsp.c.) Signed-off-by: Martin Storsjö <martin@martin.st>
* Replace av_dlog with normal av_log at trace levelVittorio Giovara2015-04-19
| | | | This applies to every library where performance is not critical.
* rtsp: Fix unchecked return valueHimangi Saraogi2015-04-12
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Check a malloc return valueHimangi Saraogi2015-04-12
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Add a buffer_size optionLuca Barbato2015-04-01
| | | | | | And forward it to rtp and udp. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* rtpdec: Rename the free method to closeMartin Storsjö2015-02-24
| | | | | | | | | Many of these functions were named foo_free_context, and since the functions no longer should free the context itself, only allocated elements within it, the previous naming was slightly misleading. Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: Use ffio_free_dyn_buf where applicableMartin Storsjö2015-02-24
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Free depacketizers if the init function failedMartin Storsjö2015-02-24
| | | | | | | | | | | | | | This is different from how it is handled in codecs/demuxers/muxers though (where the close function isn't called if the open function failed), but since the number of depacketizers that have an .init function is quite limited, this is easy to change. The main point is that if the init function failed, we shouldn't try to use that depacketizer at all - this makes sure that the parse function doesn't need to check for the things that were initialized in the init function. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Don't free the payload context in the .free functionMartin Storsjö2015-02-24
| | | | | | | | | | | | | | This makes it more consistent with depacketizers that don't have any .free function at all, where the payload context is freed by the surrounding framework. Always free the context in the surrounding framework, having the individual depacketizers only free any data they've specifically allocated themselves. This is similar to how this works for demuxer/muxers/codecs - a component shouldn't free the priv_data that the framework has allocated for it. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Remove the now unused .alloc fieldMartin Storsjö2015-02-24
| | | | | | Always use the .priv_data_size field instead. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Allow allocating and freeing the private data without explicit functionsMartin Storsjö2015-02-24
| | | | | | This can reduce the amount of boilerplate in simple depacketizers. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Allow setting the need_parsing field in RTPDynamicProtocolHandlerMartin Storsjö2015-02-24
| | | | | | | | | | This allows getting rid of quite a bit of boilerplate in depacketizers. The default value (initializing need_parsing to 0, aka AVSTREAM_PARSE_NONE) is the same as it is initialized to by default in AVStream. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Fix the indentation of a linewrapped statementMartin Storsjö2015-02-24
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Interpret the text media type as AVMEDIA_TYPE_DATAMartin Storsjö2015-02-24
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: punch holes again after pauseGilles Chanteperdrix2015-02-23
| | | | | | | | | | | | When a client behind a NAT issues a pause command, and stay paused for a long time, the router may stop the RTP/RTCP port redirection. Resend the hole punching packets before each PLAY command to cause the router to restart the port redirection in that case. Move the existing code for sending the packets from the SETUP phase to the PLAY phase. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: parse lang attribute in SDPGilles Chanteperdrix2015-02-21
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: check ffurl_get_file_handle() return valueVittorio Giovara2014-12-18
| | | | | CC: libav-stable@libav.org Bug-Id: CID 717844
* rtsp: move the CONFIG_ macros to the beginning of the checkVittorio Giovara2014-12-02
| | | | | With --disable-optimizations, the DCE of some compilers does not remove such unused code, causing linking failure.
* lavf: Use av_gettime_relativeMartin Storsjö2014-10-24
| | | | | | | | | The ones left using av_gettime are NTP timestamps (for RTCP, which is specified to send the actual current realtime clock in RTCP SR packets), and the NUT muxer timestamper, which is documented as using wallclock time. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Check a memory allocationMichael Lynch2014-10-16
| | | | | CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Support tls-encapsulated RTSPLuca Barbato2014-10-10
|
* rtsp: Clear the session id on redirectsMartin Storsjö2014-09-24
| | | | | | | This fixes handling redirects in case the server provided a session id within the redirect reply. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Support misordered fmtp rtpmapJoshua Kordani2014-06-18
| | | | Issue present in Avigilon IP cameras.
* rtsp: Factor out fmtp parsingLuca Barbato2014-06-18
|
* rtpenc_chain: Don't copy the time base to the source stream by defaultMartin Storsjö2014-05-31
| | | | | | | | | | | | | | | Only copy it manually in the muxers where it makes sense (rtspenc, sapenc). Don't touch the original AVStream in movenchint, where the original AVStream should be kept untouched. This fixes the normal tracks in RTP hinted files after abb810db - the hint tracks were ok while the normal media tracks were broken, noticed by Michael Niedermayer. This reverts abb810db but achieves the same effect for the other muxers. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: suppress a incompatible pointer types warningVittorio Giovara2013-12-12
|
* rtspenc: Make sure BYE packets are sent before TEARDOWNMartin Storsjö2013-11-01
| | | | | | | Also make sure the BYE packets are sent at all when using TCP interleaved transport. Signed-off-by: Martin Storsjö <martin@martin.st>
* sdp: Add an option for sending RTCP packets to the source of the last packetsMartin Storsjö2013-08-14
| | | | | | | | | | | | | | | | | | | An SDP description normally only contains the target IP address and port for the packets. This means that we don't really have any clue where to send the RTCP RR packets - previously they're sent to the destination IP written in the SDP (at the same port), which rarely is the actual peer. And if the source for the packets is on a different port than the destination, it's never correct. With a new option, we can choose to send the packets to the address that the latest packet on each socket arrived from. --- Some may even argue that this should be the default - perhaps, but I'd rather keep it optional at first. Additionally, I'm not sure if sending RTCP RR directly back to the source is desireable for e.g. multicast. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Don't include the listen flag in the SDP demuxer flagsMartin Storsjö2013-08-07
| | | | | | | It's only relevant for the RTSP demuxer. Similarly, the custom_io flag is only present in the SDP demuxer options list. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Simplify code for forming the remote peer urlMartin Storsjö2013-08-01
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpproto: Move rtpproto specific function declarations to a separate headerMartin Storsjö2013-07-31
| | | | | | | Mixing these with the rtp depacketizer functions in rtpdec.h is no good. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Support RFC4570 (source specific multicast) more properly.Ed Torbett2013-07-29
| | | | | | | Add support for domain names, for multiple source addresses, for exclusions, and for session level specification of addresses. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Support multicast source filters (RFC 4570)Ed Torbett2013-07-19
| | | | | | | | | | This supports inclusion of one single IP address for now, at the media level. Specifying the filter at the session level (instead of at the media level), multiple source addresses, exclusion, or using FQDNs instead of plain IP addresses is not supported (yet at least). Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Include an User-Agent header field in all requestsMartin Storsjö2013-07-14
| | | | | | | | Some rtsp servers like the IP Cam IcyBox IB-CAM2002 need it. Based on a patch by Carl Eugen Hoyos. Signed-off-by: Martin Storsjö <martin@martin.st>
* Remove commented-out debug #define cruftDiego Biurrun2013-05-16
|
* avformat: Add AVPROBE_SCORE_EXTENSION define and use where appropriateDiego Biurrun2013-05-04
|
* avformat: Drop unnecessary ff_ name prefixes from static functionsDiego Biurrun2013-04-30
|
* lavf: Use RTP_MAX_PACKET_LENGTH instead of 1500Andrew Van Til2013-04-09
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>