From 74bc9458057f07c0820c3d3264396c4c64442e47 Mon Sep 17 00:00:00 2001 From: Josh Allmann Date: Tue, 10 Jun 2014 18:45:07 -0700 Subject: [PATCH] flvenc: Don't over-count metadata. Over-counting occurs if framerate is not set. Signed-off-by: Anton Khirnov --- libavformat/flvenc.c | 3 ++- tests/ref/lavf/flv_fmt | 2 +- tests/ref/vsynth/vsynth1-flashsv | 2 +- tests/ref/vsynth/vsynth1-flv | 2 +- tests/ref/vsynth/vsynth2-flashsv | 2 +- tests/ref/vsynth/vsynth2-flv | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index e87c256694..cc4c782771 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -282,7 +282,7 @@ static int flv_write_header(AVFormatContext *s) /* mixed array (hash) with size and string/type/data tuples */ avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); metadata_count_pos = avio_tell(pb); - metadata_count = 5 * !!video_enc + + metadata_count = 4 * !!video_enc + 5 * !!audio_enc + 1 * !!data_enc + 2; // +2 for duration and file size @@ -308,6 +308,7 @@ static int flv_write_header(AVFormatContext *s) if (framerate != 0.0) { put_amf_string(pb, "framerate"); put_amf_double(pb, framerate); + metadata_count++; } put_amf_string(pb, "videocodecid"); diff --git a/tests/ref/lavf/flv_fmt b/tests/ref/lavf/flv_fmt index c0351b3b0f..019204d16a 100644 --- a/tests/ref/lavf/flv_fmt +++ b/tests/ref/lavf/flv_fmt @@ -1,3 +1,3 @@ -52ca9477330765fee525941c5a30dad1 *./tests/data/lavf/lavf.flv +822735e9d25b3eb22529f444a71840c3 *./tests/data/lavf/lavf.flv 329521 ./tests/data/lavf/lavf.flv ./tests/data/lavf/lavf.flv CRC=0x881785d1 diff --git a/tests/ref/vsynth/vsynth1-flashsv b/tests/ref/vsynth/vsynth1-flashsv index 615e2a5244..a4f22ce0a4 100644 --- a/tests/ref/vsynth/vsynth1-flashsv +++ b/tests/ref/vsynth/vsynth1-flashsv @@ -1,4 +1,4 @@ -19901e7be932c65efd46449687db4572 *tests/data/fate/vsynth1-flashsv.flv +6675942f5cd6978f16eff5305578de27 *tests/data/fate/vsynth1-flashsv.flv 14681905 tests/data/fate/vsynth1-flashsv.flv 947cb24ec45a453348ae6fe3fa278071 *tests/data/fate/vsynth1-flashsv.out.rawvideo stddev: 2.85 PSNR: 39.03 MAXDIFF: 49 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-flv b/tests/ref/vsynth/vsynth1-flv index 677e7d6a24..a92658b13d 100644 --- a/tests/ref/vsynth/vsynth1-flv +++ b/tests/ref/vsynth/vsynth1-flv @@ -1,4 +1,4 @@ -615daf949171f5ce2ca9f3fd2a78b9b3 *tests/data/fate/vsynth1-flv.flv +202e8b9715f278497eb13476fc9abdac *tests/data/fate/vsynth1-flv.flv 636249 tests/data/fate/vsynth1-flv.flv 5ab46d8dd01dbb1d63df2a84858a4b05 *tests/data/fate/vsynth1-flv.out.rawvideo stddev: 8.02 PSNR: 30.04 MAXDIFF: 105 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-flashsv b/tests/ref/vsynth/vsynth2-flashsv index 91946744a4..b05e746f8c 100644 --- a/tests/ref/vsynth/vsynth2-flashsv +++ b/tests/ref/vsynth/vsynth2-flashsv @@ -1,4 +1,4 @@ -ce94a90c07434a4ebcbcab70ea69c17c *tests/data/fate/vsynth2-flashsv.flv +cd771e2b159450e63e38e26b872e548e *tests/data/fate/vsynth2-flashsv.flv 12368933 tests/data/fate/vsynth2-flashsv.flv 592b3321994e26a990deb3a0a1415de9 *tests/data/fate/vsynth2-flashsv.out.rawvideo stddev: 0.65 PSNR: 51.84 MAXDIFF: 14 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-flv b/tests/ref/vsynth/vsynth2-flv index 1984628d09..3047fb714e 100644 --- a/tests/ref/vsynth/vsynth2-flv +++ b/tests/ref/vsynth/vsynth2-flv @@ -1,4 +1,4 @@ -9a24ba8cf7fe6c20c586a00b371eeb0b *tests/data/fate/vsynth2-flv.flv +747633a169bbfe4622c6c1a7990deafd *tests/data/fate/vsynth2-flv.flv 131340 tests/data/fate/vsynth2-flv.flv 8999c8264fb0941561f64c4a736e9d88 *tests/data/fate/vsynth2-flv.out.rawvideo stddev: 5.33 PSNR: 33.59 MAXDIFF: 80 bytes: 7603200/ 7603200