Commit Graph

81378 Commits

Author SHA1 Message Date
Anssi Hannula 04964ac311 avformat/hls: Fix missing streams in some cases with MPEG TS
HLS demuxer calls the subdemuxer avformat_find_stream_info() while
overriding the subdemuxer AVFMTCTX_NOHEADER flag by clearing it.
However, this prevents some streams in some MPEG TS streams from being
detected properly.

Simply removing the clearing of the flag would cause the inner
avformat_find_stream_info() call to take longer in some cases, without
a way to control it.

To fix the issue, do not clear the flag but propagate it to HLS demuxer.
To avoid the above-mentioned mandatory delay, the call to
avformat_find_stream_info() is dropped except in the HLS ID3 timestamped
case. The HLS demuxer user should be calling avformat_find_stream_info()
on the HLS demuxer if it wants to find the stream info.

The main streams are now created dynamically after read_header time if
the subdemuxer uses AVFMTCTX_NOHEADER (mpegts).

Subdemuxer avformat_find_stream_info() is still called for the HLS ID3
timestamped case as the HLS demuxer needs to know the packet durations
to properly interleave ID3 timestamped streams with MPEG TS streams on
sub-segment level.

Fixes ticket #4930.
2016-07-28 01:24:57 +03:00
Anssi Hannula 83db3c84fa avformat/hls: Move stream propagation to a separate function
Creation of main demuxer streams from subdemuxer streams is moved to
update_streams_from_subdemuxer() which can be called repeatedly.

There should be no functional changes.
2016-07-28 01:24:57 +03:00
Anssi Hannula 9884f17e34 avformat/hls: Use an array instead of stream offset for stream mapping
This will be useful when the amount of streams per subdemuxer is not
known at hls_read_header time in a following commit.
2016-07-28 01:24:57 +03:00
Anssi Hannula 4d85069e5d avformat/hls: Sync starting segment across variants on live streams
This will avoid a large time difference between variants in the most
common case.
2016-07-28 01:24:57 +03:00
Anssi Hannula 9cb30f7a88 avformat/hls: Fix regression with ranged media segments
Commit 81306fd4bdf ("hls: eliminate ffurl_* usage", merged in d0fc5de3a6)
changed the hls demuxer to use AVIOContext instead of URLContext for its
HTTP requests.

HLS demuxer uses the "offset" option of the http demuxer, requesting
the initial file offset for the I/O (http URLProtocol uses the "Range:"
HTTP header to try to accommodate that).

However, the code in libavformat/aviobuf.c seems to be doing its own
accounting for the current file offset (AVIOContext.pos), with the
assumption that the initial offset is always zero.

HLS demuxer does an explicit seek after open_url to account for cases
where the "offset" was not effective (due to the URL being a local file
or the HTTP server not obeying it), which should be a no-op in case the
file offset is already at that position.

However, since aviobuf.c code thinks the starting offset is 0, this
doesn't work properly.

This breaks retrieval of ranged media segments.

To fix the regression, just drop the seek call from the HLS demuxer when
the HTTP(S) protocol is used.
2016-07-28 01:24:57 +03:00
Anssi Hannula 60873bf992 avformat/utils: Fix find_stream_info not considering the extradata it found
Commit 9200514ad8 ("lavf: replace AVStream.codec with
AVStream.codecpar") merged in commit 6f69f7a8bf changed
avformat_find_stream_info() to put the extradata it got from
st->parser->parser->split() to st->internal->avctx instead of st->codec
(extradata in st->internal->avctx will be later copied to st->codecpar).

However, in the same function, the "is stream ready?" check was changed
to check for extradata in st->codecpar instead of st->codec, even
though st->codecpar is not yet updated at that point.

Extradata retrieved from split() is therefore not considered anymore,
and avformat_find_stream_info() will therefore needlessly continue
probing in some cases.

Fix that by checking for the extradata at st->internal->avctx where it
is actually put.
2016-07-28 01:24:57 +03:00
Burt P c26305f6ae af_hdcd: Add counter for cdt expirations
Adds a counter for when the "code detect timer" expired without
finding a valid packet.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 23:09:45 +02:00
Burt P c7ba34b6ea af_hdcd: more comments in state struct
Add some comments describing the fields in hdcd_state_t.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 23:09:26 +02:00
Burt P 91854b8ef6 af_hdcd: Improve HDCD detection
HDCD is now only considered detected if a valid packet
is active in both channels simultaneously.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 22:21:43 +02:00
Burt P bfe9155aee fate: Add HDCD filter tests for false positive and error detection
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 22:21:43 +02:00
Michael Niedermayer 8385e1718e avcodec/h264_slice: Make setup_finished check cover more cases 2016-07-27 19:29:55 +02:00
Xinzheng Zhang ad14aab3b4 avformat/flvdec: parse keyframe before a\v stream was created add_keyframes_index() when stream created or keyframe parsed
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 19:29:55 +02:00
Xinzheng Zhang cd141e71bd avformat/flvdec: splitting add_keyframes_index() out from parse_keyframes_index()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 19:29:55 +02:00
Clément Bœsch 6c41eda18e Merge commit 'debca90863e4ee53447efd02483c500f89766384'
* commit 'debca90863e4ee53447efd02483c500f89766384':
  h264: store {curr,max}_pic_num in the per-slice context

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-27 18:07:30 +02:00
Clément Bœsch 87d1f82059 Merge commit 'f966498e433fead2f5e6b5b66fad2ac062146d22'
* commit 'f966498e433fead2f5e6b5b66fad2ac062146d22':
  h264: decode the poc values from the slice header into the per-slice context

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-27 17:31:18 +02:00
Clément Bœsch f8ce1e8282 lavc/h264_slice: adjust a few line breaks to reduce diff with Libav 2016-07-27 17:24:48 +02:00
Clément Bœsch 78c7197ea0 Merge commit '54dd9b1cdd9e54f1ee39ae25af0324f8aba2831b'
* commit '54dd9b1cdd9e54f1ee39ae25af0324f8aba2831b':
  h264: set mb_aff_frame in frame_start()
  h264: move the block starting a new field out of slice_header_parse()

Both commits are merged at the same time in order to prevent a
regression with Ticket #4440 (see 38660128).

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-27 17:00:14 +02:00
Matthieu Bouron 376d8fb2c5 lavc/ffjni: replace ff_jni_{attach,detach} with ff_jni_get_env
If a JNI environment is not already attached to the thread where the
MediaCodec calls are made the current implementation will attach /
detach an environment for each MediaCodec call wasting some CPU time.

ff_jni_get_env replaces ff_jni_{attach,detach} by permanently attaching
an environment (if it is not already the case) to the current thread.
The environment will be automatically detached at the thread destruction
using a pthread_key callback.

Saves around 5% of CPU time (out of 20%) while decoding a stream with
MediaCodec.
2016-07-27 15:43:39 +02:00
Martin Storsjö 293676c476 libopenh264: Support building with the 1.6 release
This fixes trac issue #5417.

This is cherry-picked from libav commit
d825b1a530.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-07-27 10:19:46 +03:00
Martin Storsjö c5d326f551 Add an OpenH264 decoder wrapper
This is cherrypicked from libav, from commits
82b7525173 and
d0b1e6049b.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-07-27 10:19:40 +03:00
James Almer 54a0a52be1 checkasm/vp9dsp: use declare_func_emms in check_loopfilter
Fixes checkasm failures on mmxext functions

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-26 22:16:21 -03:00
dericed 461073e809 ffprobe.xsd: add missing timecode attribute to frameSideDataType
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 00:42:13 +02:00
Josh de Kock c2fcf4fa0b avdev/jack: remove duplicated dispatch macros
The macros were moved to compat/dispatch_semaphore/semaphore.h after a libav merge, and were never removed from jack.c
2016-07-26 23:10:47 +01:00
Ronald S. Bultje a4edaa0270 vp9: add mxext versions of the single-block (w=8,npx=8) h/v loopfilters.
Each takes about 0.1% of runtime in my profiles, and they didn't have
any SIMD yet so far (we only had simd for npx=16 double-block versions).
2016-07-26 15:59:07 -04:00
Ronald S. Bultje 7ca422bb1b vp9: add mxext versions of the single-block (w=4,npx=8) h/v loopfilters.
Each takes about 0.5% of runtime in my profiles, and they didn't have
any SIMD yet so far (we only had simd for npx=16 double-block versions).
2016-07-26 15:59:07 -04:00
Ronald S. Bultje 726501a34e vp9: add 32x32 idct AVX2 implementation.
About 1.8x speedup compared to AVX version for full IDCT. Other
sub-IDCT scenarios also see speedups. Full --bench output for
idct_32x32_add_{bpp}_${subidct}_${opt} (50k cycles):

nop: 16.5
vp9_inv_dct_dct_32x32_add_8_1_c: 2284.4
vp9_inv_dct_dct_32x32_add_8_1_sse2: 145.0
vp9_inv_dct_dct_32x32_add_8_1_ssse3: 137.4
vp9_inv_dct_dct_32x32_add_8_1_avx: 137.1
vp9_inv_dct_dct_32x32_add_8_1_avx2: 73.2
vp9_inv_dct_dct_32x32_add_8_2_c: 14680.8
vp9_inv_dct_dct_32x32_add_8_2_sse2: 2617.2
vp9_inv_dct_dct_32x32_add_8_2_ssse3: 982.9
vp9_inv_dct_dct_32x32_add_8_2_avx: 958.5
vp9_inv_dct_dct_32x32_add_8_2_avx2: 704.2
vp9_inv_dct_dct_32x32_add_8_4_c: 14443.1
vp9_inv_dct_dct_32x32_add_8_4_sse2: 2717.1
vp9_inv_dct_dct_32x32_add_8_4_ssse3: 965.7
vp9_inv_dct_dct_32x32_add_8_4_avx: 1000.7
vp9_inv_dct_dct_32x32_add_8_4_avx2: 717.1
vp9_inv_dct_dct_32x32_add_8_8_c: 14436.4
vp9_inv_dct_dct_32x32_add_8_8_sse2: 2671.8
vp9_inv_dct_dct_32x32_add_8_8_ssse3: 1038.5
vp9_inv_dct_dct_32x32_add_8_8_avx: 983.0
vp9_inv_dct_dct_32x32_add_8_8_avx2: 729.4
vp9_inv_dct_dct_32x32_add_8_16_c: 14614.7
vp9_inv_dct_dct_32x32_add_8_16_sse2: 2701.7
vp9_inv_dct_dct_32x32_add_8_16_ssse3: 1334.4
vp9_inv_dct_dct_32x32_add_8_16_avx: 1276.7
vp9_inv_dct_dct_32x32_add_8_16_avx2: 719.5
vp9_inv_dct_dct_32x32_add_8_32_c: 14363.6
vp9_inv_dct_dct_32x32_add_8_32_sse2: 2575.6
vp9_inv_dct_dct_32x32_add_8_32_ssse3: 2633.9
vp9_inv_dct_dct_32x32_add_8_32_avx: 2539.6
vp9_inv_dct_dct_32x32_add_8_32_avx2: 1395.0
2016-07-26 15:59:07 -04:00
Clément Bœsch c6e900e925 lavfi/curves: fix meaningless const int returned value
Spotted-by: James Almer <jamrial@gmail.com>
2016-07-26 21:22:27 +02:00
Luca Barbato e85d38c20a librtmp: Avoid an infiniloop setting connection arguments
The exit condition was missing.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-07-26 12:05:29 -07:00
James Almer be04c4aa00 avformt/matroskaenc: undo an accidental revert by commit 5d48e4ea
Commit 5d48e4eafa accidentally reverted changes
made to matroskaenc by commit 989a614b70.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-26 15:22:32 -03:00
Dmitry Vagin dc151d138c ffprobe: add missing PROGRAM_STREAM_TAGS case
ffprobe did not show tags with only '-show_entries programs'

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-26 19:22:47 +02:00
James Almer fb91850fe1 avutil/frame: access avframe fields directly in get_frame_defaults()
The accessors are needed only from outside libavutil.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-25 17:37:18 -03:00
Josh de Kock 384251daff lavd/libdc1394: distinguish between enumeration errors and no cameras found
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-25 19:39:13 +02:00
Kacper Michajłow e947b75b1c libavformat/rtpdec_asf: zero initialize the AVIOContext struct
This fixes crash in avformat_open_input() when accessing
protocol_whitelist field.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-25 19:39:13 +02:00
James Almer 0c75bd8e3c avcodec/dnxhddata: move avpriv_dnxhd_parse_header_prefix to a header
It's a small and simple function that can be inlined.

This removes one private symbol and should reduce object dependencies with the next
major bump

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-25 12:19:39 -03:00
James Almer 26cb7232c3 Revert "lavc: always build dnxhddata"
This reverts commit 2adbea4e21.

A better solution will follow in the next commit.
2016-07-25 12:19:31 -03:00
Carl Eugen Hoyos 71167f7f84 lavc/Makefile: Fix standalone compilation of the svq3 decoder.
Regression since 0bf5fd2e
2016-07-24 23:50:33 +02:00
Matthieu Bouron 2adbea4e21 lavc: always build dnxhddata
lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by
dnxhddata.h since e47981dab7.

Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not
enabled.
2016-07-24 22:57:06 +02:00
Carl Eugen Hoyos 9bd35a76fc lavc/h264_ps: Be more verbose when truncating likely oversized PPS. 2016-07-24 20:21:37 +02:00
Ivan Uskov b4054100f6 Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"
This reverts commit d30cf57a7b, reversing changes made to
acc155ac55. The commit d30cf57a7b
provided irrelevant code complexity and decoding slowdown. But the main disadvantage of this
commit is a decoder crash. So it should be reverted.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 18:36:26 +02:00
Clément Bœsch 308f9b1c49 lavfi/selectivecolor: add 16-bit support 2016-07-24 15:29:37 +02:00
Clément Bœsch b8aaedcd01 lavfi/selectivecolor: fix picking black as neutral when alpha is present 2016-07-24 14:21:50 +02:00
Mark Reid 6108cb2ce3 tests/fate: add dnxhr encoding tests
added sws_flags flags and tested against x86_32

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 12:31:07 +02:00
Clément Bœsch 6e971f7d66 lavfi: bump minor after recent curves filter additions 2016-07-24 12:22:41 +02:00
Clément Bœsch b470d81f4e lavfi/curves: prefix init and uninit function names 2016-07-24 12:18:30 +02:00
Clément Bœsch 62a31aecf6 lavfi/curves: pass log ctx as void* instead of AVFilterContext* 2016-07-24 12:18:30 +02:00
Clément Bœsch 39c6d4a8c5 lavfi/curves: reindent after previous commit 2016-07-24 12:18:30 +02:00
Clément Bœsch e30cdac14b lavfi/curves: add 16-bit support 2016-07-24 12:18:30 +02:00
Clément Bœsch f19f5b906d lavfi/curves: move alloc and init of LUTs inside config_input()
This is needed in order to have different sizes of LUTs according to the
input.
2016-07-24 12:18:30 +02:00
Clément Bœsch 050f790594 lavfi/curves: dynamically allocate LUTs
This simplifies following commits.
2016-07-24 12:18:30 +02:00
Clément Bœsch 4eee06ae87 lavfi/curves: add various const where it makes sense 2016-07-24 12:18:30 +02:00