aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-02-01 22:08:45 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-02-01 22:08:45 +0000
commitf8ccf7200575390b5e40ff3762566786db435ac0 (patch)
tree2dcbeacdaff3502162907a6cb6051c3f7c180d65
parentd2a2b08cfe2ab382a4ad756c0a08ff78eb284ef9 (diff)
downloadffmpeg-f8ccf7200575390b5e40ff3762566786db435ac0.tar.gz
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
-rw-r--r--ffmpeg.c4
-rw-r--r--tests/ref/lavf/ogg6
-rw-r--r--tests/seek.regression.ref12
3 files changed, 13 insertions, 9 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 9f19b06e5d..3ffd596c09 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 af5f272db3..0fbec5099a 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 cca93e1c46..cf089aa0a0 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