Skip to content

Commit 8800530

Browse files
authored
Simplify the Optional comparisons in both ModifyVideoStream and ModifySnapshotStream (project-chip#41956)
1 parent 69b4de4 commit 8800530

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,12 @@ void CameraAVStreamMgmtServer::ModifyVideoStream(const uint16_t streamID, const
10041004
bool wasModified = false;
10051005
if (waterMarkEnabled.HasValue())
10061006
{
1007-
wasModified = !stream.watermarkEnabled.HasValue() || stream.watermarkEnabled.Value() != waterMarkEnabled.Value();
1007+
wasModified = (waterMarkEnabled != stream.watermarkEnabled);
10081008
stream.watermarkEnabled = waterMarkEnabled;
10091009
}
10101010
if (osdEnabled.HasValue())
10111011
{
1012-
wasModified = wasModified || !stream.OSDEnabled.HasValue() || stream.OSDEnabled.Value() != osdEnabled.Value();
1012+
wasModified = wasModified || (osdEnabled != stream.OSDEnabled);
10131013
stream.OSDEnabled = osdEnabled;
10141014
}
10151015
if (wasModified)
@@ -1032,12 +1032,12 @@ void CameraAVStreamMgmtServer::ModifySnapshotStream(const uint16_t streamID, con
10321032
bool wasModified = false;
10331033
if (waterMarkEnabled.HasValue())
10341034
{
1035-
wasModified = !stream.watermarkEnabled.HasValue() || stream.watermarkEnabled.Value() != waterMarkEnabled.Value();
1035+
wasModified = (waterMarkEnabled != stream.watermarkEnabled);
10361036
stream.watermarkEnabled = waterMarkEnabled;
10371037
}
10381038
if (osdEnabled.HasValue())
10391039
{
1040-
wasModified = wasModified || !stream.OSDEnabled.HasValue() || stream.OSDEnabled.Value() != osdEnabled.Value();
1040+
wasModified = wasModified || (osdEnabled != stream.OSDEnabled);
10411041
stream.OSDEnabled = osdEnabled;
10421042
}
10431043
if (wasModified)

0 commit comments

Comments
 (0)