Skip to content

Commit 0350ade

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 450b338 commit 0350ade

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,32 @@ bool Transcoder::processFrame()
234234
if(_streamTranscoders.size() == 0)
235235
return false;
236236

237+
// For each stream, process a frame
238+
size_t nbStreamProcessStatusFailed = 0;
237239
for(size_t streamIndex = 0; streamIndex < _streamTranscoders.size(); ++streamIndex)
238240
{
239241
LOG_DEBUG("Process stream " << streamIndex << "/" << (_streamTranscoders.size() - 1))
240-
241-
bool streamProcessStatus = _streamTranscoders.at(streamIndex)->processFrame();
242-
if(!streamProcessStatus)
242+
if(!_streamTranscoders.at(streamIndex)->processFrame())
243243
{
244-
return false;
244+
LOG_WARN("Failed to process stream " << streamIndex)
245+
++nbStreamProcessStatusFailed;
245246
}
246247
}
248+
249+
// Get the number of streams without the generators (they always succeed)
250+
size_t nbStreamsWithoutGenerator = _streamTranscoders.size();
251+
for(size_t streamIndex = 0; streamIndex < _streamTranscoders.size(); ++streamIndex)
252+
{
253+
if(_streamTranscoders.at(streamIndex)->getProcessCase() == StreamTranscoder::eProcessCaseGenerator)
254+
--nbStreamsWithoutGenerator;
255+
}
256+
257+
// If all streams failed to process a new frame
258+
if(nbStreamsWithoutGenerator != 0 && nbStreamsWithoutGenerator == nbStreamProcessStatusFailed)
259+
{
260+
LOG_INFO("End of process because all streams (except generators) failed to process a new frame.")
261+
return false;
262+
}
247263
return true;
248264
}
249265

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