File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1178,7 +1178,14 @@ void SingleStreamDecoder::convertAudioAVFrameToFrameOutputOnCPU(
11781178 int desiredSampleRate =
11791179 streamInfo.audioStreamOptions .sampleRate .value_or (sourceSampleRate);
11801180
1181- int sourceNumChannels = getNumChannels (srcAVFrame);
1181+ int sourceNumChannels = getNumChannels (streamInfo.codecContext );
1182+ TORCH_CHECK (
1183+ sourceNumChannels == getNumChannels (srcAVFrame),
1184+ " The Frame has " ,
1185+ getNumChannels (srcAVFrame),
1186+ " channels, expected " ,
1187+ sourceNumChannels,
1188+ " ." );
11821189 int desiredNumChannels =
11831190 streamInfo.audioStreamOptions .numChannels .value_or (sourceNumChannels);
11841191
Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ class AudioDecoder:
3939 Note that this index is absolute across all media types. If left unspecified, then
4040 the :term:`best stream` is used.
4141 sample_rate (int, optional): The desired output sample rate of the decoded samples.
42- By default, the samples are returned in their original sample rate .
42+ By default, the sample rate of the source is used .
4343 num_channels (int, optional): The desired number of channels of the decoded samples.
44- By default, the original number of channels is used.
44+ By default, the number of channels of the source is used.
4545
4646 Attributes:
4747 metadata (AudioStreamMetadata): Metadata of the audio stream.
You can’t perform that action at this time.
0 commit comments