flvenc: Don't over-count metadata.
authorJosh Allmann <joshua.allmann@gmail.com>
Wed, 11 Jun 2014 01:45:07 +0000 (18:45 -0700)
committerAnton Khirnov <anton@khirnov.net>
Tue, 17 Jun 2014 19:38:21 +0000 (21:38 +0200)
Over-counting occurs if framerate is not set.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavformat/flvenc.c
tests/ref/lavf/flv_fmt
tests/ref/vsynth/vsynth1-flashsv
tests/ref/vsynth/vsynth1-flv
tests/ref/vsynth/vsynth2-flashsv
tests/ref/vsynth/vsynth2-flv

index e87c256..cc4c782 100644 (file)
@@ -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");
index c0351b3..019204d 100644 (file)
@@ -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
index 615e2a5..a4f22ce 100644 (file)
@@ -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
index 677e7d6..a92658b 100644 (file)
@@ -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
index 9194674..b05e746 100644 (file)
@@ -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
index 1984628..3047fb7 100644 (file)
@@ -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