From b4c753487cf819213740d39c49b7bdc45338305d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 02:31:07 +0200 Subject: [PATCH] asfenc: avoid negative timestamps Fixes Ticket1606 Signed-off-by: Michael Niedermayer --- libavformat/asfenc.c | 3 +++ tests/ref/lavf/asf | 2 +- tests/ref/seek/lavf_asf | 54 ++++++++++++++++++++--------------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 8d169f7e2e..82681d24f1 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -579,6 +579,9 @@ static int asf_write_header(AVFormatContext *s) ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); + if (s->avoid_negative_ts < 0) + s->avoid_negative_ts = 1; + return 0; } diff --git a/tests/ref/lavf/asf b/tests/ref/lavf/asf index 5777d8b1a7..cfa53dcc73 100644 --- a/tests/ref/lavf/asf +++ b/tests/ref/lavf/asf @@ -1,3 +1,3 @@ -6dfad1f3d0f2638ea46f08edaf482f26 *./tests/data/lavf/lavf.asf +3937dfece4b48c0cdd8f44bcab3cdd2d *./tests/data/lavf/lavf.asf 333581 ./tests/data/lavf/lavf.asf ./tests/data/lavf/lavf.asf CRC=0x51485213 diff --git a/tests/ref/seek/lavf_asf b/tests/ref/seek/lavf_asf index 1427997890..9a14895513 100644 --- a/tests/ref/seek/lavf_asf +++ b/tests/ref/seek/lavf_asf @@ -1,53 +1,53 @@ -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 0 flags:1 ts:-0.317000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:0 ts: 2.577000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 ts: 1.471000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 0 flags:0 ts: 2.153000 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 0 flags:1 ts: 1.048000 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:0 ts:-0.058000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 ts: 2.836000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 0 flags:0 ts:-0.482000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 0 flags:1 ts: 2.413000 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:0 ts: 1.307000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 ts: 0.201000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:0 ts:-0.904994 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 0 flags:0 ts: 0.883000 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 0 flags:1 ts:-0.222000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:0 ts: 2.672000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 ts: 1.566000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208