[FFmpeg-devel] [PATCH] Fixed issues preventing ffserver write_index and files_size from being set correctly which was breaking ffserver streaming.

Oliver Collyer ovcollyer at mac.com
Sat Feb 20 08:33:49 CET 2016


Hi all

My first patch/appearance in these parts so please go easy on me if I’ve done anything wrong!

I discovered that ffserver streaming was broken (it seems like it has been since 20th November) and I opened a ticket for this (https://trac.ffmpeg.org/ticket/5250 <https://trac.ffmpeg.org/ticket/5250>).

I spent yesterday learning git bisect (with the kind help of cehoyos) to painstakingly track down the cause. This was made more difficult due to the presence of a segfault in ffserver during the period where the bug was introduced so I first had to identify when and how that was fixed and then retrospectively apply that fix again for each step of the second git bisect to find the actual bug.

Anyway, the fruits of my labour are the innocent looking patch below to correct a couple of typos and define a valid range for two variables.

One thing is that I’m unsure of the correct range for write_index and file_size in the patch for ffmdec.c. I’ve simply chosen INT64_MAX.

A general Q as a curious onlooker - is there not any kind of basic testing process for ffmpeg? When the mistake below was made a quick test of ffserver would have revealed it, but even if that didn’t occur is there not any kind of testing checklist done before release a branch such as 3.0?. Or does it all just rely on the community trying things out and if nobody happens to use ffserver and reports an issue then there is no other safety net?

Anyway, keep up the great work on the project, all concerned.

Regards

Oliver

---
 ffserver.c           | 4 ++--
 libavformat/ffmdec.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index bc7dbee..374af99 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -373,8 +373,8 @@ static void ffm_set_write_index(AVFormatContext *s, int64_t pos,
                                 int64_t file_size)
 {
     av_opt_set_int(s, "server_attached", 1, AV_OPT_SEARCH_CHILDREN);
-    av_opt_set_int(s, "write_index", pos, AV_OPT_SEARCH_CHILDREN);
-    av_opt_set_int(s, "file_size", file_size, AV_OPT_SEARCH_CHILDREN);
+    av_opt_set_int(s, "ffm_write_index", pos, AV_OPT_SEARCH_CHILDREN);
+    av_opt_set_int(s, "ffm_file_size", file_size, AV_OPT_SEARCH_CHILDREN);
 }
 
 static char *ctime1(char *buf2, size_t buf_size)
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 41c518f..257319b 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -775,8 +775,8 @@ static int ffm_probe(AVProbeData *p)
 
 static const AVOption options[] = {
     {"server_attached", NULL, offsetof(FFMContext, server_attached), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
-    {"ffm_write_index", NULL, offsetof(FFMContext, write_index), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
-    {"ffm_file_size", NULL, offsetof(FFMContext, file_size), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
+    {"ffm_write_index", NULL, offsetof(FFMContext, write_index), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_EXPORT },
+    {"ffm_file_size", NULL, offsetof(FFMContext, file_size), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_EXPORT },
     { NULL },
 };
 
-- 
2.5.0


More information about the ffmpeg-devel mailing list