obs-ffmpeg: Fix spurious bad channel layout

Some formats (like WMV) would send out audio packets that
had channels set but did not specify a channel layout.
Solution is to no longer rely on channel layout to get the
channels and just get the channel count directly off the
FFmpeg audio frame.
This commit is contained in:
John Bradley
2015-03-30 10:56:43 -05:00
parent d42a7ce66e
commit fc596f6141

View File

@@ -289,8 +289,7 @@ static bool audio_frame(struct ff_frame *frame, void *opaque)
d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts;
pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L);
int channels = av_get_channel_layout_nb_channels(
av_frame_get_channel_layout(frame->frame));
int channels = av_frame_get_channels(frame->frame);
for(int i = 0; i < channels; i++)
audio_data.data[i] = frame->frame->data[i];