1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

26095 Commits

Author SHA1 Message Date
James Almer
dc763efe70 avformat/matroskadec: don't infer display dimensions when DisplayUnit is not pixels
The spec doesn't define a default value for other values of DisplayUnit.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-08 13:30:24 -03:00
James Almer
893c6802ac avformat/dump: print Frame Cropping packet side data info
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-08 13:29:49 -03:00
Michael Niedermayer
0619138639
avformat/usmdec: Initialize value
Fixes: CID1551685 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:33 +02:00
Michael Niedermayer
7b2f67ea77
avformat/udp: Fix temporary buffer race
Fixes: CID1551679 Data race condition
Fixes: CID1551687 Data race condition

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:33 +02:00
Michael Niedermayer
f022afea77
avformat/tls_schannel: Initialize ret
Fixes: CID1591881 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:32 +02:00
Michael Niedermayer
426d8c84c3
avformat/subfile: Assert that whence is a known case
This may help CID1452449 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:32 +02:00
Michael Niedermayer
2a0a7d964b
avformat/subfile: Merge if into switch()
Found while reviewing CID1452449 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:32 +02:00
Michael Niedermayer
c8200d3825
avformat/rtsp: Check that lower transport is handled in one of the if()
Fixes: CID1473554 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:31 +02:00
Michael Niedermayer
498ce4e8b8
avformat/rtsp: initialize reply1
It seems reply1 is initialized by ff_rtsp_send_cmd() in most cases but there
are code paths like "continue" which look like they could skip it but even if not
writing this so a complex loop after several layers of calls initialized a local
variable through a pointer is just bad design.
This patch simply initialized the variable.

Fixes: CID1473532 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:31 +02:00
Michael Niedermayer
9bb38ba2b7
avformat/rtsp: use < 0 for error check
Found while reviewing CID1473532 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:31 +02:00
Michael Niedermayer
7a9ddb7051
avformat/rtpenc_vc2hq: Check sizes
Fixes: CID1452585 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:30 +02:00
James Almer
33d6e14d6f avformat/hevc: reindent after previous commits
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 13:54:07 -03:00
James Almer
aa8230c7ba avformat/movenc: add support for writting hfov boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
6a428876fc avformat/movenc: add support for writting vexu boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
d4e2af4144 avformat/movenc: add support for writing lhvC boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
Derek Buitenhuis
c4ebdd8d2d avformat/mov: Mark streams with a layered HEVC box as multilayer
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-07-07 12:38:57 -03:00
James Almer
c657c694e3 avformat/mov: add support for lhvC box parsing
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
cbfbacff20 avformat/hevc: add a function to write a lhvC box
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
cee43e512d avformat/hevc: store parameter set and layer IDs in HVCCNALUnit
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
361b01329f avformat/hevc: use a single array for per-PS NALUs
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
ab7893a7b1 avformat/hevc: don't write the same array values per nal addition
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
James Almer
a696b28886 avformat/hevc: don't write NALUs with nuh_layer_id > 0 in hvcC boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-07 12:38:57 -03:00
Derek Buitenhuis
46f7ea4456 avformat: Add a new stream disposition for multilayer video
This lets us detect when a container has flagged a stream as multilayer.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-07-07 12:38:50 -03:00
Anton Khirnov
ef521e7a57 lavf/movenc: mark mov/mp4 as supporting VFR 2024-07-07 11:37:43 +02:00
Marth64
8b8ee799de avformat/dvdvideodec: Remove unused cell count variable
Signed-off-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-07-07 11:33:32 +02:00
James Almer
bef77c6c9c avformat/dump: only print yaw, pitch, and roll if set
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-04 23:35:08 -03:00
Martin Storsjö
e14cdf9990 hlsenc: Calculate the average and actual maximum bitrate of segments
Previously, the bitrate advertised in the master playlist would only
be based on the nominal values in either AVCodecParameters bit_rate,
or via AVCPBProperties max_bitrate. On top of this, a
fudge factor of 10% is added, to account for container overhead.

Neither of these bitrates may be known, and if the encoder is
running in VBR mode, there is no such value to be known. And
the container overhead may be more or less than the given
constant factor of 10%.

Instead, calculate the maximum bitrate per segment based on
what actually gets output from the muxer, and average bitrate
across all segments.

When muxing of the file finishes, update the master playlist
with these values, exposing both the maximum (which previously
was a guesstimate based on the nominal values) via
EXT-X-STREAM-INF BANDWIDTH, and the average via
EXT-X-STREAM-INF AVERAGE-BANDWIDTH.

This makes it possible to use the hlsenc muxer with VBR
encodes, for VOD style muxing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:27 +03:00
Martin Storsjö
9246cca7f7 hlsenc: When not using HLS_SINGLE_FILE, set vs->size to range_length
This matches what is done in the corresponding case for
HLS_SINGLE_FILE.

Normally, vs->size is already initialized correctly - but when
writing the initial segment, with mp4 files, vs->size has been set
to the size of the init segment, while range_length contains the
real size of the first segment.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:26 +03:00
Martin Storsjö
a50b8bb7cd hlsenc: Remove bogus check for if (vs->start_pos) for appending segments
Previously, vs->start_pos was never 0 here, unless using the
-hls_segment_size option, which wasn't allowed for SEGMENT_TYPE_FMP4.
Therefore, this if statement was practically always taken anyway.

Remove this bogus if statement, to allow changing vs->start_pos
to reflect the right value when not using the -hls_segment_size
option.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:25 +03:00
Martin Storsjö
52f57568d5 hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size
When not using HLS_SINGLE_FILE or hls_segment_size, we're writing
each segment into a separate file. In that case, the file start pos for
each segment will be zero.

This matches the case in (hls->max_seg_size > 0) above, where we
decide to switch to a new file.

This fixes the calculation of "vs->size = new_start_pos - vs->start_pos"
at the start of hls_write_packet; previously, start_pos would
refer to the byte size of the previous segment file, giving
vs->size entirely bogus values here.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:24 +03:00
Martin Storsjö
01312fdfcf hlsenc: Fix the return value accumulation in append_single_file
Both the read_byte variable (which is accumulated into
append_single_file) and the return value are int64_t;
give the ret variable the right corresponding type too.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:23 +03:00
James Almer
cf7e2c5e05 avformat/mov: add more checks for infe atom size
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
James Almer
235ba14cc0 avformat/mov: check for EOF inside the infe list parsing loop
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
James Almer
a9a5d000aa avformat/mov: check extent_offset calculation for overflow
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
James Almer
c49898a6b1 avformat/mov: check that iloc offset values fit on an int64_t
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
Michael Niedermayer
0d0373de3b
avformat/rdt: Check pkt_len
Fixes: CID1473553 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:24 +02:00
Michael Niedermayer
ca237a841e
avformat/mpeg: Check len in mpegps_probe()
Fixes: CID1473590 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:23 +02:00
Michael Niedermayer
64df7d4c1e
avformat/mov: Check requested_sample before using it
I am not sure the case described by coverity is possible
but its more robust checking the argument first

Fixes: CID1598441 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:23 +02:00
Michael Niedermayer
a469e48b6d
avformat/mxfenc: resurrects the error print
Fixes: CID1524681 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:23 +02:00
Michael Niedermayer
4824156fa0
avformat/img2dec: assert no pipe on ts_from_file
Help coverity with CID1500302 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:21 +02:00
Michael Niedermayer
2882d30e3a
avformat/mov: Check edit list for overflow
Fixes: 67492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5778297231310848
Fixes: signed integer overflow: 2314885530818453536 + 7782220156096217088 cannot be represented in type 'long'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:18 +02:00
Marth64
4dc204ea3e avformat/dvdvideodec: Fix duration logic with 1 chapter and validate chapter range
Chapters and duration are calculated together in dvdvideo demuxer.
Previous chapter calculation logic treated extraction of 1 chapter
using chapter_start and chapter_end switches incorrectly, returning
the duration of the entire title instead of just the segment.

Fix the logic so that it calculates and returns the duration of the
chapter segment instead. Additionally, validate that chapter_end
exceeds chapter_start (except in the special case of 0).

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-07-01 22:54:00 +02:00
Marth64
0c1c7688ea avformat/dvdvideodec: Do not EOF on WAIT events
A DVDNAV_WAIT event by itself should not warrant an
EOF when navigating the program stream. Some discs
have WAIT events in the middle of a title, causing
playback to end prematurely prior to this fix.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-07-01 22:53:54 +02:00
James Almer
0b330d8642 avformat/mov: set Stereo3D type when parsing eyes box
If view is defined in the child stri box, then the type must be set to
unspecified, as these boxes don't carry packing information.
Also, don't attach a useless Stereo 3D side data if the stream is monoscopic.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-28 13:16:57 -03:00
Kacper Michajłow
02b3fc5826
avformat/nuv: return early if header id fails to read
Fixes use of uninitialized value in memcmp below, reported by MSAN.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-27 23:28:46 +02:00
James Almer
74035aaed7 avformat/matroskadec: don't use sizeof(AVStereo3D)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-25 00:01:11 -03:00
James Almer
f6b29c8773 avformat/mov: don't use sizeof(AVStereo3D)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-25 00:01:11 -03:00
James Almer
1034296eac avformat/dump: print Stereo3D AVRationals as float
Same as every other rational printed in this file.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-24 20:00:14 -03:00
Lynne
dae12ddb2e
lavu/stereo3d: change the horizontal FOV field to a rational
This avoids hardcoding any implementation-specific limitiations as
part of the API, and allows for future expandability.

This also allows API users to more conveniently convert the
values into floats without hardcoding specific conversion constants.

The API was committed a few days ago, so changing this field now
is within the realms of acceptable.
2024-06-24 23:53:25 +02:00
Timo Rothenpieler
76317e22a6 avformat/tls_schannel: forward AVIO_FLAG_NONBLOCK to tcp stream
Fixes for example rtmps streaming over schannel.
2024-06-24 15:00:27 +02:00
Martin Storsjö
6ec22731ae movenc: Add an option for resilient, hybrid fragmented/non-fragmented muxing
This allows ending up with a normal, non-fragmented file when
the file is finished, while keeping the file readable if writing
is aborted abruptly at any point. (Normally when writing a
mov/mp4 file, the unfinished file is completely useless unless it
is finished properly.)

This results in a file where the mdat atom contains (and hides)
all the moof atoms that were part of the fragmented file structure
initially.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-24 11:24:04 +03:00
Martin Storsjö
4b8ddf71dc movenc: Factorize a function for finishing a written fragment
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-24 11:23:55 +03:00
James Almer
127545350f avformat/mov: use the updated default value for horizontal_disparity_adjustment in the eyes box
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-21 14:09:25 -03:00
James Almer
35df214a72 avformat/mxfdec: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:04:03 -03:00
James Almer
a91f34aad8 avformat/mov: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:04:03 -03:00
James Almer
8a85d3fd39 avformat/matroskadec: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:04:03 -03:00
James Almer
53c8d417ed avformat: split off generic NAL function helpers into their own file
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 08:57:45 -03:00
James Almer
0ae157b360 avformat/iamf_parse: add missing padding to AAC extradata
Fixes: out of array access
Fixes: 68863/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-4833546039525376

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-19 10:12:57 -03:00
James Almer
4e608e90eb avformat/evc: fix writing reserved bits
They are all zeroes, not ones.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-19 10:12:50 -03:00
James Almer
5191339f74 avformat/evc: remove useless struct field
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-19 10:03:04 -03:00
Michael Niedermayer
4cab028bd0
avformat/mxfdec: Check container_ul->desc before use
Fixes: CID1592939 Dereference after null check

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-19 13:24:31 +02:00
Michael Niedermayer
7fab9b9761
avformat/iamf_parse: 0 layers are not allowed
Fixes: out of array access
Fixes: 68302/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4665793796177920

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>
2024-06-19 12:54:46 +02:00
Michael Niedermayer
c69e6cccd7
avformat/iamf_parse: consider nb_substreams when accessing substreams array
Fixes: out of array access
Fixes: 68584/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6256656668229632

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>
2024-06-19 12:52:20 +02:00
Derek Buitenhuis
620f6f7d5b avformat/dump: Print all possible Stereo3D info
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2024-06-18 19:54:35 +01:00
Derek Buitenhuis
8e7ca22b36 avformat/mov: Add support for reading and exporting horizontal field of view
These boxes are created by the Apple Vision Pro and the iPhone 15+ when
capture for the Vision Pro is enabled.

Based off of the swift API:
  * https://developer.apple.com/documentation/coremedia/kcmformatdescriptionextension_horizontalfieldofview

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2024-06-18 14:47:40 +01:00
Derek Buitenhuis
5c17376321 avformat/mov: Add support for exporting Video Extension Usage info
This box is provided by files created by the Apple Vision Pro, as well
as the iPhone 15+ when capture for Vision Pro is enabled.

The boxes are a mix of things documented by Apple in some PDFs, their
API docs, and reverse engineering. Ideally we will have a real spec
one day.

Links:
  * https://developer.apple.com/av-foundation/Stereo-Video-ISOBMFF-Extensions.pdf
  * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_horizontaldisparityadjustment
  * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_stereocamerabaseline
  * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_heroeye

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2024-06-18 14:47:40 +01:00
sfan5
c28e5b597e lavf/tls_mbedtls: add workaround for TLSv1.3 vs. verify=0
As of mbedTLS 3.6.0 TLSv1.3 is enabled by default and certificate verification
is now mandatory. Our default configuration does not do verification, so
downgrade to 1.2 in these situations to avoid breaking it.

ref: https://github.com/Mbed-TLS/mbedtls/issues/7075

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-18 07:23:44 +02:00
Marton Balint
9fb6f024c3 avformat/mxfdec: use the newly added channel ids for more exact mapping
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-06-12 19:37:01 +02:00
Marton Balint
d9a0a6a2b5 avformat/mov_chan: make iso_channel_position table more compact
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-06-12 19:37:01 +02:00
Marton Balint
e405afdd0a avformat/mov_chan: use the newly added channel ids for more exact mapping
Also make the iso_channel_position table consistent with what the AAC decoder
uses in avcodec/aac/aacdec_usac.c.

Fate changes are caused by the change of how 7.1 layout is mapped, previously
it included Side Surround channels, now it includes the Surround channels.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-06-12 19:37:01 +02:00
Andreas Rheinhardt
b90b676409 avformat/riff: Declare VCR2 to be MPEG-2
This brings it in line with mpeg12dec.c.
(This entry has been added before the MPEG2VIDEO codec id
existed.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-12 11:44:10 +02:00
Michael Niedermayer
034054b370
avformat/mov: Use int64_t in intermediate for corrected_dts
Fixes: CID1500312 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:13 +02:00
Michael Niedermayer
0c977d37aa
avformat/mov: Use 64bit in intermediate for current_dts
Fixes: CID1500304 Unintentional integer overflow
Fixes: CID1500318 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:13 +02:00
Michael Niedermayer
019fce18bb
avformat/matroskadec: Assert that num_levels is non negative
Maybe Closes: CID1452496 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:13 +02:00
Michael Niedermayer
0263b6a48c
avformat/libzmq: Check av_strstart()
Fixes: CID1453457 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:12 +02:00
Michael Niedermayer
5712f36dd0
avformat/img2dec: Little JFIF / Exif cleanup
This changes the behavior and makes it behave how it probably was intended.
Either way this is unlikely to result in any user visible change

Fixes: CID1494637 Missing break in switch

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:12 +02:00
Michael Niedermayer
7d04c6016b
avformat/img2dec: Move DQT after unrelated if()
Fixes: CID1494636 Missing break in switch

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:12 +02:00
Michael Niedermayer
f10493f6fc
avformat/imfdec: Simplify get_next_track_with_minimum_timestamp()
This also makes the code more robust

Fixes: CID1512414 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:11 +02:00
Michael Niedermayer
c21fb3624b
avformat/iamf_parse: Remove dead case
Fixes: CID1559546 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:11 +02:00
Rémi Denis-Courmont
378d1b06c3 riscv: probe for Zbb extension at load time
Due to hysterical raisins, most RISC-V Linux distributions target a
RV64GC baseline excluding the Bit-manipulation ISA extensions, most
notably:
- Zba: address generation extension and
- Zbb: basic bit manipulation extension.
Most CPUs that would make sense to run FFmpeg on support Zba and Zbb
(including the current FATE runner), so it makes sense to optimise for
them. In fact a large chunk of existing assembler optimisations relies
on Zba and/or Zbb.

Since we cannot patch shared library code, the next best thing is to
carry a flag initialised at load-time and check it on need basis.
This results in 3 instructions overhead on isolated use, e.g.:
1:  AUIPC rd, %pcrel_hi(ff_rv_zbb_supported)
    LBU   rd, %pcrel_lo(1b)(rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

The C compiler will typically load the flag ahead of time to reducing
latency, and can also keep it around if Zbb is used multiple times in a
single optimisation scope. For this to work, the flag symbol must be
hidden; otherwise the optimisation degrades with a GOT look-up to
support interposition:
1:  AUIPC rd, GOT_OFFSET_HI
    LD    rd, GOT_OFFSET_LO(rd)
    LBU   rd, (rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

This patch adds code to provision the flag in libraries using bit
manipulation functions from libavutil: byte-swap, bit-weight and
counting leading or trailing zeroes.
2024-06-11 20:12:37 +03:00
sfan5
0455a62d84 lavf/tls_mbedtls: handle session ticket error code as no-op
When TLSv1.3 and session tickets are enabled mbedtls_ssl_read()
will return an error code to inform about a received session ticket.
This can simply be handled like EAGAIN instead of errornously
aborting the connection.

ref: https://github.com/Mbed-TLS/mbedtls/issues/8749
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 17:00:35 +02:00
sfan5
1b1e9cadc5 lavf/tls_mbedtls: fix handling of certification validation failures
We manually check the verification status after the handshake has completed
using mbedtls_ssl_get_verify_result(). However with VERIFY_REQUIRED
mbedtls_ssl_handshake() already returns an error, so this code is never reached.
Fix that by using VERIFY_OPTIONAL, which performs the verification but
does not abort the handshake.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:58:22 +02:00
sfan5
827578ca76 lavf/tls_mbedtls: hook up debug message callback
Unfortunately this won't work out-of-the-box because mbedTLS
only provides a global (not per-context) debug toggle.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:58:15 +02:00
sfan5
807d1505bf lavf/tls_mbedtls: add missing call to psa_crypto_init
This is mandatory depending on configuration or at least with mbedTLS 3.6.0.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:35:46 +02:00
sfan5
63b6620ad3 lavf/tls_mbedtls: handle more error codes for human-readable messages
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:35:31 +02:00
Andreas Rheinhardt
8f199cfb5b avformat/evc: Fix format specifiers
Fixes -Wformat warnings; see e.g.
https://fate.ffmpeg.org/log.cgi?slot=aarch64-osx-clang-1200.0.32.29&time=20240604151047&log=compile

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
5f31a4fd16 avformat/vvc: Don't use uint8_t iterators, fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
1c4362cce9 avformat/vvc: Fix comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
fa77dc8c44 avformat/vvc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
8b6c7e7cda avformat/vvc: Fix crash on allocation failure, avoid allocations
This is the VVC version of 8b5d155301.

(Hint: This ensures that the order of NALU arrays is OPI-VPS-SPS-PPS-
Prefix-SEI-Suffix-SEI, regardless of the order in the original
extradata. I hope this is right.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
4482b3353d avformat/vvc: Don't use ff_copy_bits()
There is no benefit in using it: The fast path of copying
is not taken because of misalignment; furthermore we are
only dealing with a few byte here anyway, so simply copy
the bytes manually, avoiding the dependency on bitstream.c
in lavf (which also contains a function that is completely
unused in lavf).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
52fb49a8a3 avformat/vvc: Use put_bytes_output()
The PutBitContext has just been flushed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Michael Niedermayer
5b82852519
avformat/sdp: Check before appending ","
Found by reviewing code related to CID1500301 String not null terminated

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-07 21:42:25 +02:00
Kacper Michajłow
a3d3a58026
avformat/rpl: reject invalid sample rate
Fixes overflow check for bit_rate multiplication few lines below.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-07 21:42:25 +02:00
Anton Khirnov
e4601cc339 lavc/hevc*: move to hevc/ subdir 2024-06-04 11:46:27 +02:00
Andreas Rheinhardt
87a13986bc avformat/nutdec: Don't create inconsistent side data
Forgotten in 65ddc74988.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-03 16:38:15 +02:00
Michael Niedermayer
348c3a7ffe
avformat/fwse: Remove always false expression
Fixes: CID1460758 Operands don't affect result

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-02 22:29:21 +02:00
Michael Niedermayer
70b4994762
avformat/asfdec_f: Use 64bit for preroll computation
Fixes: CID1500342 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:28 +02:00
Michael Niedermayer
d9d1f65308
avformat/argo_asf: Use 64bit in offset intermediate
Fixes: CID1467435 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:28 +02:00
Michael Niedermayer
a2b8d03347
avformat/ape: Use 64bit for final frame size
Fixes: CID1505963 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:28 +02:00
Michael Niedermayer
2f04cb673c
avformat/ac4dec: Check remaining space in ac4_probe()
Fixes: CID1538298 Untrusted loop bound
Fixes: undefined behavior

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:27 +02:00
Andreas Rheinhardt
996e0a57ca avformat/matroskadec: Add assert to silence Coverity false positive
Helps with Coverity issue #1452453.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-31 14:18:33 +02:00
Rémi Denis-Courmont
add8c46215 Revert "avformat/file: seek back to initial position for fd protocol"
The generally expected behaviour is for software to append from the
current position, not to keep resetting. See also how shell works:
 # (foo && bar) > file
...would normally concatenate the output of both commands to file.

If foo seeks like lavf, bar would instead overwrite the output of
foo (possibly not completely).

This reverts commit 5c3d2177e7.
2024-05-30 18:30:21 +03:00
Kacper Michajłow
b2b23f353a avformat/hls: update current segment reference before use
It may be invalidated by the time it is used.

Fixes use after free when accessing current segment.

Fixes: #10825
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-05-28 15:02:02 +02:00
Michael Niedermayer
3c1915d776
avformat/hlsenc: Remove dead ret stores
Fixes: CID1529222 Unused value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-28 03:48:04 +02:00
Michael Niedermayer
33da5f4e27
avformat/demux: resurrect dead stores
Fixes: CID1473512 Unused value
Fixes: CID1529228 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-28 03:48:03 +02:00
Andreas Rheinhardt
8e27bd025f avformat/async,cache: Use more unique context names
Otherwise Doxygen thinks any text like "Context for foo"
is a link to the async protocol's struct called "Context".

Reported-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:52:19 +02:00
Andreas Rheinhardt
edc235e076 avformat/riffenc: Fix outdated comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:52:05 +02:00
Andreas Rheinhardt
50c25d1f0a avformat/matroskaenc: Check ff_put_wav_header() failure
Fixes Coverity issue #1506706.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:58 +02:00
Andreas Rheinhardt
65763bffb6 avformat/mpegts: Don't use uninitialized value in av_log()
It is undefined behaviour in (at least) C11 (see C11 6.3.2.1 (2)).
Fixes Coverity issue #1500314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
d8cad01805 avformat/dhav: Check amount read
Prevents potential use of uninitialized data in the following
memcmp().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
cf6d07522a avformat/dhav: Check ffio_ensure_seekback()
Fixes Coverity issue #1492324.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
95faf45af1 avformat/qoadec: Check ffio_ensure_seekback()
Fixes Coverity issue #1598406.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
6dc8d4eea8 avformat/westwood_vqa: Check ffio_ensure_seekback()
Fixes Coverity issue #1598405.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
590fffe6ad avformat/gifdec: Check ffio_ensure_seekback()
Fixes Coverity issue #1598400.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
b47116be45 avformat/oggdec: Check ffio_ensure_seekback()
Fixes Coverity issue #1492327.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
James Almer
62397bcf6a avformat/movenc: add support for writing SA3D boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-23 19:06:46 -03:00
James Almer
3146b77a7d avformat/mov: store sample_sizes as unsigned ints
As defined in Section 8.7.3.2.1 of ISO 14496-12.
Any unsupported value will be rejected in mov_build_index() without outright
aborting demuxing.

Fixes ticket #11005.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-22 17:46:49 -03:00
James Almer
2d84ee3745 avformat/vvc: fix parsing sps_subpic_id
The length of the sps_subpic_id[i] syntax element is sps_subpic_id_len_minus1 + 1 bits.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-22 17:46:49 -03:00
James Almer
3bd7e3a336 avformat/vvc: initialize some ptl flags
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-22 17:46:49 -03:00
llyyr
d1b96c3808 avformat/mov: avoid seeking back to 0 on HEVC open GOP files
ab77b878f1 attempted to fix the issue of broken packets being sent to
the decoder by implementing logic that kept attempting to PTS-step
backwards until it reached a valid point, however applying this
heuristic meant that in files that had no valid points (such as HEVC
videos shot on iPhones), we'd seek back to sample 0 on every seek
attempt. This meant that files that were previously seekable, albeit
with some skipped frames, were not seekable at all now.

Relax this heuristic a bit by giving up on seeking to a valid point if
we've tried a different sample and we still don't have a valid point to
seek to. This may some frames to be skipped on seeking but it's better
than not being able to seek at all in such files.

Fixes: ab77b878f1 ("avformat/mov: fix seeking with HEVC open GOP files")
Fixes: #10585
Signed-off-by: Philip Langdale <philipl@overt.org>
2024-05-21 18:57:44 -07:00
Marton Balint
49e018d6fe avformat/mp3dec: change bogus error message if read_header encounters EOF
Because of ffio_ensure_seekback() a seek error normally should only happen if
the end of file is reached during checking for the junk run-in. Also use proper
error code.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-21 08:28:09 +02:00
Marton Balint
b75e604fe5 avformat/mp3dec: simplify inner frame size check in mp3_read_header
We are protecting the checked buffer with ffio_ensure_seekback(), so if the
inner check fails with a seek error, that likely means the end of file was
reached when checking for the next frame. This could also be the result of a
wrongly guessed (larger than normal) frame size, so let's continue the loop
instead of breaking out early. It will end sooner or later anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-21 08:28:09 +02:00
Marton Balint
b005317219 avformat/mp3dec: only call ffio_ensure_seekback once
Otherwise the subsequent ffio_ensure_seekback calls destroy the buffer of the
earlier. The worst case ~66kB seekback is so small it is easier to request it
entirely.

Fixes ticket #10837, a regression since
0d17f5228f.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-21 08:28:09 +02:00
LuMingYin
14f9e47314 libavformat/rtsp: fix a memory leak on error path
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-20 23:57:05 +08:00
LuMingYin
9481b7d932 libavformat/hlsenc: fix a memory leak on error path
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-20 23:56:58 +08:00
Andreas Rheinhardt
b50c5d0290 avformat/flacdec: Reorder allocations to avoid leak on error
Fixes Coverity issue #1591795.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:15:18 +02:00
Andreas Rheinhardt
f3d206d25f fftools, avfilter, avformat: Simplify check for "is dictionary empty?"
Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:52:41 +02:00
Andreas Rheinhardt
482afe8f3f avcodec/lib*, avformat/tee: Simplify iterating over AVDictionary
Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:51:55 +02:00
Andreas Rheinhardt
ce22e7ab28 avformat/tee: Use smaller scope for variables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:49:58 +02:00
Andreas Rheinhardt
26f3e79114 avformat/tee: Constify AVDictionaryEntry* pointee where possible
This is in preparation for using av_dict_iterate().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:33:38 +02:00
Andreas Rheinhardt
583c3d45fa avformat/tls_openssl: #if ff_openssl_init/deinit() away if possible
These functions do nothing useful when used with a non-ancient
version of openssl (namely 1.1.0 or above).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 12:37:42 +02:00
Andreas Rheinhardt
8b48b0adab avformat/utils: Use static mutexes instead of ff_lock_avformat()
Its existence is a remnant of (libavcodec's) lock-manager API
which has been removed in a04c2c707d.
There is no need to use the same lock for avisynth, chromaprint
or tls, so switch to ordinary static mutexes instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 12:28:28 +02:00
Marcus B Spencer
8b8b555de0 avformat/aacdec: strictly conform to K&R style
In the K&R style, a single-statement block does not have braces.
Edit the code to conform to this rule.

It is FFmpeg's code formatting convention to use K&R style.

Signed-off-by: Marcus B Spencer <marcus@marcusspencer.xyz>
2024-05-19 01:26:40 +02:00
James Almer
3765305928 configure: split ISOBMFF writer helpers into a separate component
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 13:21:35 -03:00
James Almer
9ab8dddf1f avformat/vvc: use align_get_bits() where useful
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 13:21:35 -03:00
James Almer
f00b23453c avformat/vvc: reduce the scope of some variables
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 13:21:24 -03:00
James Almer
a48203d51a avformat/vvc: fix parsing some early VPS bitstream values
vps_default_ptl_dpb_hrd_max_tid_flag needs to always be set, and
vps_direct_ref_layer_flag needs to be read even when
vps_max_tid_ref_present_flag is false.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 11:35:27 -03:00
James Almer
f121d52b35 avformat/vvc: remove duplicate struct
VVCCProfileTierLevel is the same as VVCPTLRecord since the previous commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 11:33:46 -03:00
James Almer
cba15ca0ec avformat/vvc: generalize calculating num_bytes_constraint_info
Will be useful for when the aditional bits are supported, as well as for the
next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 11:33:46 -03:00
James Almer
415dfa89e2 avformat/vvc: fix writing general_constraint_info bytes
The existing implementation was completely broken.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-18 11:33:46 -03:00
Michael Niedermayer
a5d1497f33
avformat/concatdec: Check file
Fixes: null pointer dereference
Fixes: -stream_loop 1 -ss 00:00:05 -i zgclab/ffmpeg_crash/poc2 -codec:v copy -codec:a aac -y output.mp4

Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-09 16:17:39 +02:00
Dawid Kozinski
e4da96c6b2 avformat/evc: Small fixes in documentation
Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2024-05-09 10:06:38 -03:00
Dawid Kozinski
73d338d47c avformat/avi: Added EVC codec tag to the list of supported codec_id-codec_tag pairs for AVI muxer
Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2024-05-08 21:15:05 -03:00
Andreas Rheinhardt
5de78958e4 avformat/Makefile: Add asf_muxer->asf_tags.o dependency
Forgotten in 493356cc0b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Marton Balint
8d92f59d11 avformat/file: fail for non-numerical arguments to pipe:
Before this patch, the implementation of pipe: inputs/outputs would
silently fall back to stdin/stdout for any argument not successfully
parsed by strtol().

This patch introduces an explicit error for any non-numerical arguments,
which should avoid user confusion as in #10977.

New behavior:

$ cat /tmp/video.mkv | ./ffmpeg -i pipe:aa -acodec copy -vcodec copy -f matroska pipe:1 | cat >/tmp/out.mkv

[pipe @ 0x5618c7bcf740] Non-numerical argument "aa" to pipe:
[in#0 @ 0x5618c7bced00] Error opening input: Invalid argument
Error opening input file pipe:aa.
Error opening input files: Invalid argument

Based on the patch of Nils Goroll <nils.goroll@uplex.de>.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-07 23:38:05 +02:00
James Almer
2e16285fe8 avformat/iamf_reader: split "if ((ret = ...) < 0)" line
Cosmetic change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
0ec8f3c55a avformat/mov: don't use stream duration to calculate bitrate with fragmented input
sc->data_size may contain the size of a single fragment after probing, and
using it alongside the duration of the entire stream to calculate bitrate
will result in a bogus small value.

Before:
  Duration: 00:00:05.00, start: 0.000000, bitrate: 586 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 112 kb/s, 60 fps, 60 tbr, 15360 tbn (default)

After:
  Duration: 00:00:05.00, start: 0.000000, bitrate: 586 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 561 kb/s, 60 fps, 60 tbr, 15360 tbn (default)

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
Andreas Rheinhardt
2c77dc5aad avformat/movenc: Avoid loop for writing array
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-04 16:30:22 +02:00
Andreas Rheinhardt
601873263e avformat/movenc: Check av_malloc()
Fixes Coverity issue #1596735.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-04 16:29:58 +02:00