Use start_pts instead of start_dts when calculating output pkt.dts. Because start_dts is often lower than start_pts, we can get into a situation where we calculate a dts that is > pts.
This commit is contained in:
parent
d068d019fb
commit
5f6bcec4ca
|
@ -815,26 +815,25 @@ int VideoStore::writeVideoFramePacket(AVPacket *ipkt) {
|
||||||
}
|
}
|
||||||
// Just because the in stream wraps, doesn't mean the out needs to. Really, if we are limiting ourselves to 10min segments I can't imagine every wrapping in the out. So need to handle in wrap, without causing out wrap.
|
// Just because the in stream wraps, doesn't mean the out needs to. Really, if we are limiting ourselves to 10min segments I can't imagine every wrapping in the out. So need to handle in wrap, without causing out wrap.
|
||||||
if ( ipkt->dts != AV_NOPTS_VALUE ) {
|
if ( ipkt->dts != AV_NOPTS_VALUE ) {
|
||||||
|
#if 0
|
||||||
if ( (!video_first_dts) && ( ipkt->dts >= 0 ) ) {
|
if ( (!video_first_dts) && ( ipkt->dts >= 0 ) ) {
|
||||||
// This is the first packet.
|
// This is the first packet.
|
||||||
opkt.dts = 0;
|
opkt.dts = 0;
|
||||||
Debug(1, "Starting video first_dts will become (%" PRId64 ")", ipkt->dts);
|
Debug(1, "Starting video first_dts will become (%" PRId64 ")", ipkt->dts);
|
||||||
video_first_dts = ipkt->dts;
|
video_first_dts = ipkt->dts;
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
opkt.dts = av_rescale_q(
|
opkt.dts = av_rescale_q(
|
||||||
ipkt->dts - video_first_dts,
|
ipkt->dts - video_first_pts,
|
||||||
video_in_stream->time_base,
|
video_in_stream->time_base,
|
||||||
video_out_stream->time_base
|
video_out_stream->time_base
|
||||||
);
|
);
|
||||||
Debug(3, "opkt.dts = %" PRId64 " from ipkt.dts(%" PRId64 ") - first_dts(%" PRId64 ")",
|
Debug(3, "opkt.dts = %" PRId64 " from ipkt.dts(%" PRId64 ") - first_pts(%" PRId64 ")",
|
||||||
opkt.dts, ipkt->dts, video_first_dts);
|
opkt.dts, ipkt->dts, video_first_pts);
|
||||||
video_last_dts = ipkt->dts;
|
video_last_dts = ipkt->dts;
|
||||||
|
#if 0
|
||||||
}
|
}
|
||||||
} else {
|
#endif
|
||||||
Debug(3, "opkt.dts = undef");
|
|
||||||
opkt.dts = AV_NOPTS_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( opkt.dts > opkt.pts ) {
|
if ( opkt.dts > opkt.pts ) {
|
||||||
Debug(1,
|
Debug(1,
|
||||||
"opkt.dts(%" PRId64 ") must be <= opkt.pts(%" PRId64 "). Decompression must happen "
|
"opkt.dts(%" PRId64 ") must be <= opkt.pts(%" PRId64 "). Decompression must happen "
|
||||||
|
@ -842,6 +841,11 @@ int VideoStore::writeVideoFramePacket(AVPacket *ipkt) {
|
||||||
opkt.dts, opkt.pts);
|
opkt.dts, opkt.pts);
|
||||||
opkt.dts = opkt.pts;
|
opkt.dts = opkt.pts;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Debug(3, "opkt.dts = undef");
|
||||||
|
opkt.dts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
opkt.flags = ipkt->flags;
|
opkt.flags = ipkt->flags;
|
||||||
opkt.pos = -1;
|
opkt.pos = -1;
|
||||||
|
|
Loading…
Reference in New Issue