diff options
author | Marton Balint <cus@passwd.hu> | 2024-03-02 22:56:35 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2024-03-16 19:19:42 +0100 |
commit | 9c2c0c37f8c775d2bdca1730789fbdae75922acd (patch) | |
tree | a1d7b794cbabe9387cd4b93988ad0eaaad8c62d0 /libavformat/pcm.h | |
parent | f5441e441f9b0d235e49bdccc69e141ccd92e854 (diff) | |
download | ffmpeg-9c2c0c37f8c775d2bdca1730789fbdae75922acd.tar.gz |
avformat/pcm: factorize and improve determining the default packet size
- Remove the 1024 cap on the number of samples, for high sample rate audio it
was suboptimal, calculate the low neighbour power of two for the number of
samples (audio blocks) instead.
- Make the function work correctly also for non-pcm codecs by using the stream
bitrate to estimate the target packet size. A previous version of this patch
used av_get_audio_frame_duration2() the estimate the desired packet size, but
for some codecs that returns the duration of a single audio frame regardless
of frame_bytes.
- Fallback to 4096/block_align*block_align if bitrate is not available.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/pcm.h')
-rw-r--r-- | libavformat/pcm.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/pcm.h b/libavformat/pcm.h index 9af36d5a2e..1928497eed 100644 --- a/libavformat/pcm.h +++ b/libavformat/pcm.h @@ -24,6 +24,7 @@ #include "avformat.h" +int ff_pcm_default_packet_size(AVCodecParameters *par); int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt); int ff_pcm_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); |