discover: report confusing number of channels when demuxer and decoder disagree
@gdesmott
Submitted by Guillaume Desmottes Link to original bug (#751031)
Description
I wanted to watch the GoT season finale in surround and so was looking for a release containing the 5.1 audio track. Unfortunately they were all reported as "stereo" according to nautilus file's info screen so I finally decided to watch game.of.thrones.s05e10.720p.hdtv.x264-0sec.mkv anyway. To my surprise, the audio was actually in 5.1 and I've been able to enjoy the death of my favorite characters with a great audio experience!
I took a second look at the media file and totem's media info screen was actually reporting the audio track with 6 channels. mkvinfo agrees about it as well as you can see:
| + A track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 2
| + Lacing flag: 0
| + Language: und
| + Default flag: 0
| + Codec ID: A_AC3
| + Track type: audio
| + Audio track
| + Channels: 6
| + Sampling frequency: 48000
but gst-discover seems confused about it. As you can see the caps reports 6 channels but the "Channels" field only 2:
audio: audio/x-ac3, framed=(boolean)true, channels=(int)6, rate=(int)48000
Tags:
container format: Matroska
encoder: Lavf56.36.100
audio codec: AC-3 (ATSC A/52)
language code: und
bitrate: 384000
Codec:
audio/x-ac3, framed=(boolean)true, channels=(int)6, rate=(int)48000
Additional info:
None
Stream ID: d07ab0288a090e209bf7825305b2589cd3dcdbdded97dc2dc67c3238d7c529d3/002
Language: und
Channels: 2
Sample rate: 48000
Depth: 32
Bitrate: 384000
Max bitrate: 0
I did some digging and it seems that the demuxer detects 6 channels (hence the caps and mkvinfo being correct) but the first audio frame(s) are actually stereo!
0:00:00.239137410 32334 0x7f6ba40cf680 INFO a52dec gsta52dec.c:432:gst_a52dec_reneg:<a52dec0>
reneg channels:2 rate:48000
...
0:00:00.291923950 32334 0x7f6ba40cf680 DEBUG a52dec gsta52dec.c:508:gst_a52dec_handle_frame:<a52dec0>
stream channel flags changed, marking update
0:00:00.293877646 32334 0x7f6ba40cf680 INFO a52dec gsta52dec.c:432:gst_a52dec_reneg:<a52dec0>
reneg channels:6 rate:48000
I'm not sure what's the proper answser here. I guess it makes sense to trust the audio decoder over the demuxer and we can't really read the whole file when discovering. On the other hand, it seems weird that the number of channels reported by GstDiscover doesn't match the one displayed in caps.