Skip to content

Commit 6721da7

Browse files
committed
Modify SetStreamPriorities
1 parent 29dafa8 commit 6721da7

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

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

+14-4
Original file line numberDiff line numberDiff line change
@@ -1642,16 +1642,26 @@ void CameraAVStreamMgmtServer::HandleSetStreamPriorities(HandlerContext & ctx,
16421642
{
16431643

16441644
auto & streamPriorities = commandData.streamPriorities;
1645+
//auto & streamPriorities = commandData.streamPriorities;
16451646

1646-
// Call the delegate
1647-
Status status = mDelegate.SetStreamPriorities(streamPriorities);
1647+
auto iter = streamPriorities.begin();
1648+
StreamUsageEnum rankedStreamPriorities[kNumOfStreamUsageTypes];
1649+
int i = 0;
1650+
while(iter.Next())
1651+
{
1652+
auto & streamUsage = iter.GetValue();
1653+
rankedStreamPriorities[i++] = streamUsage;
1654+
}
1655+
CHIP_ERROR err = SetRankedVideoStreamPriorities(rankedStreamPriorities);
16481656

1649-
if (status != Status::Success)
1657+
if (err != CHIP_NO_ERROR)
16501658
{
1651-
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
1659+
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::Failure);
16521660
return;
16531661
}
16541662

1663+
mDelegate.OnRankedStreamPrioritiesChanged();
1664+
16551665
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::Success);
16561666
}
16571667

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,10 @@ class CameraAVStreamMgmtDelegate
223223
virtual Protocols::InteractionModel::Status SnapshotStreamDeallocate(const uint16_t streamID) = 0;
224224

225225
/**
226-
* @brief Handle Command Delegate for SetStreamPriorities.
226+
* @brief Command Delegate for notifying change in StreamPriorities.
227227
*
228-
* @param streamPriorities Indicates the list of stream priorities to set, in decreasing order of priorities.
229-
*
230-
* @return Success if the setting of stream priorities is successful; otherwise, the command SHALL be rejected with an
231-
* appropriate error.
232228
*/
233-
virtual Protocols::InteractionModel::Status
234-
SetStreamPriorities(const DataModel::DecodableList<StreamUsageEnum> streamPriorities) = 0;
229+
virtual void OnRankedStreamPrioritiesChanged() = 0;
235230

236231
/**
237232
* @brief Handle Command Delegate for CaptureSnapshot.

0 commit comments

Comments
 (0)