<div dir="ltr"><div>After re-reading the whole video_ouput.c file, I agree with you, it seems to me that vout_DisableWindow should simply not release the decoder device.</div><div>I can confirm it fixes the problem.</div><div><br></div><div>Let me know if this is the correct way of fixing it, I'll send the patch straight away<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 26 févr. 2020 à 13:21, Alexandre Janniaux <<a href="mailto:ajanni@videolabs.io">ajanni@videolabs.io</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
On Wed, Feb 26, 2020 at 12:07:14PM +0100, Quentin Chateau wrote:<br>
> Hi,<br>
><br>
> what happens is that a failed decoder_UpdateVideoOutput ends up calling<br>
> vout_DisableWindow (at least in my case), which resets sys->dec_device. On<br>
> the second call to decoder_UpdateVideoOutput, the assert line 1576 of the<br>
> file src/video_output/video_output.c fails.<br>
<br>
I believe the problem lies here. Disabling a window should<br>
not do anything to the decoder device, as we don't even need<br>
the window to be enabled to use it.<br>
<br>
<br>
><br>
> Was not sure what the VLC core behavior was supposed to be, so I assumed the<br>
> bug came from the nvdec module, which is pretty new.<br>
><br>
> On 26/02/2020 11:03, Thomas Guillem wrote:<br>
> > Hello,<br>
> ><br>
> > Are you sure it's not a bug in VLC core ? A failing decoder_UpdateVideoOutput() should not invalidate the video context.<br>
> > Anyway, it need to be documented in vlc_codec.h<br>
> ><br>
> > I will wait for steve (that is AFK until Monday) before doing anything.<br>
> ><br>
> > On Wed, Feb 26, 2020, at 00:05, Quentin Chateau wrote:<br>
> > > The vlc_video_context needs to be re-created after<br>
> > > each call to decoder_UpdateVideoOutput.<br>
> > > ---<br>
> > > modules/hw/nvdec/nvdec.c | 30 ++++++++++++++++--------------<br>
> > > 1 file changed, 16 insertions(+), 14 deletions(-)<br>
> > ><br>
> > > diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c<br>
> > > index e5cda56ef3..7720da0201 100644<br>
> > > --- a/modules/hw/nvdec/nvdec.c<br>
> > > +++ b/modules/hw/nvdec/nvdec.c<br>
> > > @@ -912,20 +912,6 @@ static int OpenDecoder(vlc_object_t *p_this)<br>
> > > goto error;<br>
> > > }<br>
> > > - vlc_decoder_device *dec_device = decoder_GetDecoderDevice( p_dec );<br>
> > > - if (dec_device == NULL)<br>
> > > - goto error;<br>
> > > - if (dec_device->type == VLC_DECODER_DEVICE_NVDEC)<br>
> > > - {<br>
> > > - p_sys->vctx_out = vlc_video_context_Create( dec_device,<br>
> > > VLC_VIDEO_CONTEXT_NVDEC, 0, NULL );<br>
> > > - }<br>
> > > - vlc_decoder_device_Release(dec_device);<br>
> > > - if (unlikely(p_sys->vctx_out == NULL))<br>
> > > - {<br>
> > > - msg_Err(p_dec, "failed to create a video context");<br>
> > > - goto error;<br>
> > > - }<br>
> > > -<br>
> > > vlc_fourcc_t output_chromas[3];<br>
> > > size_t chroma_idx = 0;<br>
> > > if (cudaChroma == cudaVideoChromaFormat_420)<br>
> > > @@ -950,6 +936,20 @@ static int OpenDecoder(vlc_object_t *p_this)<br>
> > > for (chroma_idx = 0; output_chromas[chroma_idx] != 0; chroma_idx++)<br>
> > > {<br>
> > > + vlc_decoder_device *dec_device =<br>
> > > decoder_GetDecoderDevice(p_dec);<br>
> > > + if (dec_device == NULL)<br>
> > > + goto error;<br>
> > > + if (dec_device->type == VLC_DECODER_DEVICE_NVDEC)<br>
> > > + {<br>
> > > + p_sys->vctx_out = vlc_video_context_Create(dec_device,<br>
> > > VLC_VIDEO_CONTEXT_NVDEC, 0, NULL);<br>
> > > + }<br>
> > > + vlc_decoder_device_Release(dec_device);<br>
> > > + if (unlikely(p_sys->vctx_out == NULL))<br>
> > > + {<br>
> > > + msg_Err(p_dec, "failed to create a video context");<br>
> > > + goto error;<br>
> > > + }<br>
> > > +<br>
> > > p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma =<br>
> > > output_chromas[chroma_idx];<br>
> > > result = decoder_UpdateVideoOutput(p_dec, p_sys->vctx_out);<br>
> > > if (result == VLC_SUCCESS)<br>
> > > @@ -958,6 +958,8 @@ static int OpenDecoder(vlc_object_t *p_this)<br>
> > > break;<br>
> > > }<br>
> > > msg_Warn(p_dec, "Failed to use output chroma %4.4s",<br>
> > > (char*)&p_dec->fmt_out.video.i_chroma);<br>
> > > + vlc_video_context_Release(p_sys->vctx_out);<br>
> > > + p_sys->vctx_out = NULL;<br>
> > > }<br>
> > > if (result != VLC_SUCCESS)<br>
> > > goto error;<br>
> > > --<br>
> > > 2.20.1<br>
> > ><br>
> > > _______________________________________________<br>
> > > vlc-devel mailing list<br>
> > > To unsubscribe or modify your subscription options:<br>
> > > <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
> > _______________________________________________<br>
> > vlc-devel mailing list<br>
> > To unsubscribe or modify your subscription options:<br>
> > <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a></blockquote></div>