summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-11-05 16:43:54 +0000
committerjstebbins <[email protected]>2014-11-05 16:43:54 +0000
commit621c1fc9e9c2fed72036a97aacc2674d250cdba0 (patch)
tree2b6aa6bb2b21c33ab0bae6de4451f9b4f011add4 /libhb
parent46c3430a60c08cb3b4caca9b6e53d4e0f69a6a52 (diff)
libhb: fix p-to-p start for some streams
The primary problem was in setting our "zero" time in reader based on a stream that is not decoded. Since this stream never reaches sync, there would appear to be a long initial frame from syncs perspective. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6506 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/reader.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/libhb/reader.c b/libhb/reader.c
index 4fd56ff1c..11729601c 100644
--- a/libhb/reader.c
+++ b/libhb/reader.c
@@ -128,7 +128,8 @@ static int hb_reader_init( hb_work_object_t * w, hb_job_t * job )
// The frame at the actual start time may not be an i-frame
// so can't be decoded without starting a little early.
// sync.c will drop early frames.
- r->pts_to_start = MAX(0, job->pts_to_start - 180000);
+ // Starting a little over 10 seconds early
+ r->pts_to_start = MAX(0, job->pts_to_start - 1000000);
}
if (job->pts_to_stop)
@@ -278,7 +279,7 @@ static void update_ipt( hb_work_private_t *r, const hb_buffer_t *buf )
{
stream_timing_t *st = id_to_st( r, buf, 1 );
- if( buf->s.renderOffset < 0 )
+ if (buf->s.renderOffset == AV_NOPTS_VALUE)
{
st->last += st->filtered_average;
return;
@@ -441,7 +442,7 @@ void ReadLoop( void * _w )
// and then seek to the appropriate offset from it
if ( ( buf = hb_stream_read( r->stream ) ) )
{
- if ( buf->s.start > 0 )
+ if (buf->s.start != AV_NOPTS_VALUE)
{
pts_to_start += buf->s.start;
}
@@ -531,21 +532,6 @@ void ReadLoop( void * _w )
}
}
}
- if (r->stream && r->start_found == 2 )
- {
- // We will inspect the timestamps of each frame in sync
- // to skip from this seek point to the timestamp we
- // want to start at.
- if ( buf->s.start > 0 && buf->s.start < r->job->pts_to_start )
- {
- r->job->pts_to_start -= buf->s.start;
- }
- else if ( buf->s.start >= r->job->pts_to_start )
- {
- r->job->pts_to_start = 0;
- }
- r->start_found = 1;
- }
(hb_demux[r->title->demuxer])( buf, list, &r->demux );
@@ -554,6 +540,23 @@ void ReadLoop( void * _w )
hb_list_rem( list, buf );
fifos = GetFifoForId( r, buf->s.id );
+ if (fifos && r->stream && r->start_found == 2 )
+ {
+ // We will inspect the timestamps of each frame in sync
+ // to skip from this seek point to the timestamp we
+ // want to start at.
+ if (buf->s.start != AV_NOPTS_VALUE &&
+ buf->s.start < r->job->pts_to_start)
+ {
+ r->job->pts_to_start -= buf->s.start;
+ }
+ else if ( buf->s.start >= r->job->pts_to_start )
+ {
+ r->job->pts_to_start = 0;
+ }
+ r->start_found = 1;
+ }
+
if ( fifos && ! r->saw_video && !r->job->indepth_scan )
{
// The first data packet with a PTS from an audio or video stream