From d1af41f0e71f54a4a9e2a30a5a4649b3c60ba227 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Mon, 13 Sep 2010 21:46:54 +0200 Subject: [PATCH] Fix got_pts computation wrt start_time Substract start_time from got_pts after actually getting got_pts, and then rescale the result. --- src/transcode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/transcode.c b/src/transcode.c index da389975..30d3b807 100644 --- a/src/transcode.c +++ b/src/transcode.c @@ -308,10 +308,12 @@ transcode_seek(struct transcode_ctx *ctx, int ms) ctx->apacket_size = ctx->apacket.size; /* Compute position in ms from pts */ + got_pts = ctx->apacket.pts; + if ((start_time != AV_NOPTS_VALUE) && (start_time > 0)) got_pts -= start_time; - got_pts = av_rescale_q(ctx->apacket.pts, ctx->fmtctx->streams[ctx->astream]->time_base, AV_TIME_BASE_Q); + got_pts = av_rescale_q(got_pts, ctx->fmtctx->streams[ctx->astream]->time_base, AV_TIME_BASE_Q); got_ms = got_pts / (AV_TIME_BASE / 1000); DPRINTF(E_DBG, L_XCODE, "Seek wanted %d ms, got %d ms\n", ms, got_ms);