+ /* Wait till we can determine the initial pts of all streams */
+ if( next->size != 0 && pv->common->pts_offset == INT64_MIN )
+ {
+ pv->common->first_pts[0] = next->start;
+ hb_lock( pv->common->mutex );
+ while( pv->common->pts_offset == INT64_MIN )
+ {
+ // Full fifos will make us wait forever, so get the
+ // pts offset from the available streams if full
+ if ( hb_fifo_is_full( job->fifo_raw ) )
+ {
+ getPtsOffset( w );
+ hb_cond_broadcast( pv->common->next_frame );
+ }
+ else if ( checkPtsOffset( w ) )
+ hb_cond_broadcast( pv->common->next_frame );
+ else
+ hb_cond_timedwait( pv->common->next_frame, pv->common->mutex, 200 );
+ }
+ hb_unlock( pv->common->mutex );
+ }
+
+ hb_lock( pv->common->mutex );
+ next_start = next->start - pv->common->video_pts_slip;
+ hb_unlock( pv->common->mutex );
+