mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-09 19:09:41 +00:00
vaapidecode: Check the condition after taking the lock
Otherwise the condition could become true before the lock is taken and the g_cond_signal() could be called before the g_cond_wait(), so the g_cond_wait() is never awoken. https://bugzilla.gnome.org/show_bug.cgi?id=740645
This commit is contained in:
parent
d2e2784a78
commit
fc7e6b19fd
3 changed files with 7 additions and 5 deletions
|
@ -129,6 +129,9 @@ gst_vaapi_decoder_decode (GstVaapiDecoder * decoder,
|
|||
GstVaapiDecoderStatus
|
||||
gst_vaapi_decoder_flush (GstVaapiDecoder * decoder);
|
||||
|
||||
GstVaapiDecoderStatus
|
||||
gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPI_DECODER_H */
|
||||
|
|
|
@ -273,10 +273,6 @@ void
|
|||
gst_vaapi_decoder_push_frame (GstVaapiDecoder * decoder,
|
||||
GstVideoCodecFrame * frame);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GstVaapiDecoderStatus
|
||||
gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GstVaapiDecoderStatus
|
||||
gst_vaapi_decoder_decode_codec_data (GstVaapiDecoder * decoder);
|
||||
|
|
|
@ -235,13 +235,16 @@ gst_vaapidecode_decode_frame(GstVideoDecoder *vdec, GstVideoCodecFrame *frame)
|
|||
GstVaapiDecoderStatus status;
|
||||
GstFlowReturn ret;
|
||||
|
||||
|
||||
/* Decode current frame */
|
||||
for (;;) {
|
||||
status = gst_vaapi_decoder_decode(decode->decoder, frame);
|
||||
if (status == GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE) {
|
||||
GST_VIDEO_DECODER_STREAM_UNLOCK(vdec);
|
||||
g_mutex_lock(&decode->decoder_mutex);
|
||||
g_cond_wait(&decode->decoder_ready, &decode->decoder_mutex);
|
||||
if (gst_vaapi_decoder_check_status (decode->decoder) ==
|
||||
GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE)
|
||||
g_cond_wait(&decode->decoder_ready, &decode->decoder_mutex);
|
||||
g_mutex_unlock(&decode->decoder_mutex);
|
||||
GST_VIDEO_DECODER_STREAM_LOCK(vdec);
|
||||
if (decode->decoder_loop_status < 0)
|
||||
|
|
Loading…
Reference in a new issue