improved slowdown logic

This commit is contained in:
Devaev Maxim
2021-01-11 13:41:05 +03:00
parent 1e8a06b924
commit d95a6ad0b0

View File

@@ -118,19 +118,23 @@ void stream_loop(stream_s *stream) {
} }
} }
if (atomic_load(&RUN(stop))) { if (stream->slowdown) {
break; for (unsigned slc = 0;
} slc < 10
&& !atomic_load(&RUN(stop))
if (
stream->slowdown
&& !atomic_load(&RUN(video->has_clients)) && !atomic_load(&RUN(video->has_clients))
// has_clients синков НЕ обновляются в реальном времени
&& (stream->sink == NULL || !stream->sink->has_clients) && (stream->sink == NULL || !stream->sink->has_clients)
# ifdef WITH_OMX # ifdef WITH_OMX
&& (RUN(h264) == NULL || /*RUN(h264->sink) == NULL ||*/ !RUN(h264->sink->has_clients)) && (RUN(h264) == NULL || /*RUN(h264->sink) == NULL ||*/ !RUN(h264->sink->has_clients))
# endif # endif
) { ; ++slc) {
usleep(1000000); usleep(100000);
}
}
if (atomic_load(&RUN(stop))) {
break;
} }
bool has_read; bool has_read;