alsa-project / alsa-plugins

The Advanced Linux Sound Architecture (ALSA) - plugins
GNU Lesser General Public License v2.1
41 stars 28 forks source link

a52: not compatible with recent avcodec #22

Closed manio closed 3 years ago

manio commented 3 years ago

Hi! Current a52 plugin is not compatible with recent changes in the FFmpeg lib. The symptom is that using newest FFmpeg the a52 plugin produces silent in the speakers. During the weekend I was able to bisect the problem and shed some light on this, and here is what I found out:

  1. The a52 plugin is working fine before commit: https://github.com/FFmpeg/FFmpeg/commit/93016f5d1d280f9cb7856883af287fa66affc04c
  2. Above commit is wrapping avcodec_encode_audio2(), which a52 plugin is using, into new API internally inside the avcodec
  3. All applications should move to new so called "avcodec_send_frame() API"
  4. After the commit in point 1 the a52 output plugin is not working anymore

I was asking the commit author @jamrial about the commit and he said that the main culprit could rather be the commit: https://github.com/FFmpeg/FFmpeg/commit/2d85e6e7230406e33e61d903b9c29ab562e158bd which is changing the S16 to S32 for ac3fixed encoder while the a52 plugin "is ignoring the kind of format the encoder takes as input (Starting from the aforementioned commit, ac3fixed takes S32 planar audio), and unconditionally feeding it S16 planar audio."

I was trying to change the a52 from S16 to S32 but I think some more work is needed on this... I was also try to change the do_encode() function from avcodec_encode_audio2 to avcodec_send_frame() with no luck...

manio commented 3 years ago

Fixed with https://github.com/alsa-project/alsa-plugins/pull/23/ Closing