[FFmpeg-devel] [PATCH] aviobuf: Increase the default SHORT_SEEK_THRESHOLD to 32 KB

Martin Storsjö martin at martin.st
Thu Nov 5 23:49:47 EET 2020


The previous threshold, 4 KB, maybe was reasonable when it was set
(in 2010), but in today's settings and with typical network speeds
and data sizes, it's pretty small. 32 KB probably is a more reasonable
default now, regardless of input.

This changes the test references for two seek tests.

When using the normal seek function, which boils down to the lseek(2)
function, a seek to an out of bounds position doesn't return an error,
but that condition is only reported when doing the subsequent read
(which returns EOF). When doing more seeks by fast forwarding, the
fact that the seeked to destination is out of bounds is noticed and
reported sooner in these cases.
---
Updated with new test references for tests that change, and analysis
of the reason for the changed test references.
---
 libavformat/aviobuf.c  |  2 +-
 tests/ref/seek/lavf-al | 13 +++++--------
 tests/ref/seek/lavf-ul | 13 +++++--------
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 82c20cab52..78cc60b2ae 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -40,7 +40,7 @@
  * data instead of calling the protocol seek function, for seekable
  * protocols.
  */
-#define SHORT_SEEK_THRESHOLD 4096
+#define SHORT_SEEK_THRESHOLD 32768
 
 static void *ff_avio_child_next(void *obj, void *prev)
 {
diff --git a/tests/ref/seek/lavf-al b/tests/ref/seek/lavf-al
index 8d517fa2bb..5a4085af4e 100644
--- a/tests/ref/seek/lavf-al
+++ b/tests/ref/seek/lavf-al
@@ -7,22 +7,20 @@ 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  ts:-0.317506
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   882
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
+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: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  ts:-0.740816
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   882
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
+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: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  ts: 2.835828
-ret:-EOF
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:  43218 size:   882
 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:-1 flags:1  ts: 0.624171
@@ -30,7 +28,7 @@ ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  13763 size:   882
 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  ts: 2.412517
-ret:-EOF
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:  43218 size:   882
 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:-1 flags:1  ts: 0.200839
@@ -43,8 +41,7 @@ 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:-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:0  ts: 2.671655
-ret:-EOF
+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:-1 flags:0  ts: 0.460008
diff --git a/tests/ref/seek/lavf-ul b/tests/ref/seek/lavf-ul
index 8d517fa2bb..5a4085af4e 100644
--- a/tests/ref/seek/lavf-ul
+++ b/tests/ref/seek/lavf-ul
@@ -7,22 +7,20 @@ 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  ts:-0.317506
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   882
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
+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: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  ts:-0.740816
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   882
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
+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: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  ts: 2.835828
-ret:-EOF
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:  43218 size:   882
 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:-1 flags:1  ts: 0.624171
@@ -30,7 +28,7 @@ ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  13763 size:   882
 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  ts: 2.412517
-ret:-EOF
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:  43218 size:   882
 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:-1 flags:1  ts: 0.200839
@@ -43,8 +41,7 @@ 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:-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:0  ts: 2.671655
-ret:-EOF
+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:-1 flags:0  ts: 0.460008
-- 
2.24.3 (Apple Git-128)



More information about the ffmpeg-devel mailing list