mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
videodecoder: avoid crash when getting duration
Check that we have a valid output_state before attempting to use it to calculate the duration of a buffer. It is possible that we don't have a state yet, for example when we are dropping the first buffers.
This commit is contained in:
parent
43e94eea98
commit
c68683c15f
1 changed files with 5 additions and 0 deletions
|
@ -2342,6 +2342,11 @@ gst_video_decoder_get_frame_duration (GstVideoDecoder * decoder,
|
|||
{
|
||||
GstVideoCodecState *state = decoder->priv->output_state;
|
||||
|
||||
/* it's possible that we don't have a state yet when we are dropping the
|
||||
* initial buffers */
|
||||
if (state == NULL)
|
||||
return GST_CLOCK_TIME_NONE;
|
||||
|
||||
if (state->info.fps_d == 0 || state->info.fps_n == 0) {
|
||||
return GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue