File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1178,7 +1178,14 @@ void SingleStreamDecoder::convertAudioAVFrameToFrameOutputOnCPU(
1178
1178
int desiredSampleRate =
1179
1179
streamInfo.audioStreamOptions .sampleRate .value_or (sourceSampleRate);
1180
1180
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
+ " ." );
1182
1189
int desiredNumChannels =
1183
1190
streamInfo.audioStreamOptions .numChannels .value_or (sourceNumChannels);
1184
1191
Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ class AudioDecoder:
39
39
Note that this index is absolute across all media types. If left unspecified, then
40
40
the :term:`best stream` is used.
41
41
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 .
43
43
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.
45
45
46
46
Attributes:
47
47
metadata (AudioStreamMetadata): Metadata of the audio stream.
You can’t perform that action at this time.
0 commit comments