Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

AvFormatDecoder: add FORCE_DTS_TIMESTAMPS environment variable

This allows a user to force the player to use video dts timestamps for av-sync
purposes in the event they have material with busted pts timestamps.

backport 40c69e1

Fixes #10007.
  • Loading branch information...
commit 02dd6ee9b999d647d4a151390c18e4a82d7b38d9 1 parent 3449b0f
@tralph tralph authored
View
17 mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -268,6 +268,7 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
pts_detected(false),
reordered_pts_detected(false),
pts_selected(true),
+ force_dts_timestamps(false),
using_null_videoout(use_null_videoout),
video_codec_id(kCodec_NONE),
no_hardware_decoders(no_hardware_decode),
@@ -1073,6 +1074,9 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
.arg(framenum));
}
+ if (getenv("FORCE_DTS_TIMESTAMPS"))
+ force_dts_timestamps = true;
+
// Return true if recording has position map
return recordingHasPositionMap;
}
@@ -3121,7 +3125,13 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt)
// the DTS timestamp is missing. Also use fixups for missing PTS instead of
// DTS to avoid oscillating between PTS and DTS. Only select DTS if PTS is
// more faulty or never detected.
- if (ringBuffer->isDVD())
+ if (force_dts_timestamps)
+ {
+ if (pkt->dts != (int64_t)AV_NOPTS_VALUE)
+ pts = pkt->dts;
+ pts_selected = false;
+ }
+ else if (ringBuffer->isDVD())
{
if (pkt->dts != (int64_t)AV_NOPTS_VALUE)
pts = pkt->dts;
@@ -3161,10 +3171,11 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt)
}
VERBOSE(VB_PLAYBACK+VB_TIMESTAMP, LOC +
- QString("video timecode %1 %2 %3 %4 %5 %6 (%7 active)%8")
+ QString("video timecode %1 %2 %3 %4 %5 %6 (%7)%8")
.arg(mpa_pic.reordered_opaque).arg(pkt->pts).arg(pkt->dts)
.arg(vpts).arg(temppts).arg(lastvpts)
- .arg((pts_selected) ? "reordered" : "dts")
+ .arg((force_dts_timestamps) ? "dts forced" :
+ (pts_selected) ? "reordered" : "dts")
.arg((vpts != temppts) ? " fixup" : ""));
/* XXX: Broken.
View
2  mythtv/libs/libmythtv/avformatdecoder.h
@@ -288,6 +288,8 @@ class AvFormatDecoder : public DecoderBase
bool reordered_pts_detected;
bool pts_selected;
+ bool force_dts_timestamps;
+
bool using_null_videoout;
MythCodecID video_codec_id;
bool no_hardware_decoders;
Please sign in to comment.
Something went wrong with that request. Please try again.