obs-ffmpeg: Handle null frames in frame callbacks

This is in preparation of an API change that will send null
frames to signal the end of the media being played.
master
kc5nra 2015-03-24 00:16:35 -05:00
parent b091b03291
commit c7ad555eae
1 changed files with 7 additions and 0 deletions

View File

@ -247,6 +247,10 @@ static bool video_frame(struct ff_frame *frame, void *opaque)
double d_pts;
uint64_t pts;
if (frame == NULL) {
return true;
}
d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts;
pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L);
@ -274,6 +278,9 @@ static bool audio_frame(struct ff_frame *frame, void *opaque)
double d_pts;
uint64_t pts;
if (frame == NULL)
return true;
d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts;
pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L);