Skip to content

Commit 8c5d4d1

Browse files
author
Clement Champetier
committed
Transcoder: clean how to get AVMediaType
Also log it.
1 parent 15f86a4 commit 8c5d4d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,13 @@ void Transcoder::fillProcessStat( ProcessStat& processStat )
521521
for( size_t streamIndex = 0; streamIndex < _streamTranscoders.size(); ++streamIndex )
522522
{
523523
IOutputStream& stream = _streamTranscoders.at( streamIndex )->getOutputStream();
524-
AVCodecContext& encoderContext = _streamTranscoders.at( streamIndex )->getEncoder().getCodec().getAVCodecContext();
525-
switch( encoderContext.codec_type )
524+
const AVMediaType mediaType = _streamTranscoders.at( streamIndex )->getInputStream().getStreamType();
525+
switch( mediaType )
526526
{
527527
case AVMEDIA_TYPE_VIDEO:
528528
{
529529
VideoStat videoStat( stream.getStreamDuration(), stream.getNbFrames() );
530+
const AVCodecContext& encoderContext = _streamTranscoders.at( streamIndex )->getEncoder().getCodec().getAVCodecContext();
530531
if( encoderContext.coded_frame && ( encoderContext.flags & CODEC_FLAG_PSNR) )
531532
{
532533
videoStat._quality = encoderContext.coded_frame->quality;
@@ -542,7 +543,7 @@ void Transcoder::fillProcessStat( ProcessStat& processStat )
542543
break;
543544
}
544545
default:
545-
LOG_WARN( "No process statistics for stream at index: " << streamIndex )
546+
LOG_WARN( "No process statistics for stream at index: " << streamIndex << " (AVMediaType = " << mediaType << ")" )
546547
break;
547548
}
548549
}

0 commit comments

Comments
 (0)