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 /tests | |
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 'tests')
-rw-r--r-- | tests/ref/seek/lavf-al | 46 | ||||
-rw-r--r-- | tests/ref/seek/lavf-ul | 46 |
2 files changed, 46 insertions, 46 deletions
diff --git a/tests/ref/seek/lavf-al b/tests/ref/seek/lavf-al index 5a4085af4e..ebf7993425 100644 --- a/tests/ref/seek/lavf-al +++ b/tests/ref/seek/lavf-al @@ -1,50 +1,50 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 882 +ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 512 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 882 +ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 512 ret: 0 st: 0 flags:1 ts:-0.317506 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret:-1 st:-1 flags:0 ts: 2.576668 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 32432 size: 882 +ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 32432 size: 512 ret: 0 st: 0 flags:0 ts: 0.364989 -ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos: 8048 size: 882 +ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos: 8048 size: 512 ret: 0 st: 0 flags:1 ts:-0.740816 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret:-1 st:-1 flags:0 ts: 2.153336 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos: 23097 size: 882 +ret: 0 st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos: 23097 size: 512 ret: 0 st: 0 flags:0 ts:-0.058322 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st: 0 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 43218 size: 882 +ret: 0 st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos: 43814 size: 286 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos: 38147 size: 882 +ret: 0 st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos: 38147 size: 512 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 13763 size: 882 +ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 13763 size: 512 ret: 0 st: 0 flags:0 ts:-0.481678 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st: 0 flags:1 ts: 2.412517 -ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 43218 size: 882 +ret: 0 st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos: 43814 size: 286 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 28812 size: 882 +ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 28812 size: 512 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.200816 pts: 0.200816 pos: 4428 size: 882 +ret: 0 st: 0 flags:1 dts: 0.200816 pts: 0.200816 pos: 4428 size: 512 ret: 0 st: 0 flags:0 ts:-0.904989 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st: 0 flags:1 ts: 1.989161 ret: 0 st: 0 flags:1 dts: 1.989161 pts: 1.989161 pos: 43861 size: 239 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.883356 pts: 0.883356 pos: 19478 size: 882 +ret: 0 st: 0 flags:1 dts: 0.883356 pts: 0.883356 pos: 19478 size: 512 ret: 0 st:-1 flags:1 ts:-0.222493 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret:-1 st: 0 flags:0 ts: 2.671655 ret: 0 st: 0 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 34527 size: 882 +ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 34527 size: 512 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 10143 size: 882 +ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 10143 size: 512 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 diff --git a/tests/ref/seek/lavf-ul b/tests/ref/seek/lavf-ul index 5a4085af4e..ebf7993425 100644 --- a/tests/ref/seek/lavf-ul +++ b/tests/ref/seek/lavf-ul @@ -1,50 +1,50 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 882 +ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 512 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 882 +ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 512 ret: 0 st: 0 flags:1 ts:-0.317506 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret:-1 st:-1 flags:0 ts: 2.576668 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 32432 size: 882 +ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 32432 size: 512 ret: 0 st: 0 flags:0 ts: 0.364989 -ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos: 8048 size: 882 +ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos: 8048 size: 512 ret: 0 st: 0 flags:1 ts:-0.740816 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret:-1 st:-1 flags:0 ts: 2.153336 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos: 23097 size: 882 +ret: 0 st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos: 23097 size: 512 ret: 0 st: 0 flags:0 ts:-0.058322 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st: 0 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 43218 size: 882 +ret: 0 st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos: 43814 size: 286 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos: 38147 size: 882 +ret: 0 st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos: 38147 size: 512 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 13763 size: 882 +ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 13763 size: 512 ret: 0 st: 0 flags:0 ts:-0.481678 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st: 0 flags:1 ts: 2.412517 -ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 43218 size: 882 +ret: 0 st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos: 43814 size: 286 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 28812 size: 882 +ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 28812 size: 512 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.200816 pts: 0.200816 pos: 4428 size: 882 +ret: 0 st: 0 flags:1 dts: 0.200816 pts: 0.200816 pos: 4428 size: 512 ret: 0 st: 0 flags:0 ts:-0.904989 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st: 0 flags:1 ts: 1.989161 ret: 0 st: 0 flags:1 dts: 1.989161 pts: 1.989161 pos: 43861 size: 239 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.883356 pts: 0.883356 pos: 19478 size: 882 +ret: 0 st: 0 flags:1 dts: 0.883356 pts: 0.883356 pos: 19478 size: 512 ret: 0 st:-1 flags:1 ts:-0.222493 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret:-1 st: 0 flags:0 ts: 2.671655 ret: 0 st: 0 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 34527 size: 882 +ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 34527 size: 512 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 10143 size: 882 +ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 10143 size: 512 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 882 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 |