File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
src/torchcodec/decoders/_core Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -1316,17 +1316,15 @@ void VideoDecoder::convertAudioAVFrameToFrameOutputOnCPU(
13161316 VideoDecoder::AVFrameStream& avFrameStream,
13171317 FrameOutput& frameOutput,
13181318 std::optional<torch::Tensor> preAllocatedOutputTensor) {
1319+ TORCH_CHECK (
1320+ !preAllocatedOutputTensor.has_value (),
1321+ " pre-allocated audio tensor not supported yet." );
1322+
13191323 const AVFrame* avFrame = avFrameStream.avFrame .get ();
13201324
13211325 auto numSamples = avFrame->nb_samples ; // per channel
13221326 auto numChannels = getNumChannels (avFrame);
1323-
1324- torch::Tensor outputData;
1325- if (preAllocatedOutputTensor.has_value ()) {
1326- outputData = preAllocatedOutputTensor.value ();
1327- } else {
1328- outputData = torch::empty ({numChannels, numSamples}, torch::kFloat32 );
1329- }
1327+ torch::Tensor outputData = torch::empty ({numChannels, numSamples}, torch::kFloat32 );
13301328
13311329 AVSampleFormat format = static_cast <AVSampleFormat>(avFrame->format );
13321330 // TODO-AUDIO Implement all formats.
You can’t perform that action at this time.
0 commit comments