[vlc-devel] [PATCH 19/34] sout: sdi: keep the decoder video context locally

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 8 15:40:23 CET 2019


---
 modules/stream_out/sdi/SDIStream.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index 252a88f318d..abcdc79c3d6 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -214,6 +214,7 @@ struct decoder_owner
     AbstractDecodedStream *id;
     bool b_error;
     es_format_t last_fmt_update;
+    vlc_video_context *last_fmt_vctx;
     es_format_t decoder_out;
     vlc_decoder_device *dec_dev;
 };
@@ -426,6 +427,11 @@ void AbstractDecodedStream::ReleaseDecoder()
     p_owner = container_of(p_decoder, struct decoder_owner, dec);
     es_format_Clean(&p_owner->decoder_out);
     es_format_Clean(&p_owner->last_fmt_update);
+    if (p_owner->last_fmt_vctx)
+    {
+        vlc_video_context_Release(p_owner->last_fmt_vctx);
+        p_owner->last_fmt_vctx = NULL;
+    }
     decoder_Destroy( p_decoder );
     p_decoder = NULL;
 }
@@ -517,6 +523,10 @@ int VideoDecodedStream::VideoDecCallback_update_format(decoder_t *p_dec,
     es_format_Clean(&p_owner->last_fmt_update);
     es_format_Copy(&p_owner->last_fmt_update, &p_dec->fmt_out);
 
+    if (p_owner->last_fmt_vctx)
+        vlc_video_context_Release(p_owner->last_fmt_vctx);
+    p_owner->last_fmt_vctx = vlc_video_context_Hold(p_dec->vctx_out);
+
     return VLC_SUCCESS;
 }
 
-- 
2.17.1



More information about the vlc-devel mailing list