[SCM] libav/experimental: Check pkt.pts against the recording time. This fixes at least ogg encoding with -t where the file was slightly too long.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:59:16 UTC 2013


The following commit has been merged in the experimental branch:
commit f8ccf7200575390b5e40ff3762566786db435ac0
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Mon Feb 1 22:08:45 2010 +0000

    Check pkt.pts against the recording time.
    This fixes at least ogg encoding with -t where the file was slightly too long.
    
    Originally committed as revision 21598 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/ffmpeg.c b/ffmpeg.c
index 9f19b06..3ffd596 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2317,6 +2317,10 @@ static int av_encode(AVFormatContext **output_files,
             }
         }
 
+        /* finish if recording time exhausted */
+        if (pkt.pts * av_q2d(ist->st->time_base) >= (recording_time / 1000000.0))
+            goto discard_packet;
+
         //fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
         if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) {
 
diff --git a/tests/ref/lavf/ogg b/tests/ref/lavf/ogg
index af5f272..0fbec50 100644
--- a/tests/ref/lavf/ogg
+++ b/tests/ref/lavf/ogg
@@ -1,3 +1,3 @@
-767a75e9abf9754bfdc880d6faed69cf *./tests/data/b-lavf.ogg
-14210 ./tests/data/b-lavf.ogg
-./tests/data/b-lavf.ogg CRC=0x37a143ea
+89faca973d88ff2f5dd20992a11de107 *./tests/data/b-lavf.ogg
+14063 ./tests/data/b-lavf.ogg
+./tests/data/b-lavf.ogg CRC=0xf1ae5536
diff --git a/tests/seek.regression.ref b/tests/seek.regression.ref
index cca93e1..cf089aa 100644
--- a/tests/seek.regression.ref
+++ b/tests/seek.regression.ref
@@ -3387,7 +3387,7 @@ ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1365
 ret: 0         st: 0 flags:1  ts:-0.317506
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1384
 ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1369
+ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1223
 ret: 0         st:-1 flags:1  ts: 1.470835
 ret:-EIO
 ret: 0         st: 0 flags:0  ts: 0.365011
@@ -3395,7 +3395,7 @@ ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1390
 ret: 0         st: 0 flags:1  ts:-0.740839
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1384
 ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1369
+ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1223
 ret: 0         st:-1 flags:1  ts: 1.047503
 ret:-EIO
 ret: 0         st: 0 flags:0  ts:-0.058322
@@ -3403,7 +3403,7 @@ ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1390
 ret: 0         st: 0 flags:1  ts: 2.835828
 ret:-EIO
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1369
+ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1223
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1370
 ret: 0         st: 0 flags:0  ts:-0.481655
@@ -3411,7 +3411,7 @@ ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1390
 ret: 0         st: 0 flags:1  ts: 2.412494
 ret:-EIO
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1369
+ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1223
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1384
 ret: 0         st: 0 flags:0  ts:-0.904989
@@ -3419,11 +3419,11 @@ ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1390
 ret: 0         st: 0 flags:1  ts: 1.989184
 ret:-EIO
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret:-EIO
+ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1223
 ret: 0         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1384
 ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1369
+ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:     -1 size:  1223
 ret: 0         st: 0 flags:1  ts: 1.565850
 ret:-EIO
 ret: 0         st:-1 flags:0  ts: 0.460008

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list