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

21746 Commits

Author SHA1 Message Date
Jun Zhao
3740bdee77 lavf/avidec: fix memory leak in error handling path
free the value in error handling path to avoid the memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-10 17:21:54 +02:00
Michael Niedermayer
55d4e22d71 avformat/vividas: check for tiny blocks using alignment
Ask for a sample for these
Fixes: out of array access
Fixes: 16624/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5762455661182976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-06 22:25:35 +02:00
Carl Eugen Hoyos
aef24efb0c lavf/rawenc: Only accept the appropriate stream type for raw muxers.
This does not affect the rawvideo muxer.

Fixes ticket #7979.
2019-09-06 16:22:44 -03:00
Steven Liu
db92a3e463 avformat/hlsenc: fix compiling error of hlsenc 2019-09-06 12:47:15 +08:00
Steven Liu
fe77cad3a4 avformat/hlsenc: fix code style
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-06 12:30:04 +08:00
Steven Liu
07b4bf5f11 avformat/hlsenc: move the warning message from every segment upload to init part
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-06 12:29:56 +08:00
Steven Liu
f267a2ac9c avformat/hlsenc: avformat/hlsenc: reopen new http session for http_persistent
fix ticket: 7975

Tested-by: Ian Klassen <ian@virtualfunc.com>
Suggested-by: Ian Klassen <ian@virtualfunc.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-06 10:26:23 +08:00
Steven Liu
6c593fee63 avformat/http: add ff_http_get_shutdown_status api for check the status of shutdown
this function is used to get the previous shutdown status
when reusing the old connection in block mode.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-06 10:26:16 +08:00
Limin Wang
787c56b9e9 avformat/mxfenc: fix warning: unused function 'klv_ber_length' [-Wunused-function]
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-09-04 18:55:00 +02:00
James Almer
3b3150c45f avformat/matroskadec: use av_fast_realloc to reallocate ebml list arrays
Speeds up the process considerably.

Fixes ticket #8109.

Suggested-by: nevcairiel
Suggested-by: cehoyos
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-04 10:08:17 -03:00
James Almer
f34aabfbae avformat/matroskadec: use proper types for some EbmlSyntax fields
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-04 10:07:13 -03:00
Anthony Delannoy
39f1295937 avformat/mpegts: Check if ready on SCTE reception
On some DVB stream SCTE-35 data packet are available before the end of
MpegTSContext initialization. We have to check if it is the case to
avoid a SEGFAULT.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-03 21:35:20 +02:00
Andriy Gelman
ef43a4d6b3 avformat: Add ZeroMQ as a protocol
When ffmpeg was streaming, multiple clients were only supported by using a
multicast destination address. An alternative was to stream to a server which
re-distributes the content. This commit adds ZeroMQ as a protocol, which allows
multiple clients to connect to a single ffmpeg instance.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-02 23:08:43 +02:00
Marton Balint
f4eb7d84a7 avformat/mpegtsenc: fix flushing of audio packets
7d097a0fc5 had the same purpose as
3700f655c5 but the former is much simpler, so
let's remove the latter.

Unfortunately both checks were wrong, because in order to make sure DTS > PCR
we have to give us some headroom, so instead of using a dts_difference <
max_delay check let's use a dts_difference < max_delay/2 check.

Fixes DTS < PCR errors with this command line:

./ffmpeg -loglevel verbose -y -f lavfi -i \
  "testsrc=s=64x64:d=20,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=20,asetnsamples=1000[out2]" \
  -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact  \
  -codec:v libx264 -codec:a mp2 -b:a 32k -pix_fmt yuv420p \
  -map '0✌️0' \
  -map '0✌️1' \
  -map '0🅰️0'  \
  -muxrate 800000 \
  -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out1.ts

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-02 21:44:25 +02:00
Steven Liu
2a21487b9e avformat/dashdec: start from the root uri when baseURL is start with '/'
fix ticket: 8097

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-02 13:40:19 +08:00
Limin Wang
75aea52a10 lavf/hlsenc: refine the get_relative_url function to avoid extra malloc for relation path
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-09-02 13:28:08 +08:00
Marton Balint
ce1fcc8ced avformat/utils: return pending IO error on EOF in av_read_frame()
avio_feof() returns true both in case of actual EOF and in case of IO errors.
Some demuxers (matroska) have special handling to be able to return the proper
error for this exact reason, e.g.:

if (avio_feof(pb)) {
     if (pb->error) {
         return pb->error;
     } else {
         return AVERROR_EOF;
     }
}

However, most of the demuxers do not, and they simply return AVERROR_EOF if
avio_feof() is true, so there is a real chance that IO errors are mistaken for
EOF.

We might just say that the API user should always check the IO context error
attribute on EOF to make sure no IO errors happened, but not even ffmpeg.c does
this. It should be more intuitive to the API user if we simply return the IO
error as the return value of av_read_frame() instead of AVERROR_EOF.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-31 17:38:25 +02:00
Marton Balint
2e31774b40 avformat/avidec: add support for recognizing HEVC fourcc when demuxing
Some security cams generate this, as well as some versions of VirtualDub and
VLC so support for _reading_ such files is justified.

Fixes ticket #7110.

See also this discussion: https://patchwork.ffmpeg.org/patch/8744/

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-31 17:38:25 +02:00
Marton Balint
765c56bfa9 avformat/mpegts: fix teletext PTS when selecting teletext streams only
After a1b4f120c0 the teletext PTS values were set
to AV_NOPTS_VALUE if the stream of the PCR pid was discarded.

What actually matters is that if we parse the PCR of the PCR PID or not, so
let's use the cached discard value of the actual PCR PID instead of the stream
discard value, which may be different.

Also fixes ticket #7567, which was caused by the fact that teletext PTS values
were not touched if the PCR pid was discarded even before
a1b4f120c0.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-31 17:38:25 +02:00
Paul B Mahol
7c0b3ba7dd avcodec: add IMM5 decoder 2019-08-29 21:04:54 +02:00
Michael Niedermayer
e0c973e5be avformat/mpsubdec: Remove floating point usage
This makes the code bitexact between platforms.
Intermediate timestamps between frames are preserved.
The timebase is simplified.
Rounding differs from doubles in cases where timestamps/durations
are "funny"

Suggested-by: jb
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-29 15:14:32 +02:00
Limin Wang
ffd65c8862 lavf/dump: dump the vbv_delay with N/A instead of 18446744073709551615
How to check it:
./ffmpeg -f lavfi -i testsrc  -c:v mpeg2video  -f null  -
master:
  Side data:
        cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay:
        18446744073709551615
patch applied:
Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-28 18:18:41 +02:00
Paul B Mahol
98f5cbcb7d avformat/dsfdec: set packet pts/duration/pos correctly 2019-08-28 17:01:43 +02:00
Paul B Mahol
428b4aacb1 avformat/mov: improve timecode calculation
Fixes timecode calculation for NTSC frame rates.
Fixes ticket #5978.
2019-08-28 16:27:58 +02:00
Paul B Mahol
d8410e9cf9 avformat/dhav: always initializer ret 2019-08-28 15:44:36 +02:00
Steven Liu
17576fda65 avformat/hlsenc: remove unused value
CID: 1452644
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-26 11:06:48 +08:00
Steven Liu
80d2a7f5c6 avformat/hlsenc: fix memleak of filename
CID: 1452445
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-26 11:06:36 +08:00
Steven Liu
4ba82ecc12 avformat/hlsenc: fix memleak in hls_write_trailer
fix CID: 1426931

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-26 11:06:24 +08:00
James Almer
808a6717e0 avformat/movenc: add muxing support for Dolby TrueHD streams
Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-24 22:42:34 -03:00
James Almer
d1409fe952 avformat/mov: add demuxing support for Dolby TrueHD streams
Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-24 22:41:58 -03:00
Paul B Mahol
45cefca1e7 avformat/dhav: handle files missing data at start
Try to seek to end of file and if signature is found seek backwards until
last valid chunk is found.
2019-08-24 20:34:22 +01:00
Paul B Mahol
96fd07351a avformat/dhav: gracefully handle corrupted files
Try to find next valid chunk in offsets of 0x8000 from last good one.
2019-08-24 20:34:05 +01:00
Marton Balint
2fb550893f avformat/mpegtsenc: get rid of packet counting for sdt/pat/pmt
The packet counting based approach caused excessive sdt/pat/pmt for VBR, so
let's use a timestamp based approach instead similar to how we emit PCRs.
SDT/PAT/PMT period should be consistent for both VBR and CBR from now on.

Also change the type of sdt_period and pat_period to AV_OPT_TYPE_DURATION so no
floating point math is necessary.

Fixes ticket #3714.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-23 22:49:01 +02:00
Marton Balint
5c119bf189 avformat/mpegtsenc: move some code around and simplify a bit
PCR does not need to be recalcualted for CBR when inserting a NULL or PCR only
packet.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-23 22:49:01 +02:00
Marton Balint
8bf732cda6 avformat/mpegtsenc: add support for setting PCR interval for VBR streams
Also document the algorithm for the default PCR interval.

Fixes ticket #8061.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-23 22:49:01 +02:00
Marton Balint
6f499ae390 avformat/mpegtsenc: rename pcr_period variable to pcr_period_ms
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-23 22:49:01 +02:00
Michael Niedermayer
77abf31453 avformat/mpsubdec: Check pts / duration before cast
Fixes: 3e+47 is outside the range of representable values of type 'int'
Fixes: 16057/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5691111307214848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-23 22:26:50 +02:00
leozhang
b2bb09bcc3 avformat/flvdec: delete unused code
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: leozhang <leozhang@qiyi.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-23 22:24:07 +02:00
Marton Balint
6ee40dcb64 avformat/mxfdec: do not ignore bad size errors
The return value was unintentionally lost after
00a2652df3.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-22 21:38:41 +02:00
Michael Niedermayer
493438fafc avformat/realtextdec: free queue on error
Fixes: memleak
Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-22 18:35:44 +02:00
Michael Niedermayer
5937f05503 avformat/vividas: Check av_xiphlacing() return value before use
Fixes: out of array access
Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-22 18:35:44 +02:00
Steven Liu
c66d468795 avformat/hlsenc: avformat/hlsenc: simplified code
simplified code for get dirname string in hls_delete_old_segments

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-21 16:46:35 +08:00
Steven Liu
fa78a6abb3 avformat/hlsenc: simplified code of use_localtime in hls_init
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-21 16:46:31 +08:00
Steven Liu
d1fe1344ea avformat/hlsenc: fix memleak in update_variant_stream_info
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-21 16:46:28 +08:00
Steven Liu
3708a2a909 avformat/hlsenc: reindent code
and remove redundant empty line
2019-08-20 09:56:38 +08:00
Steven Liu
939c17fcb3 avformat/hlsenc: remove unuse comment of the code 2019-08-20 09:45:47 +08:00
Jun Zhao
f36925201c lavf/hlsenc: free the old_filname to avoid memory leak
free the old_filname to avoid memory leak in error handle
path.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-20 08:44:42 +08:00
Limin Wang
eccb94c3ba lavf/hlsenc: fix one warning: unused variable 'filename' [-Wunused-variable]
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-08-20 08:23:53 +08:00
Steven Liu
cff309097a avformat/hlsenc: merge mpegts and fmp4 workflow to one workflow
write mpegts or fmp4 context into buffer, and flush the buffer into
output file when split fragment. merge two format split workflow into
one workflow

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-18 08:22:32 +08:00
Limin Wang
df6e341b04 lavf/dump: use error log level for invalid size
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-08-18 08:17:57 +08:00