-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial implementation of PushAV Stream Transport Cluster #37787
base: master
Are you sure you want to change the base?
Conversation
Changed Files
|
48ff8e0
to
9d1591f
Compare
9d1591f
to
79c2dbd
Compare
PR #37787: Size comparison from 73fe30c to 543b7e1 Full report (3 builds for cc32xx, stm32)
|
you need to enable this cluster in camera example app to include it into the build system |
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
* produced; otherwise, the command SHALL be rejected with an appropriate | ||
* error. | ||
*/ | ||
virtual Protocols::InteractionModel::Status AllocatePushTransport(uint16_t & connectionID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocols::InteractionModel::Status is SDK internal, suggest to return general CHIP_ERROR in application code, same for other APIs bellow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocols::InteractionModel::Status is no more internal than CHIP_ERROR. It's fine for delegates to return it.
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
friend class PushAvStreamTransportServer; | ||
|
||
PushAvStreamTransportServer * mPushAvStreamTransportServer = nullptr; | ||
|
||
/** | ||
* This method is used by the SDK to set the PushAvStreamTransportServer pointer member in the delegate. | ||
* This is done in the constructor during the instantiation of the PushAvStreamTransportServer object. | ||
* | ||
* @param aPushAvStreamTransportServer A pointer to the PushAvStreamTransportServer object related to this delegate object. | ||
*/ | ||
void SetPushAvStreamTransportServer(PushAvStreamTransportServer * aPushAvStreamTransportServer) | ||
{ | ||
mPushAvStreamTransportServer = aPushAvStreamTransportServer; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other cluster implementations, the cluster server is instantiated directly from the application rather than through its delegate. This approach avoids circular dependencies, since the cluster server itself contains the delegate.
} | ||
|
||
protected: | ||
PushAvStreamTransportServer * GetPushAvStreamTransportServer() const { return mPushAvStreamTransportServer; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app should instantiate and hold the Server instance by itself
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
AttributeAccessInterface(MakeOptional(aEndpointId), CameraAvStreamManagement::Id), mDelegate(aDelegate), | ||
mEndpointId(aEndpointId), mFeature(aFeature) | ||
{ | ||
mDelegate.SetPushAvStreamTransportServer(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This create circular dependency, we should have PushAvStreamTransportServer contains the reference to PushAvStreamTransportDelegate, not the other way around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine for both to refer to each other... Why is this a problem?
// Explicitly set the PushAvStreamTransportServer pointer in the Delegate to null. | ||
|
||
mDelegate.SetPushAvStreamTransportServer(nullptr); | ||
|
||
// Unregister command handler and attribute access interfaces | ||
CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this); | ||
AttributeAccessInterfaceRegistry::Instance().Unregister(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mDelegate.SetPushAvStreamTransportServer(nullptr); is not needed, and move others to Shutdown API and call Shutdown here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mDelegate.SetPushAvStreamTransportServer(nullptr); is not needed
It's absolutely needed to avoid a dangling pointer, if the delegate holds a pointer to this object,
ReturnErrorOnFailure(aEncoder.Encode(mFeature)); | ||
break; | ||
|
||
case SupportedContainerFormats::Id: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to intercept and override the default attributes in the attribute store? We only need to modify these default fields if we require the values to come from the app, since the default storage doesn't meet our requirements. However, it appears that these attributes aren't being handled specially.
private: | ||
PushAvStreamTransportDelegate & mDelegate; | ||
EndpointId mEndpointId; | ||
const BitFlags<Feature> mFeature; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the default storage provided by the attribute store insufficient? Why must we maintain these attributes within the cluster server itself?
* produced; otherwise, the command SHALL be rejected with an appropriate | ||
* error. | ||
*/ | ||
virtual Protocols::InteractionModel::Status AllocatePushTransport(uint16_t & connectionID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocols::InteractionModel::Status is no more internal than CHIP_ERROR. It's fine for delegates to return it.
*/ | ||
virtual Protocols::InteractionModel::Status | ||
FindTransport(const Optional<DataModel::Nullable<uint16_t>> & connectionID, | ||
DataModel::List<TransportConfigurationStruct> & outtransportConfigurations) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the lifetime of the memory the List points to? How is that lifetime supposed to be managed by the callee?
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.h
Outdated
Show resolved
Hide resolved
// Helper functions | ||
bool FindStreamTransportConnection(const uint16_t connectionID); | ||
uint16_t GenerateConnectionID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these meant to be public?
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.cpp
Outdated
Show resolved
Hide resolved
src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-server.cpp
Outdated
Show resolved
Hide resolved
uint16_t connectionID = commandData.connectionID; | ||
auto & transportOptions = commandData.transportOptions; | ||
|
||
// Call the delegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to validate the constraints first.
auto & activationReason = commandData.activationReason; | ||
auto & timeControl = commandData.timeControl; | ||
|
||
// Call the delegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs constraint validation.
auto & activationReason = commandData.activationReason; | ||
auto & timeControl = commandData.timeControl; | ||
|
||
// Call the delegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs connection id validation per spec.
|
||
DataModel::List<TransportConfigurationStruct> outStreamConfigurations; | ||
|
||
// Call the delegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs spec-required validation for a non-null connection id.
543b7e1
to
e08012c
Compare
5743f8e
to
0e515e8
Compare
0e515e8
to
9fb3b11
Compare
This is the initial implementation of Push AV Stream Transport cluster
Delegate definition
Attributes support
Command Handling
Testing
Addition of delegate implementation in the example app is pending.