Skip to content

Commit 85b889d

Browse files
authored
Update Push AV Cluster implementation (project-chip#40484)
* integrate push av with tls client * set tls client mgmt delegate in push av * Update push av unit tests for tls client mgmt integration * push-av-stream: Add new fields for CMAFContainerOptionsStruct * CI build fix * Integrate tls clusters with camera app
1 parent ff88650 commit 85b889d

File tree

19 files changed

+280
-14
lines changed

19 files changed

+280
-14
lines changed

examples/all-clusters-app/all-clusters-common/include/push-av-stream-transport-delegate-impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ class PushAvStreamTransportManager : public PushAvStreamTransportDelegate
6464

6565
Protocols::InteractionModel::Status SelectVideoStream(StreamUsageEnum streamUsage, uint16_t & videoStreamId) override;
6666

67+
bool ValidateStreamUsage(StreamUsageEnum streamUsage) override;
68+
69+
bool ValidateSegmentDuration(uint16_t segmentDuration) override;
70+
6771
Protocols::InteractionModel::Status SelectAudioStream(StreamUsageEnum streamUsage, uint16_t & audioStreamId) override;
6872

6973
Protocols::InteractionModel::Status ValidateVideoStream(uint16_t videoStreamId) override;

examples/all-clusters-app/all-clusters-common/src/push-av-stream-transport-delegate-impl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ Protocols::InteractionModel::Status PushAvStreamTransportManager::ManuallyTrigge
100100
return Status::Success;
101101
}
102102

103+
bool PushAvStreamTransportManager::ValidateStreamUsage(StreamUsageEnum streamUsage)
104+
{
105+
return true;
106+
}
107+
108+
bool PushAvStreamTransportManager::ValidateSegmentDuration(uint16_t segmentDuration)
109+
{
110+
return true;
111+
}
112+
103113
Protocols::InteractionModel::Status
104114
PushAvStreamTransportManager::ValidateBandwidthLimit(StreamUsageEnum streamUsage,
105115
const Optional<DataModel::Nullable<uint16_t>> & videoStreamId,

examples/all-clusters-app/linux/main-common.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "rvc-operational-state-delegate-impl.h"
4040
#include "tcc-mode.h"
4141
#include "thermostat-delegate-impl.h"
42+
#include "tls-client-management-instance.h"
4243

4344
#include <Options.h>
4445
#include <app-common/zap-generated/attributes/Accessors.h>
@@ -72,7 +73,6 @@ using namespace chip::app;
7273
using namespace chip::DeviceLayer;
7374

7475
using chip::Protocols::InteractionModel::Status;
75-
7676
namespace {
7777

7878
LowPowerManager sLowPowerManager;
@@ -198,6 +198,8 @@ void ApplicationInit()
198198
Clusters::UnitLocalization::TempUnitEnum::kFahrenheit) == CHIP_NO_ERROR);
199199

200200
Clusters::PushAvStreamTransport::SetDelegate(chip::EndpointId(1), &gPushAvStreamTransportManager);
201+
Clusters::PushAvStreamTransport::SetTLSClientManagementDelegate(chip::EndpointId(1),
202+
&Clusters::TlsClientManagementCommandDelegate::GetInstance());
201203

202204
SetTagList(/* endpoint= */ 0, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(gEp0TagList));
203205
SetTagList(/* endpoint= */ 1, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(gEp1TagList));

examples/camera-app/camera-common/BUILD.gn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ source_set("camera-lib") {
3434
public_configs = [ ":config" ]
3535

3636
sources = [
37+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/tls-certificate-management-instance.cpp",
38+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/tls-client-management-instance.cpp",
3739
"include/camera-app.h",
3840
"include/camera-avstream-controller/camera-avstream-controller.h",
3941
"include/camera-device-interface.h",
@@ -47,6 +49,7 @@ source_set("camera-lib") {
4749
"include/camera-avstream-controller",
4850
"include/media-controller",
4951
"include/transport",
52+
"${chip_root}/examples/all-clusters-app/all-clusters-common/include",
5053
]
5154

5255
deps = [

examples/camera-app/camera-common/src/camera-app.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818
#include "camera-app.h"
19+
#include "tls-client-management-instance.h"
1920
#include <app/clusters/push-av-stream-transport-server/CodegenIntegration.h>
2021

2122
using namespace chip;
@@ -46,6 +47,9 @@ CameraApp::CameraApp(chip::EndpointId aClustersEndpoint, CameraDeviceInterface *
4647

4748
Clusters::PushAvStreamTransport::SetDelegate(mEndpoint, &(mCameraDevice->GetPushAVTransportDelegate()));
4849

50+
Clusters::PushAvStreamTransport::SetTLSClientManagementDelegate(chip::EndpointId(1),
51+
&Clusters::TlsClientManagementCommandDelegate::GetInstance());
52+
4953
// Fetch all initialization parameters for CameraAVStreamMgmt Server
5054
BitFlags<CameraAvStreamManagement::Feature> avsmFeatures;
5155
BitFlags<CameraAvStreamManagement::OptionalAttribute> avsmOptionalAttrs;

examples/camera-app/linux/include/clusters/push-av-stream-transport/push-av-stream-manager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ class PushAvStreamTransportManager : public PushAvStreamTransportDelegate
7171

7272
bool ValidateUrl(const std::string & url) override;
7373

74+
bool ValidateStreamUsage(StreamUsageEnum streamUsage) override;
75+
76+
bool ValidateSegmentDuration(uint16_t segmentDuration) override;
77+
7478
Protocols::InteractionModel::Status
7579
ValidateBandwidthLimit(StreamUsageEnum streamUsage, const Optional<DataModel::Nullable<uint16_t>> & videoStreamId,
7680
const Optional<DataModel::Nullable<uint16_t>> & audioStreamId) override;

examples/camera-app/linux/src/clusters/push-av-stream-transport/push-av-stream-manager.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,18 @@ PushAvStreamTransportManager::ValidateBandwidthLimit(StreamUsageEnum streamUsage
237237
return Status::Success;
238238
}
239239

240+
bool PushAvStreamTransportManager::ValidateStreamUsage(StreamUsageEnum streamUsage)
241+
{
242+
// TODO: if StreamUsage is present in the StreamUsagePriorities list, return true, false otherwise
243+
return true;
244+
}
245+
246+
bool PushAvStreamTransportManager::ValidateSegmentDuration(uint16_t segmentDuration)
247+
{
248+
// TODO: if Segment Duration is multiple of KeyFrameInterval, return true, false otherwise
249+
return true;
250+
}
251+
240252
bool PushAvStreamTransportManager::ValidateUrl(const std::string & url)
241253
{
242254
const std::string https = "https://";

src/app/clusters/push-av-stream-transport-server/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ source_set("push-av-stream-transport-server") {
2626

2727
public_deps = [
2828
"${chip_root}/src/app/",
29+
"${chip_root}/src/app/clusters/tls-client-management-server",
2930
"${chip_root}/src/app/server-cluster",
3031
"${chip_root}/src/lib/core:types",
3132
"${chip_root}/zzz_generated/app-common/clusters/PushAvStreamTransport",

src/app/clusters/push-av-stream-transport-server/CodegenIntegration.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ void SetDelegate(EndpointId endpointId, PushAvStreamTransportDelegate * delegate
116116
gServers[arrayIndex].Cluster().Init();
117117
}
118118

119+
void SetTLSClientManagementDelegate(EndpointId endpointId, TlsClientManagementDelegate * delegate)
120+
{
121+
ChipLogProgress(AppServer, "Setting TLS Client Management delegate on endpoint %u", endpointId);
122+
uint16_t arrayIndex =
123+
emberAfGetClusterServerEndpointIndex(endpointId, PushAvStreamTransport::Id, kPushAvStreamTransportFixedClusterCount);
124+
if (arrayIndex >= kPushAvStreamTransportMaxClusterCount)
125+
{
126+
return;
127+
}
128+
129+
if (!gServers[arrayIndex].IsConstructed())
130+
{
131+
ChipLogError(AppServer, "Push AV Stream transport is NOT yet constructed. Cannot set TLS Client Management delegate");
132+
return;
133+
}
134+
gServers[arrayIndex].Cluster().SetTLSClientManagementDelegate(endpointId, delegate);
135+
}
136+
119137
} // namespace PushAvStreamTransport
120138
} // namespace Clusters
121139
} // namespace app

src/app/clusters/push-av-stream-transport-server/CodegenIntegration.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#pragma once
2020

2121
#include "push-av-stream-transport-delegate.h"
22+
#include <app/clusters/tls-client-management-server/tls-client-management-server.h>
2223

2324
namespace chip {
2425
namespace app {
@@ -28,6 +29,9 @@ namespace PushAvStreamTransport {
2829
/// Sets the given delegate on an endpoint configured via code-generation
2930
void SetDelegate(chip::EndpointId endpointId, PushAvStreamTransportDelegate * delegate);
3031

32+
/// Sets the given TLS Client Management delegate on an endpoint configured via code-generation
33+
void SetTLSClientManagementDelegate(chip::EndpointId endpointId, TlsClientManagementDelegate * delegate);
34+
3135
} // namespace PushAvStreamTransport
3236
} // namespace Clusters
3337
} // namespace app

0 commit comments

Comments
 (0)