summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-11-05 13:24:41 -0800
committerJohn Stebbins <[email protected]>2015-11-05 13:24:41 -0800
commit671306b1fdddcc94da546d9c273046a58e3124c8 (patch)
tree1b7bd89a917824e1b8a815372c40d875ab11834c
parent4c829b3c2cd3789ae001ce91f7fc0a64c8c66f58 (diff)
stream: fix pts to buffer start conversion
AV_NOPTS_VALUE was getting modified by subtracting an offset. This lead to garbage start values reaching the muxer and causing hangs.
-rw-r--r--libhb/stream.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libhb/stream.c b/libhb/stream.c
index 1d5f0f446..08c1d47ea 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -5590,11 +5590,11 @@ static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream, hb_title_t *title )
return title;
}
-static int64_t av_to_hb_pts( int64_t pts, double conv_factor )
+static int64_t av_to_hb_pts( int64_t pts, double conv_factor, int64_t offset )
{
if ( pts == AV_NOPTS_VALUE )
return AV_NOPTS_VALUE;
- return (int64_t)( (double)pts * conv_factor );
+ return (int64_t)( (double)pts * conv_factor ) - offset;
}
static int ffmpeg_is_keyframe( hb_stream_t *stream )
@@ -5730,8 +5730,8 @@ hb_buffer_t * hb_ffmpeg_read( hb_stream_t *stream )
double tsconv = (double)90000. * s->time_base.num / s->time_base.den;
int64_t offset = 90000L * ffmpeg_initial_timestamp(stream) / AV_TIME_BASE;
- buf->s.start = av_to_hb_pts(stream->ffmpeg_pkt->pts, tsconv) - offset;
- buf->s.renderOffset = av_to_hb_pts(stream->ffmpeg_pkt->dts, tsconv) - offset;
+ buf->s.start = av_to_hb_pts(stream->ffmpeg_pkt->pts, tsconv, offset);
+ buf->s.renderOffset = av_to_hb_pts(stream->ffmpeg_pkt->dts, tsconv, offset);
if ( buf->s.renderOffset >= 0 && buf->s.start == AV_NOPTS_VALUE )
{
buf->s.start = buf->s.renderOffset;
@@ -5789,12 +5789,12 @@ hb_buffer_t * hb_ffmpeg_read( hb_stream_t *stream )
}
if ( ffmpeg_pkt_codec == AV_CODEC_ID_TEXT ) {
int64_t ffmpeg_pkt_duration = stream->ffmpeg_pkt->convergence_duration;
- int64_t buf_duration = av_to_hb_pts( ffmpeg_pkt_duration, tsconv );
+ int64_t buf_duration = av_to_hb_pts( ffmpeg_pkt_duration, tsconv, 0 );
buf->s.stop = buf->s.start + buf_duration;
}
if ( ffmpeg_pkt_codec == AV_CODEC_ID_MOV_TEXT ) {
int64_t ffmpeg_pkt_duration = stream->ffmpeg_pkt->duration;
- int64_t buf_duration = av_to_hb_pts( ffmpeg_pkt_duration, tsconv );
+ int64_t buf_duration = av_to_hb_pts( ffmpeg_pkt_duration, tsconv, 0 );
buf->s.stop = buf->s.start + buf_duration;
}