mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-29 23:32:33 +00:00
avviddec: Temporarily unlock stream lock while flushing buffers
This can call into the decoder again from other threads and try to take the stream lock from there, which would cause a deadlock. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2558 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4831>
This commit is contained in:
parent
28084aef3e
commit
09cc614bb1
1 changed files with 5 additions and 0 deletions
|
@ -1977,7 +1977,10 @@ gst_ffmpegviddec_drain (GstVideoDecoder * decoder)
|
||||||
do {
|
do {
|
||||||
got_frame = gst_ffmpegviddec_frame (ffmpegdec, NULL, &ret);
|
got_frame = gst_ffmpegviddec_frame (ffmpegdec, NULL, &ret);
|
||||||
} while (got_frame && ret == GST_FLOW_OK);
|
} while (got_frame && ret == GST_FLOW_OK);
|
||||||
|
|
||||||
|
GST_VIDEO_DECODER_STREAM_UNLOCK (ffmpegdec);
|
||||||
avcodec_flush_buffers (ffmpegdec->context);
|
avcodec_flush_buffers (ffmpegdec->context);
|
||||||
|
GST_VIDEO_DECODER_STREAM_LOCK (ffmpegdec);
|
||||||
|
|
||||||
/* FFMpeg will return AVERROR_EOF if it's internal was fully drained
|
/* FFMpeg will return AVERROR_EOF if it's internal was fully drained
|
||||||
* then we are translating it to GST_FLOW_EOS. However, because this behavior
|
* then we are translating it to GST_FLOW_EOS. However, because this behavior
|
||||||
|
@ -2189,7 +2192,9 @@ gst_ffmpegviddec_flush (GstVideoDecoder * decoder)
|
||||||
|
|
||||||
if (ffmpegdec->opened) {
|
if (ffmpegdec->opened) {
|
||||||
GST_LOG_OBJECT (decoder, "flushing buffers");
|
GST_LOG_OBJECT (decoder, "flushing buffers");
|
||||||
|
GST_VIDEO_DECODER_STREAM_UNLOCK (ffmpegdec);
|
||||||
avcodec_flush_buffers (ffmpegdec->context);
|
avcodec_flush_buffers (ffmpegdec->context);
|
||||||
|
GST_VIDEO_DECODER_STREAM_LOCK (ffmpegdec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue