@@ -405,7 +405,8 @@ void SingleStreamDecoder::addStream(
405405 streamInfo.timeBase = formatContext_->streams [activeStreamIndex_]->time_base ;
406406 streamInfo.stream = formatContext_->streams [activeStreamIndex_];
407407 streamInfo.avMediaType = mediaType;
408- streamInfo.deviceInterface = createDeviceInterface (device);
408+
409+ deviceInterface = createDeviceInterface (device);
409410
410411 // This should never happen, checking just to be safe.
411412 TORCH_CHECK (
@@ -417,10 +418,9 @@ void SingleStreamDecoder::addStream(
417418 // TODO_CODE_QUALITY it's pretty meh to have a video-specific logic within
418419 // addStream() which is supposed to be generic
419420 if (mediaType == AVMEDIA_TYPE_VIDEO) {
420- if (streamInfo. deviceInterface ) {
421+ if (deviceInterface) {
421422 avCodec = makeAVCodecOnlyUseForCallingAVFindBestStream (
422- streamInfo.deviceInterface
423- ->findCodec (streamInfo.stream ->codecpar ->codec_id )
423+ deviceInterface->findCodec (streamInfo.stream ->codecpar ->codec_id )
424424 .value_or (avCodec));
425425 }
426426 }
@@ -438,8 +438,8 @@ void SingleStreamDecoder::addStream(
438438
439439 // TODO_CODE_QUALITY same as above.
440440 if (mediaType == AVMEDIA_TYPE_VIDEO) {
441- if (streamInfo. deviceInterface ) {
442- streamInfo. deviceInterface ->initializeContext (codecContext);
441+ if (deviceInterface) {
442+ deviceInterface->initializeContext (codecContext);
443443 }
444444 }
445445
@@ -1210,11 +1210,11 @@ SingleStreamDecoder::convertAVFrameToFrameOutput(
12101210 formatContext_->streams [activeStreamIndex_]->time_base );
12111211 if (streamInfo.avMediaType == AVMEDIA_TYPE_AUDIO) {
12121212 convertAudioAVFrameToFrameOutputOnCPU (avFrame, frameOutput);
1213- } else if (!streamInfo. deviceInterface ) {
1213+ } else if (!deviceInterface) {
12141214 convertAVFrameToFrameOutputOnCPU (
12151215 avFrame, frameOutput, preAllocatedOutputTensor);
1216- } else if (streamInfo. deviceInterface ) {
1217- streamInfo. deviceInterface ->convertAVFrameToFrameOutput (
1216+ } else if (deviceInterface) {
1217+ deviceInterface->convertAVFrameToFrameOutput (
12181218 streamInfo.videoStreamOptions ,
12191219 avFrame,
12201220 frameOutput,
0 commit comments