aja: Clear previous crosspoints when signal changes

Fix for a bug where stale crosspoint connections could result in

video glitches upon next connection.
This commit is contained in:
Paul Hindt
2022-01-28 20:23:40 -06:00
committed by Colin Edwards
parent d18b805aee
commit 5f81d4117f
4 changed files with 48 additions and 4 deletions
+18 -1
View File
@@ -27,7 +27,8 @@ AJASource::AJASource(obs_source_t *source)
mTestPattern{},
mCaptureThread{nullptr},
mMutex{},
mSource{source}
mSource{source},
mCrosspoints{}
{
}
@@ -458,6 +459,20 @@ SourceProps AJASource::GetSourceProps() const
return mSourceProps;
}
void AJASource::CacheConnections(const NTV2XptConnections &cnx)
{
mCrosspoints.clear();
mCrosspoints = cnx;
}
void AJASource::ClearConnections()
{
for (auto &&xpt : mCrosspoints) {
mCard->Connect(xpt.first, NTV2_XptBlack);
}
mCrosspoints.clear();
}
bool AJASource::ReadChannelVPIDs(NTV2Channel channel, VPIDData &vpids)
{
ULWord vpid_a = 0;
@@ -1014,9 +1029,11 @@ static void aja_source_update(void *data, obs_data_t *settings)
// Change capture format and restart capture thread
if (!initialized || want_props != ajaSource->GetSourceProps()) {
ajaSource->ClearConnections();
NTV2XptConnections xpt_cnx;
aja::Routing::ConfigureSourceRoute(
want_props, NTV2_MODE_CAPTURE, card, xpt_cnx);
ajaSource->CacheConnections(xpt_cnx);
ajaSource->Deactivate();
initialized = true;
}