- fprintf(stderr, "Card %u went away, replacing with a fake card.\n", card_index);
- FakeCapture *capture = new FakeCapture(global_flags.width, global_flags.height, FAKE_FPS, OUTPUT_FREQUENCY, card_index, global_flags.fake_cards_audio);
- configure_card(card_index, capture, CardType::FAKE_CAPTURE, /*output=*/nullptr, /*is_srt_card=*/false);
- card->queue_length_policy.reset(card_index);
- card->capture->start_bm_capture();
+ bool is_active = card_index < unsigned(global_flags.min_num_cards) || cards[card_index].force_active;
+ if (is_active) {
+ fprintf(stderr, "Card %u went away, replacing with a fake card.\n", card_index);
+ FakeCapture *capture = new FakeCapture(global_flags.width, global_flags.height, FAKE_FPS, OUTPUT_FREQUENCY, card_index, global_flags.fake_cards_audio);
+ configure_card(card_index, capture, CardType::FAKE_CAPTURE, /*output=*/nullptr, /*is_srt_card=*/false);
+ card->jitter_history.clear();
+ card->capture->start_bm_capture();
+ } else {
+ // NOTE: The theme might end up forcing the card back at some later point
+ // (ie., force_active is false now, but might immediately be true again on
+ // e.g. the next frame). That should be rare, though, so we don't bother
+ // adjusting the message.
+ fprintf(stderr, "Card %u went away, removing. (To keep a fake card, increase --num-cards.)\n", card_index);
+ theme->remove_card(card_index);
+ configure_card(card_index, /*capture=*/nullptr, CardType::FAKE_CAPTURE, /*output=*/nullptr, /*is_srt_card=*/false);
+ card->jitter_history.clear();
+ }