[vlc-commits] [Git][videolan/vlc][master] 2 commits: avcodec: fill audio frame channel field

Jean-Baptiste Kempf gitlab at videolan.org
Fri Jun 25 10:23:39 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
321a29b0 by Alaric Senat at 2021-06-25T10:10:11+00:00
avcodec: fill audio frame channel field

Since ffmpeg 4.4 specifying channel layout or channel number is required
to call `avcodec_send_frame()` without error.
This is new requirement is due to a change in the avcodec internal API
brought by 827d6fe73d2f5472c1c2128eb14fab6a4db29032 (ffmpeg repo). They
now call `av_frame_ref` which needs the channels fields to be valid.

Fixes: #25851

- - - - -
e54dadde by Alaric Senat at 2021-06-25T10:10:11+00:00
avcodec: fix assignation indent

- - - - -


1 changed file:

- modules/codec/avcodec/encoder.c


Changes:

=====================================
modules/codec/avcodec/encoder.c
=====================================
@@ -1277,6 +1277,8 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
     av_frame_unref( p_sys->frame );
     p_sys->frame->format     = p_sys->p_context->sample_fmt;
     p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
+    p_sys->frame->channel_layout = p_sys->p_context->channel_layout;
+    p_sys->frame->channels = p_sys->p_context->channels;
 
     if( likely( date_Get( &p_sys->buffer_date ) != VLC_TICK_INVALID) )
     {
@@ -1404,7 +1406,10 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
             p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
         else
             p_sys->frame->nb_samples = p_sys->i_frame_size;
-        p_sys->frame->format     = p_sys->p_context->sample_fmt;
+        p_sys->frame->format = p_sys->p_context->sample_fmt;
+        p_sys->frame->channel_layout = p_sys->p_context->channel_layout;
+        p_sys->frame->channels = p_sys->p_context->channels;
+
         if( likely(date_Get( &p_sys->buffer_date ) != VLC_TICK_INVALID) )
         {
             /* Convert to AV timing */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9f90545da55ea58dba0ad3fb537858c90a23f738...e54daddeaa86308beb43078d18b6c5c6db08c76b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9f90545da55ea58dba0ad3fb537858c90a23f738...e54daddeaa86308beb43078d18b6c5c6db08c76b
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list