Skip to content

Commit 95d9d42

Browse files
author
Clement Champetier
committed
Transcoder: fixed how to process a frame for each stream
* Try to process a new frame for each stream (do not exit the method if a stream failed to process). * Skip the generated streams because they always succeed.
1 parent a5b2348 commit 95d9d42

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,33 @@ bool Transcoder::processFrame()
209209
if( _streamTranscoders.size() == 0 )
210210
return false;
211211

212+
// For each stream, process a frame
213+
size_t nbStreamProcessStatusFailed = 0;
212214
for( size_t streamIndex = 0; streamIndex < _streamTranscoders.size(); ++streamIndex )
213215
{
214216
LOG_DEBUG( "Process stream " << streamIndex << "/" << ( _streamTranscoders.size() - 1 ) )
215-
216-
bool streamProcessStatus = _streamTranscoders.at( streamIndex )->processFrame();
217-
if( ! streamProcessStatus )
217+
const bool currentStreamProcessStatus = _streamTranscoders.at( streamIndex )->processFrame();
218+
if( ! currentStreamProcessStatus )
218219
{
219-
return false;
220+
LOG_WARN( "Failed to process stream " << streamIndex )
221+
++nbStreamProcessStatusFailed;
220222
}
221223
}
224+
225+
// Get the number of streams without the generators (they always succeed)
226+
size_t nbStreamsWithoutGenerator = _streamTranscoders.size();
227+
for( size_t streamIndex = 0; streamIndex < _streamTranscoders.size(); ++streamIndex )
228+
{
229+
if( _streamTranscoders.at( streamIndex )->getProcessCase() == StreamTranscoder::eProcessCaseGenerator )
230+
--nbStreamsWithoutGenerator;
231+
}
232+
233+
// If all streams failed to process a new frame
234+
if( nbStreamsWithoutGenerator != 0 && nbStreamProcessStatusFailed == nbStreamsWithoutGenerator )
235+
{
236+
LOG_INFO( "End of process because all streams (except generators) failed to process a new frame." )
237+
return false;
238+
}
222239
return true;
223240
}
224241

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy