When doing point-to-point encoding, subtitles can cause a long delay in finishing the job when the stop point is reached. This is due to the sparse nature of subtitles. We may not even see any additional subtitle till we reach the end of the file. So when all audio and video streams have reached the end point, force the termination of all subtitle streams by pushing an end-of-stream buffer into
| 1392 | // This will cause each subtitle sync worker to wake and return |
| 1393 | // HB_WORK_DONE. |
| 1394 | static void terminateSubtitleStreams( sync_common_t * common ) |
| 1395 | { |
| 1396 | int ii; |
| 1397 | |
| 1398 | // Make sure all streams are complete |
| 1399 | for (ii = 0; ii < common->stream_count; ii++) |
| 1400 | { |
| 1401 | sync_stream_t * stream = &common->streams[ii]; |
| 1402 | if (stream->type == SYNC_TYPE_SUBTITLE) |
| 1403 | { |
| 1404 | continue; |
| 1405 | } |
| 1406 | if (!stream->done) |
| 1407 | { |
| 1408 | return; |
| 1409 | } |
| 1410 | } |
| 1411 | |
| 1412 | // Terminate all subtitle streams |
| 1413 | for (ii = 0; ii < common->stream_count; ii++) |
| 1414 | { |
| 1415 | sync_stream_t * stream = &common->streams[ii]; |
| 1416 | if (stream->done || stream->type != SYNC_TYPE_SUBTITLE) |
| 1417 | { |
| 1418 | continue; |
| 1419 | } |
| 1420 | fifo_push(stream->fifo_in, hb_buffer_eof_init()); |
| 1421 | stream->done = 1; |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | // OutputBuffer pulls buffers from the internal sync buffer queues in |
| 1426 | // lowest PTS first order. It then processes the queue the buffer is |
no test coverage detected