@@ -896,7 +896,7 @@ void VideoDecoder::convertAVFrameToDecodedOutputOnCPU(
896896 torch::Tensor tensor;
897897 if (output.streamType == AVMEDIA_TYPE_VIDEO) {
898898 if (streamInfo.colorConversionLibrary == ColorConversionLibrary::SWSCALE) {
899- int height, width;
899+ int height = 0 , width = 0 ;
900900 std::tie (height, width) =
901901 getHeightAndWidthFromOptionsOrAVFrame (streamInfo.options , frame);
902902 if (preAllocatedOutputTensor.has_value ()) {
@@ -1380,7 +1380,11 @@ torch::Tensor VideoDecoder::convertFrameToTensorUsingFilterGraph(
13801380 ffmpegStatus =
13811381 av_buffersink_get_frame (filterState.sinkContext , filteredFrame.get ());
13821382 TORCH_CHECK_EQ (filteredFrame->format , AV_PIX_FMT_RGB24);
1383- std::vector<int64_t > shape = {filteredFrame->height , filteredFrame->width , 3 };
1383+ int height = 0 , width = 0 ;
1384+ std::tie (height, width) = getHeightAndWidthFromOptionsOrAVFrame (
1385+ streams_[streamIndex].options , filteredFrame.get ());
1386+ std::vector<int64_t > shape = {height, width, 3 };
1387+
13841388 std::vector<int64_t > strides = {filteredFrame->linesize [0 ], 3 , 1 };
13851389 AVFrame* filteredFramePtr = filteredFrame.release ();
13861390 auto deleter = [filteredFramePtr](void *) {
0 commit comments