Skip to content

Commit b62ed71

Browse files
committed
StreamTranscoder: don't flush encoder before switching to generator if needed
1 parent 691e4fe commit b62ed71

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,7 @@ bool StreamTranscoder::processTranscode()
763763
}
764764
}
765765

766-
// Transform
767-
CodedData data;
766+
// Check decoding status
768767
bool continueProcess = true;
769768
for(size_t index = 0; index < decodingStatus.size(); ++index)
770769
{
@@ -773,6 +772,17 @@ bool StreamTranscoder::processTranscode()
773772
if(!_filterGraph->hasFilters() || !_filterGraph->hasBufferedFrames(index))
774773
{
775774
continueProcess = false;
775+
if(_needToSwitchToGenerator)
776+
{
777+
switchToGeneratorDecoder();
778+
LOG_INFO("Force reallocation of the decoded data buffers since the decoders could have cleared them.")
779+
for(std::vector<IFrame*>::iterator it = _decodedData.begin(); it != _decodedData.end(); ++it)
780+
{
781+
if(! (*it)->isDataAllocated())
782+
(*it)->allocateData();
783+
}
784+
return processTranscode();
785+
}
776786
break;
777787
}
778788
LOG_DEBUG("Some frames remain into filter graph buffer " << index);
@@ -784,8 +794,10 @@ bool StreamTranscoder::processTranscode()
784794
}
785795
}
786796

797+
CodedData data;
787798
if(continueProcess)
788799
{
800+
// Transform
789801
IFrame* dataToTransform = NULL;
790802
if(_filterGraph->hasFilters())
791803
{

0 commit comments

Comments
 (0)