Skip to content

Commit 44edb93

Browse files
author
Molly Xu
committed
address feedback
1 parent 11d7adf commit 44edb93

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

src/torchcodec/_core/BetaCudaDeviceInterface.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@ BetaCudaDeviceInterface::~BetaCudaDeviceInterface() {
232232
void BetaCudaDeviceInterface::initialize(
233233
const AVStream* avStream,
234234
const UniqueDecodingAVFormatContext& avFormatCtx,
235-
const SharedAVCodecContext& codecContext) {
235+
[[maybe_unused]] const SharedAVCodecContext& codecContext) {
236236
TORCH_CHECK(avStream != nullptr, "AVStream cannot be null");
237-
codecContext_ = codecContext;
238237
timeBase_ = avStream->time_base;
239238
frameRateAvgFromFFmpeg_ = avStream->r_frame_rate;
240239

src/torchcodec/_core/DeviceInterface.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ class DeviceInterface {
9595
// Returns AVSUCCESS on success, or other AVERROR on failure
9696
// Default implementation uses FFmpeg directly
9797
virtual int sendEOFPacket() {
98-
if (!codecContext_) {
99-
TORCH_CHECK(false, "Codec context not available for EOF packet sending");
100-
return AVERROR(EINVAL);
101-
}
98+
TORCH_CHECK(
99+
codecContext_ != nullptr,
100+
"Codec context not available for default EOF packet sending");
102101
return avcodec_send_packet(codecContext_.get(), nullptr);
103102
}
104103

src/torchcodec/_core/FFMPEGCommon.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,6 @@ int getNumChannels(const UniqueAVFrame& avFrame) {
149149
#endif
150150
}
151151

152-
int getNumChannels(const UniqueAVCodecContext& avCodecContext) {
153-
#if LIBAVFILTER_VERSION_MAJOR > 8 || \
154-
(LIBAVFILTER_VERSION_MAJOR == 8 && LIBAVFILTER_VERSION_MINOR >= 44)
155-
return avCodecContext->ch_layout.nb_channels;
156-
#else
157-
return avCodecContext->channels;
158-
#endif
159-
}
160-
161152
int getNumChannels(const SharedAVCodecContext& avCodecContext) {
162153
#if LIBAVFILTER_VERSION_MAJOR > 8 || \
163154
(LIBAVFILTER_VERSION_MAJOR == 8 && LIBAVFILTER_VERSION_MINOR >= 44)

src/torchcodec/_core/FFMPEGCommon.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ const AVSampleFormat* getSupportedOutputSampleFormats(const AVCodec& avCodec);
173173
const AVPixelFormat* getSupportedPixelFormats(const AVCodec& avCodec);
174174

175175
int getNumChannels(const UniqueAVFrame& avFrame);
176-
int getNumChannels(const UniqueAVCodecContext& avCodecContext);
177176
int getNumChannels(const SharedAVCodecContext& avCodecContext);
178177

179178
void setDefaultChannelLayout(

0 commit comments

Comments
 (0)