mirror of
https://github.com/pikvm/ustreamer.git
synced 2025-12-24 03:00:01 +00:00
refactoring
This commit is contained in:
parent
2e67a46eb8
commit
6475eeef4c
@ -177,12 +177,11 @@ void us_stream_loop(us_stream_s *stream) {
|
||||
uint slowdown_count = 0;
|
||||
while (!atomic_load(&run->stop) && !atomic_load(&threads_stop)) {
|
||||
us_hw_buffer_s *hw;
|
||||
const int buf_index = us_device_grab_buffer(dev, &hw);
|
||||
switch (buf_index) {
|
||||
switch (us_device_grab_buffer(dev, &hw)) {
|
||||
case -2: continue; // Broken frame
|
||||
case -1: goto close; // Error
|
||||
default: break; // Grabbed on >= 0
|
||||
}
|
||||
assert(buf_index >= 0);
|
||||
|
||||
const sll now_sec_ts = us_floor_ms(us_get_now_monotonic());
|
||||
if (now_sec_ts != captured_fps_ts) {
|
||||
@ -208,7 +207,7 @@ void us_stream_loop(us_stream_s *stream) {
|
||||
us_device_buffer_incref(hw); // RAW
|
||||
us_queue_put(raw_ctx.queue, hw, 0);
|
||||
}
|
||||
us_queue_put(releasers[buf_index].queue, hw, 0); // Plan to release
|
||||
us_queue_put(releasers[hw->buf.index].queue, hw, 0); // Plan to release
|
||||
|
||||
// Мы не обновляем здесь состояние синков, потому что это происходит внутри обслуживающих их потоков
|
||||
_stream_check_suicide(stream);
|
||||
|
||||
@ -216,12 +216,11 @@ static void _main_loop(void) {
|
||||
}
|
||||
|
||||
us_hw_buffer_s *hw;
|
||||
const int n_buf = us_device_grab_buffer(dev, &hw);
|
||||
switch (n_buf) {
|
||||
switch (us_device_grab_buffer(dev, &hw)) {
|
||||
case -2: continue; // Broken frame
|
||||
case -1: goto close; // Any error
|
||||
default: break; // Grabbed on >= 0
|
||||
}
|
||||
assert(n_buf >= 0);
|
||||
|
||||
if (drm_opened == 0) {
|
||||
CHECK(us_drm_expose_dma(drm, hw));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user