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.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user