Skip to content

Commit 6aa7b09

Browse files
committed
Rename avFrame into srcAVFrame
1 parent ca15232 commit 6aa7b09

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ void VideoDecoder::convertAudioAVFrameToFrameOutputOnCPU(
13991399
}
14001400

14011401
UniqueAVFrame VideoDecoder::convertAudioAVFrameSampleFormatAndSampleRate(
1402-
const UniqueAVFrame& avFrame,
1402+
const UniqueAVFrame& srcAVFrame,
14031403
AVSampleFormat sourceSampleFormat,
14041404
AVSampleFormat desiredSampleFormat,
14051405
int sourceSampleRate,
@@ -1420,7 +1420,7 @@ UniqueAVFrame VideoDecoder::convertAudioAVFrameSampleFormatAndSampleRate(
14201420
convertedAVFrame,
14211421
"Could not allocate frame for sample format conversion.");
14221422

1423-
setChannelLayout(convertedAVFrame, avFrame);
1423+
setChannelLayout(convertedAVFrame, srcAVFrame);
14241424
convertedAVFrame->format = static_cast<int>(desiredSampleFormat);
14251425
convertedAVFrame->sample_rate = desiredSampleRate;
14261426
if (sourceSampleRate != desiredSampleRate) {
@@ -1431,12 +1431,12 @@ UniqueAVFrame VideoDecoder::convertAudioAVFrameSampleFormatAndSampleRate(
14311431
// `swr_convert()`.
14321432
convertedAVFrame->nb_samples = av_rescale_rnd(
14331433
swr_get_delay(streamInfo.swrContext.get(), sourceSampleRate) +
1434-
avFrame->nb_samples,
1434+
srcAVFrame->nb_samples,
14351435
desiredSampleRate,
14361436
sourceSampleRate,
14371437
AV_ROUND_UP);
14381438
} else {
1439-
convertedAVFrame->nb_samples = avFrame->nb_samples;
1439+
convertedAVFrame->nb_samples = srcAVFrame->nb_samples;
14401440
}
14411441

14421442
auto status = av_frame_get_buffer(convertedAVFrame.get(), 0);
@@ -1449,8 +1449,8 @@ UniqueAVFrame VideoDecoder::convertAudioAVFrameSampleFormatAndSampleRate(
14491449
streamInfo.swrContext.get(),
14501450
convertedAVFrame->data,
14511451
convertedAVFrame->nb_samples,
1452-
static_cast<const uint8_t**>(const_cast<const uint8_t**>(avFrame->data)),
1453-
avFrame->nb_samples);
1452+
static_cast<const uint8_t**>(const_cast<const uint8_t**>(srcAVFrame->data)),
1453+
srcAVFrame->nb_samples);
14541454
TORCH_CHECK(
14551455
numConvertedSamples > 0,
14561456
"Error in swr_convert: ",

src/torchcodec/decoders/_core/VideoDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class VideoDecoder {
401401
torch::Tensor& outputTensor);
402402

403403
UniqueAVFrame convertAudioAVFrameSampleFormatAndSampleRate(
404-
const UniqueAVFrame& avFrame,
404+
const UniqueAVFrame& srcAVFrame,
405405
AVSampleFormat sourceSampleFormat,
406406
AVSampleFormat desiredSampleFormat,
407407
int sourceSampleRate,

0 commit comments

Comments
 (0)