- cards[master_card_index].new_frames_changed.wait(lock, [this, master_card_index]{ return !cards[master_card_index].new_frames.empty() || cards[master_card_index].capture->get_disconnected(); });
- }
-
- if (master_card_is_output) {
+ timed_out = !cards[master_card_index].new_frames_changed.wait_for(lock,
+ master_card_timeout,
+ [this, master_card_index]{
+ return !cards[master_card_index].new_frames.empty() ||
+ cards[master_card_index].capture->get_disconnected();
+ });
+ if (timed_out) {
+ fprintf(stderr, "WARNING: Master card (%s) did not deliver a frame for 100 ms, creating a fake one.\n",
+ description_for_card(master_card_index).c_str());
+ }
+ }
+
+ if (timed_out) {
+ // The master card stalled for 100 ms (possible when it's e.g.
+ // an SRT card). Send a frame no matter what; this also makes sure
+ // any other cards get to empty their queues, and in general,
+ // that we make _some_ sort of forward progress.
+ handle_hotplugged_cards();
+ } else if (master_card_is_output) {