Commit 6c4493a7 authored by Tristan Matthews's avatar Tristan Matthews

visual: don't crash on empty buffers

Fixes #10533
parent cbea0ade
......@@ -447,6 +447,11 @@ static void *Thread( void *p_data )
int16_t *p_buffs; /* int16_t converted buffer */
int16_t *p_s16_buff; /* int16_t converted buffer */
if (!block->i_nb_samples) {
msg_Err(p_filter, "no samples yet");
goto release;
}
/* Allocate the buffer only if the number of samples change */
if (block->i_nb_samples != p_sys->i_prev_nb_samples)
{
......
......@@ -119,6 +119,11 @@ static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
int16_t *p_buffs; /* int16_t converted buffer */
int16_t *p_s16_buff; /* int16_t converted buffer */
if (!p_buffer->i_nb_samples) {
msg_Err(p_aout, "no samples yet");
return -1;
}
/* Create p_data if needed */
if( !p_data )
{
......@@ -451,6 +456,11 @@ static int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
int16_t *p_buffs; /* int16_t converted buffer */
int16_t *p_s16_buff; /* int16_t converted buffer */
if (!p_buffer->i_nb_samples) {
msg_Err(p_aout, "no samples yet");
return -1;
}
/* Create the data struct if needed */
spectrometer_data *p_data = p_effect->p_data;
if( !p_data )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment