[vlc-devel] [PATCH 10/48] video_output: do the format check before calling vout_EnableWindow
Steve Lhomme
robux4 at ycbcr.xyz
Fri Oct 11 15:33:24 CEST 2019
---
src/video_output/video_output.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 485d8201935..c4744037f99 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1950,12 +1950,8 @@ static int vout_EnableWindow(const vout_configuration_t *cfg, vlc_decoder_device
assert(!sys->dummy);
assert(vout != NULL);
- assert(cfg->fmt != NULL);
assert(cfg->clock != NULL);
- if (!VoutCheckFormat(cfg->fmt))
- return -1;
-
video_format_t original;
VoutFixFormat(&original, cfg->fmt);
@@ -2020,6 +2016,12 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
vout_thread_t *vout = cfg->vout;
vout_thread_sys_t *sys = vout->p;
+ assert(cfg->fmt != NULL);
+
+ if (!VoutCheckFormat(cfg->fmt))
+ /* don't stop the display and keep sys->original */
+ return -1;
+
if (vout_EnableWindow(cfg, NULL) != 0)
return -1;
@@ -2050,6 +2052,12 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
vlc_decoder_device *vout_GetDevice(const vout_configuration_t *cfg)
{
vlc_decoder_device *dec_device = NULL;
+
+ assert(cfg->fmt != NULL);
+
+ if (!VoutCheckFormat(cfg->fmt))
+ return NULL;
+
if (vout_EnableWindow(cfg, &dec_device) != 0)
return NULL;
return dec_device;
--
2.17.1
More information about the vlc-devel
mailing list