Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11941 closed Bug Report - General (fixed)

No audio playback on DVDs with 16-bit stereo PCM audio tracks

Reported by: peper03 Owned by: JYA
Priority: minor Milestone: 0.27.1
Component: MythTV - Audio Output Version: 0.27-fixes
Severity: medium Keywords:
Cc: salstrom@… Ticket locked: no

Description

As reported here: http://www.gossamer-threads.com/lists/mythtv/users/557298 playback of DVDs with 16-bit stereo PCM audio tracks results in no audio and lots of 'audio decoder error' messages in the log.

ffmpeg sets the required codec to 'AV_CODEC_ID_PCM_DVD', which is only valid for 20 or 24 bits per sample. Normally this should be changed to AV_CODEC_ID_PCM_S16BE if the bit-depth is 16 bits, but for some reason this is no longer happening.

A small sample DVD image to reproduce the problem is available in stuartm's DVD repository under the name 'LongIntro_S16PCM.iso'

Change History (6)

comment:1 Changed 6 years ago by peper03

Appears to be the same problem as in #11519 (or very similar). In this case, there is only one audio track so AvFormatDecoder::ScanStreams? doesn't get called again, and the decoder doesn't get re-initialised.

The problem appears to be that PCM encoded audio is assumed by ffmpeg to be 20 or 24 bits per sample, so is marked as 'AV_CODEC_ID_PCM_DVD'. Then the 'streams changed' callback is called and MythTV opens the PCM_DVD codec. When control returns to ffmpeg, it determines that the sample depth is only 16 bits, changes the codec to 'AV_CODEC_ID_PCM_S16BE' but doesn't call the callback. Because of this, MythTV isn't informed of the change and the 16-bit data is fed to a decoder expecting 20 or 24 bits per sample.

comment:2 Changed 6 years ago by JYA

our code shouldn't rely on any callback to detect a change in format.

the callback is only used when there's a change in a mpegts container.... it's a hack and we shouldn't rely on it in the future...

checking that the format hasn't changed from within avfd is the proper way to go; it's also there that change to resolution and format should be handled; outside any callback.

comment:3 Changed 6 years ago by Richard Hulme <peper03@…>

Resolution: fixed
Status: newclosed

In d8c710d204f5769ea4d0304a9a8618eb417f2837/mythtv:

Make ffmpeg call 'streams_changed' again when a DVD PCM stream is changed from PCM_DVD to PCM_S16BE to ensure the correct codec is loaded.

Fixes #11941

comment:4 Changed 6 years ago by Richard Hulme <peper03@…>

In cc247f09460ac362f0fd6ffcd7b25c3139d39b7c/mythtv:

Make ffmpeg call 'streams_changed' again when a DVD PCM stream is changed from PCM_DVD to PCM_S16BE to ensure the correct codec is loaded.

Fixes #11941
(cherry picked from commit d8c710d204f5769ea4d0304a9a8618eb417f2837)

comment:5 Changed 6 years ago by salstrom@…

The fix worked and I now have audio on these types of situations. Thanks!

comment:6 Changed 6 years ago by Raymond Wagner

Milestone: unknown0.27.1
Note: See TracTickets for help on using tickets.