summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Ralph <tralph@mythtv.org>2011-02-16 05:01:31 (GMT)
committer Taylor Ralph <tralph@mythtv.org>2011-02-16 05:07:36 (GMT)
commiteb3c98c5cb899219ddd7dd66877c97655c40d3c4 (patch)
tree9e64e896dd77bdbe296a6815ff7a9247ab789b53
parent83143c04f8109f4819782393ab3e11d37a371ac2 (diff)
Simplify timestamp selection code which fixes AV-sync for AVI video.
-rw-r--r--mythtv/libs/libmythtv/avformatdecoder.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index d74e48c..27b360c 100644
--- a/mythtv/libs/libmythtv/avformatdecoder.cpp
+++ b/mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -64,8 +64,6 @@ extern void ff_read_frame_flush(AVFormatContext *s);
#define MAX_AC3_FRAME_SIZE 6144
-static const bool force_reordered_opaque = false;
-
static const float eps = 1E-5;
static const int max_video_queue_size = 180;
@@ -652,6 +650,7 @@ void AvFormatDecoder::SeekReset(long long newKey, uint skipFrames,
last_pts_for_fault_detection = 0;
last_dts_for_fault_detection = 0;
pts_detected = false;
+ reordered_pts_detected = false;
ff_read_frame_flush(ic);
@@ -2586,6 +2585,7 @@ void AvFormatDecoder::MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)
last_pts_for_fault_detection = 0;
last_dts_for_fault_detection = 0;
pts_detected = false;
+ reordered_pts_detected = false;
// fps debugging info
float avFPS = normalized_fps(stream, context);
@@ -2692,6 +2692,7 @@ bool AvFormatDecoder::H264PreProcessPkt(AVStream *stream, AVPacket *pkt)
last_pts_for_fault_detection = 0;
last_dts_for_fault_detection = 0;
pts_detected = false;
+ reordered_pts_detected = false;
// fps debugging info
float avFPS = normalized_fps(stream, context);
@@ -2775,9 +2776,7 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt)
avcodeclock->lock();
if (private_dec)
{
- if (QString(ic->iformat->name).contains("avi"))
- pkt->pts = pkt->dts;
- if (!pts_detected)
+ if (QString(ic->iformat->name).contains("avi") || !pts_detected)
pkt->pts = pkt->dts;
// TODO disallow private decoders for dvd playback
// N.B. we do not reparse the frame as it breaks playback for
@@ -2834,14 +2833,12 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt)
{
pts = mpa_pic.reordered_opaque;
}
- else if ((force_reordered_opaque || faulty_pts <= faulty_dts ||
- pkt->dts == (int64_t)AV_NOPTS_VALUE) &&
- mpa_pic.reordered_opaque != (int64_t)AV_NOPTS_VALUE)
+ else if (faulty_pts <= faulty_dts && reordered_pts_detected)
{
- pts = mpa_pic.reordered_opaque;
+ if (mpa_pic.reordered_opaque != (int64_t)AV_NOPTS_VALUE)
+ pts = mpa_pic.reordered_opaque;
}
- else if ((faulty_dts < faulty_pts || !reordered_pts_detected) &&
- pkt->dts != (int64_t)AV_NOPTS_VALUE)
+ else if (pkt->dts != (int64_t)AV_NOPTS_VALUE)
{
pts = pkt->dts;
}