From bdb3c747159ff77aa36feaeb9365c58c23d512b6 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Mon, 22 Nov 2010 21:52:05 +0000 Subject: fix sync of ssa subtitles when using point-to-point encoding git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3685 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/sync.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libhb/sync.c') diff --git a/libhb/sync.c b/libhb/sync.c index cfc0c2a20..b44765e08 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -317,7 +317,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, return HB_WORK_DONE; } if ( pv->common->count_frames < job->frame_to_start || - next_start < job->pts_to_start ) + next->start < job->pts_to_start ) { // Flush any subtitles that have pts prior to the // current frame @@ -334,7 +334,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, } hb_lock( pv->common->mutex ); // Tell the audio threads what must be dropped - pv->common->audio_pts_thresh = next_start; + pv->common->audio_pts_thresh = next_start + pv->common->video_pts_slip; hb_cond_broadcast( pv->common->next_frame ); hb_unlock( pv->common->mutex ); @@ -345,8 +345,8 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, } hb_lock( pv->common->mutex ); pv->common->audio_pts_thresh = 0; - pv->common->audio_pts_slip = next_start; - pv->common->video_pts_slip = next_start; + pv->common->audio_pts_slip += next_start; + pv->common->video_pts_slip += next_start; next_start = 0; pv->common->start_found = 1; pv->common->count_frames = 0; @@ -989,14 +989,14 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // after hb_sync_init is called. pv->common->audio_pts_thresh = job->pts_to_start; } - if ( start < pv->common->audio_pts_thresh ) + if ( buf->start < pv->common->audio_pts_thresh ) { hb_buffer_close( &buf ); hb_unlock( pv->common->mutex ); return HB_WORK_OK; } while ( !pv->common->start_found && - start >= pv->common->audio_pts_thresh ) + buf->start >= pv->common->audio_pts_thresh ) { hb_cond_timedwait( pv->common->next_frame, pv->common->mutex, 200 ); } -- cgit v1.2.3