Commit Graph

20793 Commits

Author SHA1 Message Date
Gyan Doshi cfe1a9d311 avformat/segafilm - fix keyframe detection and set packet flags
Streams from a Segafilm cpk file can't be streamcopied because
keyframe flag isn't correctly set in stream index and
said flag is never conveyed to the packet

Fixes #7091

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-26 16:03:13 -03:00
James Almer 3eff98c927 avformat/rtpenc_chain: use the proper function to free AVFormatContext
Fixes ticket #7075

Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-26 00:52:39 -03:00
Michael Niedermayer eb60b9d3aa avformat/mov: Move +1 in check to avoid hypothetical overflow in add_ctts_entry()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-26 02:16:48 +02:00
Jan Ekström 5b31dd1c6b avformat/hlsenc: use stream's maximum bit rate as fall-back advertised rate
Enables having proper bit rate values being written into the master
playlist in case of hard-constrained VBR where the maximum bit
rate utilized is known before hand.

Does the same thing as movenc.c, for example.

Signed-off-by: Jan Ekström <jan.ekstrom@aminocom.com>
2018-03-25 01:07:10 +02:00
Sasi Inguva 829aebf95d lavf/utils.c: Don't compute start_time from DISCARD packets for video.
Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-24 03:11:08 +01:00
Courtland Idstrom 65616bc191 lavf/movenc: write track title metadata for mov files
Track title (atom 'name') is a well defined user data atom for mov files. Existing code (for mp4) only writes title metadata if present.

Relevant reference docs:

  https://developer.apple.com/library/content/documentation/QuickTime/Reference/QTRef_AtomsResources/Content/QTRef_AtomsResources4.html#//apple_ref/doc/uid/TP40004285-DontLinkChapterID_1--udta-
  https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-63839
2018-03-22 20:59:16 +02:00
Bela Bodecs 1b45e6db22 avformat/unix: fix handling of EOF in case of SOCK_STREAM.
When recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
this patch returns value accordingly.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
2018-03-21 19:02:06 +01:00
Michael Niedermayer 9e67447a4f avformat/mov: Check STSC and remove invalid entries
Fixes assertion failure
Fixes: crbug 822547, crbug 822666 and crbug 823009

Affects: aark15sd_9A62E2FA.mp4

Found-by: ClusterFuzz
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
Jörn Heusipp f6ea397d0a avformat/libopenmpt: Probe file format from file data if possible
When building with libopenmpt 0.3, use the libopenmpt file header
probing functions for probing. libopenmpt probing functions are
allocation-free and designed to be as fast as possible.

For libopenmpt 0.2, or when libopenmpt 0.3 file header probing cannot
probe successfully due to too small probe buffer, test the filename
against the file extensions supported by the libopenmpt library that
is actually linked, instead of relying on a hard-coded file extension
list. File extension testing is also allocation-free and designed to
be fast in libopenmpt. Avoiding a hard-coded file extension list is
useful because later libopenmpt versions will likely add support for
more module file formats.

libopenmpt file header probing is tested regularly against the FATE
suite and other diverse file collections by libopenmpt upstream in
order to avoid false positives.

FATE passes with './configure --enable-libopenmpt' as well as with
'./configure --enable-libopenmpt --enable-libmodplug'.

libopenmpt probing adds about 5%..10% cpu time (depending on precise
usage pattern and host CPU and compiler version used for libopenmpt)
compared to all current internal FFmpeg probing functions combined in
tools/probetest for all of its module formats combined (currently 41
modules formats in libopenmpt 0.3.4 and 234 file formats in FFmpeg).

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
Jörn Heusipp 81b0d591d6 avformat/libopenmpt: Update file extensions list for libopenmpt 0.3
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
wm4 b7d842c554 http: fix potentially dangerous whitespace skipping code
If the string consists entirely of whitespace, this could in theory
continue to write '\0' before the start of the memory allocation. In
practice, it didn't really happen: the generic HTTP header parsing code
already skips leading whitespaces, so the string is either empty, or
consists a non-whitespace. (The generic code and the cookie code
actually have different ideas about what bytes are whitespace: the
former uses av_isspace(), the latter uses WHITESPACES. Fortunately,
av_isspace() is a super set of the http.c specific WHITESPACES, so
there's probably no case where the above assumption could have been
broken.)
2018-03-18 12:36:24 +01:00
wm4 c0687acbf6 http: avoid out of bound accesses on broken Set-Cookie headers
It's trivial to craft a HTTP response that will make the code for
skipping trailing whitespace access and possibly overwrite bytes outside
of the memory allocation. Why this can happen is blindingly obvious: it
accesses cstr[strlen(cstr)-1] without checking whether the string is
empty.
2018-03-18 12:36:24 +01:00
wm4 39c1d170a3 http: do not print a warning message for expired cookies
libavformat prints a warning that the cookie couldn't be parsed (see
callers of parse_cookie()). This is obviously not true - it could be
parsed, but was simply ignored. Don't return an error to avoid the
warning.
2018-03-18 12:36:24 +01:00
Steven Liu f19b0c6aee avformat/hlsenc: reindent after previous commits
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:17 +08:00
Steven Liu c8f625f529 avformat/hlsenc: fix fmp4 single init file problem
fix ticket: #7021

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:17 +08:00
Steven Liu c608669264 avformat/hlsenc: fix memleak problem about fmp4_init_filename
move fmp4_init_filename init in if else for first fmp4_init_filename set
value operation.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:17 +08:00
Steven Liu 10a0436dca avformat/hlsenc: reindent after previous commits
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:09 +08:00
Steven Liu a92ca3c07c avformat/hlsenc: fix write wrong init file URI string problem
fmp4_init_filename should append after base_output_dirname

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:05 +08:00
Rodger Combs 08e0f45cc8 lavf/dashenc: remove unneeded call to dash_free 2018-03-18 12:36:59 +05:30
Ravindra 99230b7ef8 libavformat/dashenc: Option to set timeout for socket I/O operation 2018-03-18 12:36:28 +05:30
James Almer 86c7d8df95 avformat/codec2: don't include avcodec objects
They belong in avcodec.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-17 17:20:25 -03:00
James Almer 935a9986fc avformat/movenc: move the concatenated eac3 packet reference
Simplifies code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-15 20:37:33 -03:00
sanilraut 1dd7bb9784 avformat/dashdec: Correct spelling mistakes
Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
2018-03-15 11:36:20 -08:00
Ravindra 6010537956 avformat/hlsenc: Option to set timeout for socket I/O operation
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-14 19:59:34 +08:00
Philipp M. Scholl 040b28aecc avformat/pcm: decrease delay when reading PCM streams.
Thanks for the discussion. Here's the next version, now with /25 and removed
ff_log2().

  The blocksize of the PCM decoder is hard-coded. This creates
unnecessary delay when reading low-rate (<100Hz) streams. This creates
issues when multiplexing multiple streams, since other inputs are only
opened/read after a low-rate input block was completely read.

 This patch decreases the blocksize for low-rate inputs, so
approximately a block is read every 40ms. This decreases the startup
delay when multiplexing inputs with different rates.

Signed-off-by: Philipp M. Scholl <pscholl@bawue.de>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-13 01:34:42 +01:00
Vishwanath Dixit 9c249110ea avformat/hlsenc: fix for zero EXTINF tag duration
This is the fix for bug https://trac.ffmpeg.org/ticket/7073

Tested-by: Brainiarc7
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-12 23:17:58 +08:00
Michael Niedermayer 2f37082827 avformat/mov: Fix integer overflows related to sample_duration
Fixes: runtime error: signed integer overflow: -9166684017437101870 + -2495066639299164439 cannot be represented in type

Fixes: Chromium bug 791349

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-12 01:32:42 +01:00
Sasi Inguva 43205df645 lavf/mov.c: Use the correct offset to shift timestamp when seeking.
Fixes seek for files with empty edits and files with negative ctts
(dts_shift > 0). Added fate samples and tests.

Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 17:55:50 +01:00
Michael Niedermayer a6cba06205 avformat/img2dec: fix infinite loop
Fixes: kira-poc

Found-by: Kira <kira_cxy@foxmail.com>
Change suggested by Kira
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Michael Niedermayer f655ddfb47 avformat/oggparsedaala: Do not adjust AV_NOPTS_VALUE
Fixes: potential signed integer overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Michael Niedermayer 3e7c847aaf avformat/oggparseogm: Check lb against psize
No testcase, this was found during code review

Found-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Michael Niedermayer 010b7b30b7 avformat/oggparseogm: Fix undefined shift in ogm_packet()
Fixes: shift exponent 48 is too large for 32-bit type 'int'
Fixes: Chromium bug 786793
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Michael Niedermayer 06e092e781 avformat/avidec: Fix integer overflow in cum_len check
Fixes: signed integer overflow: 3775922176 * 4278190080 cannot be represented in type 'long'
Fixes: Chromium bug 791237

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Michael Niedermayer 02ecda4aba avformat/oggparsetheora: Do not adjust AV_NOPTS_VALUE
Fixes: Chromium bug 795653
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Marton Balint cf5ffe0183 avformat/mxfdec: do not allow more partitions than INT_MAX/2
Some math (e.g: partition binary search) overflows if we have that many
parititions.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 20:37:49 +01:00
Marton Balint 90756e67a0 avformat/mxfdec: use binary search in mxf_absolute_bodysid_offset
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 20:37:49 +01:00
Marton Balint 3aaf97e773 avformat/mxfdec: fix opAtom audio demuxing
Consider edit rate when determining edit_units_per_packet and also make sure
that checks are done in edit rate time base and not in stream time base.

Fixes some errors reported with the sample in ticket #5863.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 20:37:49 +01:00
James Almer c4cee26129 avformat/mov: print the projection type when reporting it as unsupported
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-09 12:17:53 -03:00
Xiaohan Wang 3386be16d5 ffmpeg: Fix stts_data memory allocation
In this loop, |i| is the "index". And the memory allocated should be at
least the current "count", which is |i + 1|.

BUG=801821

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-09 02:39:21 +01:00
Aurelien Jacobs 88508a87a5 sbc: add raw muxer for SBC 2018-03-07 22:26:53 +01:00
Aurelien Jacobs 2e08de0815 sbc: add raw demuxer for SBC 2018-03-07 22:26:53 +01:00
Michael Niedermayer 1b1362e408 avformat/utils: Fix integer overflow of fps_first/last_dts
Fixes: runtime error: signed integer overflow: 7738135736989908991 - -7898362169240453118 cannot be represented in type 'long'
Fixes: Chromium bug 796778
Reported-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 20:37:33 +01:00
Michael Niedermayer da069e9c68 avformat/oggdec: Fix metadata memleak on multiple headers
Fixes: Chromium bug 800123
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 20:37:33 +01:00
Michael Niedermayer 3934aa495d libavformat/oggparsevorbis: Fix memleak on multiple headers
Fixes: Chromium bug 800123
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 20:37:33 +01:00
Michael Niedermayer 367929bed9 avformat/mov: Fix integer overflow in mov_get_stsc_samples()
Fixes: runtime error: signed integer overflow: 5 * -2147483647 cannot be represented in type 'int'
Fixes: Chromium bug 817338
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Reported-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 20:37:33 +01:00
Michael Niedermayer 5735a390a6 avformat/internal: Document the freeing behavior of ff_alloc_extradata()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 20:37:33 +01:00
James Almer a43e9cdd44 avformat/isom: don't free extradata before calling ff_get_extradata()
ff_get_extradata() frees any existing extradata before allocating now,
and using av_free() here leaves a dangling pointer that will result in
a double free.

Fixes a regression since 0ca33b1d4e.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-06 23:41:32 -03:00
Stefan _ 7c39305a17 libavformat/tls_libtls: pass numeric hostnames to tls_connect_cbs()
Numeric hosts in certificates are not very common, but supported by LibreSSL.
Forward the IP address to make verification work in this case.

Fixes ticket #7029
2018-03-07 02:06:09 +02:00
James Almer 2aa42fac77 avformat/utils: simplify ff_alloc_extradata()
Cosmetic refactor

Reviewed-by: 74a2fa708af88d225ed708af758f236f869b1a57
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-06 19:13:46 -03:00
James Almer 0ca33b1d4e avformat/utils: free existing extradata before trying to allocate a new one
This prevents leaks in the rare cases the function is called when extradata
already exists.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-06 19:13:12 -03:00