Overwrite the whole routing table if currently no channel is running

This commit is contained in:
Sebastian Dröge 2021-11-23 17:47:16 +02:00
parent 21b6a77140
commit 9b8f452078
2 changed files with 40 additions and 2 deletions

View file

@ -976,7 +976,26 @@ static gboolean gst_aja_sink_set_caps(GstBaseSink *bsink, GstCaps *caps) {
CNTV2SignalRouter router;
self->device->device->GetRouting(router);
// If any channels are currently running, initialize the router with the
// existing routing setup. Otherwise overwrite the whole routing table.
{
bool have_channels_running = false;
for (NTV2Channel c = ::NTV2_CHANNEL1; c < NTV2_MAX_NUM_CHANNELS;
c = (NTV2Channel)(c + 1)) {
AUTOCIRCULATE_STATUS ac_status;
if (c == self->channel) continue;
if (self->device->device->AutoCirculateGetStatus(c, ac_status) &&
!ac_status.IsStopped()) {
have_channels_running = true;
break;
}
}
if (have_channels_running) self->device->device->GetRouting(router);
}
// Need to remove old routes for the output and framebuffer we're going to use
NTV2ActualConnections connections = router.GetConnections();

View file

@ -792,7 +792,26 @@ static gboolean gst_aja_src_configure(GstAjaSrc *self) {
CNTV2SignalRouter router;
self->device->device->GetRouting(router);
// If any channels are currently running, initialize the router with the
// existing routing setup. Otherwise overwrite the whole routing table.
{
bool have_channels_running = false;
for (NTV2Channel c = ::NTV2_CHANNEL1; c < NTV2_MAX_NUM_CHANNELS;
c = (NTV2Channel)(c + 1)) {
AUTOCIRCULATE_STATUS ac_status;
if (c == self->channel) continue;
if (self->device->device->AutoCirculateGetStatus(c, ac_status) &&
!ac_status.IsStopped()) {
have_channels_running = true;
break;
}
}
if (have_channels_running) self->device->device->GetRouting(router);
}
// Need to remove old routes for the output and framebuffer we're going to
// use