Skip to content

Commit

Permalink
For #1634, refactor encoder process management.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 11, 2020
1 parent 927c0c8 commit 66b194c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions trunk/src/app/srs_app_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ srs_error_t SrsEncoder::cycle()
srs_error_t err = srs_success;

while (true) {
if ((err = do_cycle()) != srs_success) {
srs_warn("Encoder: Ignore error, %s", srs_error_desc(err).c_str());
srs_error_reset(err);
}

// We always check status first.
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
if ((err = trd->pull()) != srs_success) {
err = srs_error_wrap(err, "encoder");
break;
}

if ((err = do_cycle()) != srs_success) {
srs_warn("Encoder: Ignore error, %s", srs_error_desc(err).c_str());
srs_error_reset(err);
}

srs_usleep(SRS_RTMP_ENCODER_CIMS);
}
Expand Down

0 comments on commit 66b194c

Please sign in to comment.