Browse Source

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.
John Bradley 10 years ago
parent
commit
fc596f6141
1 changed files with 1 additions and 2 deletions
  1. 1 2
      plugins/obs-ffmpeg/obs-ffmpeg-source.c

+ 1 - 2
plugins/obs-ffmpeg/obs-ffmpeg-source.c

@@ -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];