Skip to content

Commit 2c9eb1f

Browse files
committed
Explicitly set frames pts values
1 parent 16b902d commit 2c9eb1f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/torchcodec/_core/Encoder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ void AudioEncoder::encode() {
293293
encodeInnerLoop(autoAVPacket, convertedAVFrame);
294294

295295
numEncodedSamples += numSamplesToEncode;
296-
// TODO-ENCODING set frame pts correctly, and test against it.
297-
// avFrame->pts += static_cast<int64_t>(numSamplesToEncode);
296+
avFrame->pts += static_cast<int64_t>(numSamplesToEncode);
298297
}
299298
TORCH_CHECK(numEncodedSamples == numSamples, "Hmmmmmm something went wrong.");
300299

src/torchcodec/_core/FFMPEGCommon.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ UniqueAVFrame convertAudioAVFrameSamples(
274274
convertedAVFrame,
275275
"Could not allocate frame for sample format conversion.");
276276

277+
convertedAVFrame->pts = srcAVFrame->pts;
277278
convertedAVFrame->format = static_cast<int>(outSampleFormat);
278279

279280
convertedAVFrame->sample_rate = outSampleRate;

0 commit comments

Comments
 (0)