1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

21847 Commits

Author SHA1 Message Date
Steven Liu
9f0b9ae8bd avformat/iff: fix memleak when get st->codecpar->extradata failed in iff_read_header
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-10 09:54:48 +08:00
Steven Liu
6f84c1e907 avformat/jvdec: fix memleak when read_header failed
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-10 09:54:42 +08:00
Raphaël Zumer
9d92403add avformat/ivfdec: Change the length field to 32 bits
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:45:00 -04:00
Raphaël Zumer
d3807467b2 avformat/ivfenc: Change the length fields to 32 bits
There is no change in the encoded bitstream, but this
ensures that the written field length is consistent
with the reference implementation.

Unused bytes are zeroed out for backwards compatibility.

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:44:41 -04:00
Raphaël Zumer
eeb1c515a8 avformat/ivfenc: Comment the length field encoding process
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:44:36 -04:00
Michael Niedermayer
9a0d36e562 avformat/mpsubdec: Clear queue on error
Fixes: Memleaks
Fixes: 17219/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5720539124989952

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-08 16:24:58 +02:00
Andreas Rheinhardt
ffb32d35ee avformat/mpeg: Remove set-but-unused variable
Forgotten in 7da57875.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-10-08 10:41:43 +02:00
vectronic
e149be38a8 avformat/hls: fix missing segment offset reset on last segment when http_multiple is enabled.
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:58:47 +08:00
vectronic
b21c5ef501 avformat/hls: pass http offset options to http request
made with persistent connections to prevent incorrect reset of
offset when demuxing HLS+FMP4

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:57:53 +08:00
vectronic
e81c686a95 avformat/http: add ff_http_do_new_request2 for options
add ff_http_do_new_request2() which supports options to be applied to
HTTPContext after initialisation with the new uri

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:57:44 +08:00
Limin Wang
afab93ccd0 avformat/hlsenc: replace with av_freep for all av_free
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:56 +08:00
Limin Wang
28bb73cee7 avformat/hlsenc: replace with av_dirname to get the directory
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:53 +08:00
Limin Wang
61aa77272a avformat/hlsenc: remove the unnecessary null pointer check
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:49 +08:00
Steven Liu
8c16c133d0 avformat/mms: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:47:16 +08:00
Steven Liu
cdf8253a06 avformat/mmst: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:47:12 +08:00
Steven Liu
4ff97342ce avformat/network: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:47:07 +08:00
Steven Liu
17236a2c40 avformat/avidec: add logging context to log
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:58 +08:00
Steven Liu
35236fd729 avformat/rtmpptoto: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:53 +08:00
Steven Liu
5db50dbf06 avformat/udp: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:42 +08:00
Steven Liu
db99b32a1b avformat/hlsenc: add logging context to log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-08 13:46:32 +08:00
Andreas Rheinhardt
69dd8d3a2a avformat/flac_picture: Avoid allocation of AVIOContext
Put an AVIOContext whose lifetime doesn't extend beyond the function
where it is allocated on the stack instead of allocating and freeing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-10-07 22:27:17 +02:00
Michael Niedermayer
81b53913bb avformat/subtitles: Check nb_subs in ff_subtitles_queue_finalize()
Fixes: null pointer dereference
Fixes: 17828/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5645915116797952
Fixes: Ticket8147

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-06 20:00:59 +02:00
Andreas Rheinhardt
670fd3b0ec avformat/mpjpegdec: Avoid allocation of AVIOContext
Put an AVIOContext whose lifetime doesn't extend beyond the function where
it is allocated on the stack instead of allocating and freeing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-06 20:00:59 +02:00
James Almer
5f758c31f9 avformat/matroskaenc: use r_frame_rate as fallback to set a track's DefaultDuration
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-06 13:44:52 -03:00
James Almer
3b4e9a31ea avformat/matroskadec: don't rescale mastering display values
Simplifies code.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-05 22:37:41 -03:00
Paul B Mahol
7da57875b5 avformat/mpeg: better fix for MLP versus PCM-DVD misdetection 2019-10-05 11:15:42 +02:00
Andreas Rheinhardt
581419ea39 avformat/matroskadec: Fix demuxing ProRes
The structure of a ProRes frame in mov/mp4 is that of a typical atom:
First a 32 bit BE size field, then a tag detailling the content. Said
size field includes the eight bytes of the atom header.

This header is actually redundant, as the size of the atom is already
known from the containing atom. It is therefore stripped away when muxed
into Matroska and so the Matroska demuxer has to recreate upon demuxing.
But it did not account for the fact that the size field includes the
size of the header and this can lead to problems when a decoder uses the
in-band size field.

Fixes ticket #8210.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-04 00:06:30 -03:00
Andreas Rheinhardt
be0d3a2df1 avformat/aiffenc: Remove wrong and redundant check
The check "if (!pb->seekable & AVIO_SEEKABLE_NORMAL)" is wrong, because
! has higher precendence than &. But it is also redundant, because this
part of the code is only ever reached when the AVIO_SEEKABLE_NORMAL flag
is set for pb. So simply remove the check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-03 19:34:23 +02:00
Andreas Rheinhardt
c694fc5759 avformat/aiffenc: Fix potential memleak upon failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-03 19:34:23 +02:00
Andreas Rheinhardt
c548b0a4c6 avformat/aiffenc: Use standard packet list functions
Up until now, aiffenc didn't rely on the standard functions for adding
an element to a linked list and freeing the list, but instead
reimplemented them. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-03 19:34:23 +02:00
Michael Niedermayer
c4de49edc4 avformat/electronicarts: If no packet has been read at the end do not treat it as if theres a packet
Fixes: Assertion failure
Fixes: 17770/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5700606668308480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-01 22:16:20 +02:00
Carl Eugen Hoyos
a650e8c8e9 lavf/avio: Print https warning also for avio_find_protocol_name().
Helps to fix ticket #8197.
2019-10-01 19:52:47 +02:00
Jun Zhao
6ca3d34ff8 lavf/utils: support duration estimate method dump
add new function duration_estimate_name to dump duration estimate
method, it's will help to debug some duration issue.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-30 10:08:45 +08:00
Jun Zhao
f5e867570e lavf/utils: Cosmetics: fix indentation for estimate_timings
fix indentation for estimate_timings when dump start_time/duartion.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-30 10:08:27 +08:00
Jun Zhao
541c635628 lavf/utils: correct the duration estimation method for nut demuxer
in fact, nut demuxer use the PTS for duration estimation.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-30 10:08:16 +08:00
Jun Zhao
12e6057fb0 lavf/nutdec: add logging context to log
Add logging context to log, it's will help debuging.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-30 10:06:21 +08:00
Jun Zhao
79597639cb lavf/utils: change the log level to warning if can't get duration
change the log level to warning if can't get duration, it's will help
to debug some duration issue

Signed-off-by: vacingfang <vacingfang@tencent.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-30 10:06:09 +08:00
Andreas Rheinhardt
9fdc2c7bc4 avformat/utils: Remove unnecessary initializations
Up until now, read_frame_internal always initialized the packet it
received. But since the recent changes to ff_read_packet, this is no
longer needed: If the parsing queue is initially empty upon entering
read_frame_internal, the packet will now either contain content upon
success or be blank upon failure of ff_read_packet. If the parsing
queue is initially not empty, the packet will be overwritten with the
oldest one from the parsing queue.

Similarly, it is unnecessary to initialize ret in read_frame_internal.

In parse_packet, it is easily possible to only initialize the packet
used as temporary storage for the output if said packet is used at all;
furthermore, this packet doesn't need to be zero-initialized, because
av_init_packet will initialize every field except size and data and
those fields will be set by av_parser_parse2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:44 -03:00
Andreas Rheinhardt
5c95af6b7c avformat/utils: Improve parsing packets
Up until now, parse_packet() used a stack packet in case the stream is
flushed. But using such a packet is unnecessary as there is an AVPacket
readily available, it just needs to be used. Whether flushing is intended
or not will now be signalled by an explicit parameter rather than by
whether the packet parameter is NULL. This removes a few checks in
parse_packet(), gets rid of the initialization of the stack packet and
also reduces usage of sizeof(AVPacket) in libavformat.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:44 -03:00
Andreas Rheinhardt
cdba00ae11 avformat/utils: Avoid copying packets unnecessarily
Up until now, read_frame_internal in avformat/utils.c uses a spare
packet on the stack that serves no real purpose: At no point in this
function is there a need for another packet besides the packet destined
for output:
1. If the packet doesn't need a parser, but is output as is, the content
of the spare packet (that at this point contains a freshly read packet)
is simply copied into the output packet (via simple assignment, not
av_packet_move_ref, thereby confusing ownership).
2. If the packet needs parsing, the spare packet will be reset after
parsing and any packets resulting from the packet read will be put into
a packet list; the output packet is not used here at all.
3. If the stream should be discarded, the spare packet will be
unreferenced; the output packet is not used here at all either.

Therefore the spare packet and the copies can be removed in principle.
In practice, one more thing needs to be taken care of: If ff_read_packet
failed, the output packet was not affected, now it is. But given that
ff_read_packet returns a blank (as if reset via av_packet_unref) packet
on failure, there is no problem from this side either.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:44 -03:00
Andreas Rheinhardt
ada02cf85f avformat/utils: Don't create unnecessary references
When AVFMT_FLAG_GENPTS is set, av_read_frame would put a reference to a
packet in the packet list (via av_packet_ref) and then immediately
thereafter unreference the original packet. This has been changed to
move the reference instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:43 -03:00
Andreas Rheinhardt
bf79e4426a avformat/utils: Fix memleaks II
Up until now, avformat_find_stream_info had a potential for memleaks:
When everything was fine, it read packets and (depending upon whether
AVFMT_FLAG_NOBUFFER was set) put them in a packet list or unreferenced
them when they were no longer needed. But upon failure, said packets
would leak if they were not already on the packet list. This patch fixes
this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:43 -03:00
Andreas Rheinhardt
47a4528abc avformat/utils: Don't initialize in loops
Since the recent changes to ff_packet_list_put, the source packet will
be automatically reset when the reference is moved to the packet list,
so that it is unnecessary to reinitialize the packet in the loops in
parse_packet and ff_read_packet; initializing once at the beginning is
enough.

This also fixes a potential, but currently unexisting problem: If the
raw packet buffer was initially not empty and probe_codec() failed,
then the packet returned would not be initialized. But given that
probe_codec() currently can't fail (always returns 0) this was not an
acute danger.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-28 18:32:43 -03:00
Ross Nicholson
460f74495f libavformat/rtsp: return error if rtsp_hd_out is null instead of crash
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-27 10:54:28 -07:00
James Almer
35bbaa6652 avformat: use avpriv_mpeg4audio_get_config2()
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-27 10:37:11 -03:00
Paul B Mahol
bb697f30ab avformat/dhav: fix demuxer since recent breakage 2019-09-27 14:25:18 +02:00
Paul B Mahol
35a12d2071 avformat/g729dec: set packet duration and correctly set timebase info
Fixes #6704.
2019-09-27 12:39:21 +02:00
Paul B Mahol
044167a171 avformat/nut: add pcm_s64 support 2019-09-27 12:15:50 +02:00
James Almer
58aa0ed8f1 aformat/movenc: add missing padding to output track extradata
Fixes ticket #8183.

Tested-by: Thierry Foucu <tfoucu@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-26 15:19:00 -03:00
Andreas Rheinhardt
646799b42f avformat/movenc: Fix undefined shift
Fixes the movenc FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-26 14:12:24 +02:00