Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/camera-app/camera-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ source_set("camera-lib") {

deps = [
"${chip_root}/examples/camera-app/camera-common",
"${chip_root}/src/app/clusters/push-av-stream-transport-server:push-av-stream-transport-server",
"${chip_root}/src/app/clusters/push-av-stream-transport-server",
"${chip_root}/src/lib",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CameraDeviceInterface
virtual MediaController & GetMediaController() = 0;

// Getter for PushAVStreamTransport Delegate
virtual chip::app::Clusters::PushAvStreamTransportDelegate & GetPushAVDelegate() = 0;
virtual chip::app::Clusters::PushAvStreamTransportDelegate & GetPushAVTransportDelegate() = 0;

// Class defining the Camera HAL interface
class CameraHALInterface
Expand Down
2 changes: 1 addition & 1 deletion examples/camera-app/camera-common/src/camera-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CameraApp::CameraApp(chip::EndpointId aClustersEndpoint, CameraDeviceInterface *
mWebRTCTransportProviderPtr =
std::make_unique<WebRTCTransportProviderServer>(mCameraDevice->GetWebRTCProviderDelegate(), mEndpoint);

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

// Fetch all initialization parameters for CameraAVStreamMgmt Server
BitFlags<CameraAvStreamManagement::Feature> avsmFeatures;
Expand Down
4 changes: 2 additions & 2 deletions examples/camera-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ config("config") {
"include",
"include/clusters/chime",
"include/clusters/webrtc-provider",
"include/clusters/push_av_transport",
"include/clusters/camera-avstream-mgmt",
"include/clusters/camera-avsettingsuserlevel-mgmt",
"include/clusters/push-av-stream-transport",
"include/clusters/zone-mgmt",
"include/media-controller",
"include/transport",
Expand Down Expand Up @@ -83,7 +83,7 @@ executable("chip-camera-app") {
"${chip_root}/examples/camera-app/linux/src/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.cpp",
"${chip_root}/examples/camera-app/linux/src/clusters/camera-avstream-mgmt/camera-av-stream-manager.cpp",
"${chip_root}/examples/camera-app/linux/src/clusters/chime/chime-manager.cpp",
"${chip_root}/examples/camera-app/linux/src/clusters/push_av_transport/push-av-stream-transport-delegate-impl.cpp",
"${chip_root}/examples/camera-app/linux/src/clusters/push-av-stream-transport/push-av-stream-manager.cpp",
"${chip_root}/examples/camera-app/linux/src/clusters/webrtc-provider/webrtc-provider-manager.cpp",
"${chip_root}/examples/camera-app/linux/src/clusters/zone-mgmt/zone-manager.cpp",
"${chip_root}/examples/camera-app/linux/src/media-controller/default-media-controller.cpp",
Expand Down
4 changes: 2 additions & 2 deletions examples/camera-app/linux/include/camera-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "camera-avsettingsuserlevel-manager.h"
#include "camera-device-interface.h"
#include "chime-manager.h"
#include "push-av-stream-transport-delegate-impl.h"
#include "push-av-stream-manager.h"
#include "webrtc-provider-manager.h"
#include "zone-manager.h"

Expand Down Expand Up @@ -87,7 +87,7 @@ class CameraDevice : public CameraDeviceInterface, public CameraDeviceInterface:
chip::app::Clusters::CameraAvStreamManagement::CameraAVStreamMgmtDelegate & GetCameraAVStreamMgmtDelegate() override;
chip::app::Clusters::CameraAvStreamManagement::CameraAVStreamController & GetCameraAVStreamMgmtController() override;
chip::app::Clusters::CameraAvSettingsUserLevelManagement::Delegate & GetCameraAVSettingsUserLevelMgmtDelegate() override;
chip::app::Clusters::PushAvStreamTransportDelegate & GetPushAVDelegate() override;
chip::app::Clusters::PushAvStreamTransportDelegate & GetPushAVTransportDelegate() override;
chip::app::Clusters::ZoneManagement::Delegate & GetZoneManagementDelegate() override;

MediaController & GetMediaController() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
*/

#pragma once
#include <app-common/zap-generated/cluster-enums.h>
#include <app/clusters/push-av-stream-transport-server/push-av-stream-transport-cluster.h>
#include <app/util/config.h>
#include <lib/support/logging/CHIPLogging.h>
#include <vector>

#include "camera-device-interface.h"
#include <app-common/zap-generated/cluster-enums.h>
#include <camera-device-interface.h>
#include <media-controller.h>
#include <pushav-transport.h>

#include <unordered_map>
#include <vector>

namespace chip {
namespace app {
Expand All @@ -47,6 +46,13 @@ struct PushAvStream
class PushAvStreamTransportManager : public PushAvStreamTransportDelegate
{
public:
PushAvStreamTransportManager() = default;
~PushAvStreamTransportManager();

void Init();
void SetMediaController(MediaController * mediaController);
void SetCameraDevice(CameraDeviceInterface * cameraDevice);

Protocols::InteractionModel::Status AllocatePushTransport(const TransportOptionsStruct & transportOptions,
const uint16_t connectionID);
Protocols::InteractionModel::Status DeallocatePushTransport(const uint16_t connectionID);
Expand Down Expand Up @@ -78,12 +84,6 @@ class PushAvStreamTransportManager : public PushAvStreamTransportDelegate
CHIP_ERROR LoadCurrentConnections(std::vector<TransportConfigurationStorage> & currentConnections);
CHIP_ERROR PersistentAttributesLoadedCallback();

void SetMediaController(MediaController * mediaController);
void SetCameraDevice(CameraDeviceInterface * cameraDevice);
void Init();

~PushAvStreamTransportManager();

private:
std::vector<PushAvStream> pushavStreams;
MediaController * mMediaController = nullptr;
Expand Down
31 changes: 22 additions & 9 deletions examples/camera-app/linux/src/camera-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,14 +1232,27 @@ void CameraDevice::InitializeVideoStreams()

void CameraDevice::InitializeAudioStreams()
{
// Create single audio stream with typical supported parameters
AudioStream audioStream = { { 1 /* Id */, StreamUsageEnum::kLiveView /* StreamUsage */, AudioCodecEnum::kOpus,
kMicrophoneMaxChannelCount /* ChannelCount(Max from Spec) */, 48000 /* SampleRate */,
30000 /* BitRate*/, 24 /* BitDepth */, 0 /* RefCount */ },
false,
nullptr };

mAudioStreams.push_back(audioStream);
// Mono stream
AudioStream monoStream = { { 1 /* Id */, StreamUsageEnum::kLiveView, AudioCodecEnum::kOpus, 1 /* ChannelCount: Mono */,
48000 /* SampleRate */, 20000 /* BitRate */, 24 /* BitDepth */, 0 /* RefCount */ },
false,
nullptr };
mAudioStreams.push_back(monoStream);

// Stereo stream
AudioStream stereoStream = { { 2 /* Id */, StreamUsageEnum::kLiveView, AudioCodecEnum::kOpus, 2 /* ChannelCount: Stereo */,
48000 /* SampleRate */, 32000 /* BitRate */, 24 /* BitDepth */, 0 /* RefCount */ },
false,
nullptr };
mAudioStreams.push_back(stereoStream);

// Max channel count stream (from spec constant)
AudioStream maxChannelStream = { { 3 /* Id */, StreamUsageEnum::kLiveView, AudioCodecEnum::kOpus,
kMicrophoneMaxChannelCount /* Max from Spec */, 48000 /* SampleRate */, 64000 /* BitRate */,
24 /* BitDepth */, 0 /* RefCount */ },
false,
nullptr };
mAudioStreams.push_back(maxChannelStream);
}

void CameraDevice::InitializeSnapshotStreams()
Expand Down Expand Up @@ -1272,7 +1285,7 @@ WebRTCTransportProvider::Delegate & CameraDevice::GetWebRTCProviderDelegate()
return mWebRTCProviderManager;
}

PushAvStreamTransportDelegate & CameraDevice::GetPushAVDelegate()
PushAvStreamTransportDelegate & CameraDevice::GetPushAVTransportDelegate()
{
return mPushAVTransportManager;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
* limitations under the License.
*/

#include "push-av-stream-manager.h"

#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <fstream>
#include <iostream>
#include <lib/support/logging/CHIPLogging.h>
#include <push-av-stream-transport-delegate-impl.h>

using namespace chip;
using namespace chip::app;
Expand All @@ -31,16 +32,6 @@ using namespace chip::app::Clusters;
using namespace chip::app::Clusters::PushAvStreamTransport;
using chip::Protocols::InteractionModel::Status;

void PushAvStreamTransportManager::SetMediaController(MediaController * mediaController)
{
mMediaController = mediaController;
}

void PushAvStreamTransportManager::SetCameraDevice(CameraDeviceInterface * aCameraDevice)
{
mCameraDevice = aCameraDevice;
}

PushAvStreamTransportManager::~PushAvStreamTransportManager()
{
// Unregister all transports from Media Controller before deleting them. This will ensure that any ongoing streams are
Expand All @@ -56,6 +47,22 @@ PushAvStreamTransportManager::~PushAvStreamTransportManager()
mTransportOptionsMap.clear();
}

void PushAvStreamTransportManager::Init()
{
ChipLogProgress(Zcl, "Push AV Stream Transport Initialized");
return;
}

void PushAvStreamTransportManager::SetMediaController(MediaController * mediaController)
{
mMediaController = mediaController;
}

void PushAvStreamTransportManager::SetCameraDevice(CameraDeviceInterface * aCameraDevice)
{
mCameraDevice = aCameraDevice;
}

Protocols::InteractionModel::Status
PushAvStreamTransportManager::AllocatePushTransport(const TransportOptionsStruct & transportOptions, const uint16_t connectionID)
{
Expand Down Expand Up @@ -362,12 +369,6 @@ void PushAvStreamTransportManager::OnAttributeChanged(AttributeId attributeId)
ChipLogProgress(Zcl, "Attribute changed for AttributeId = " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
}

void PushAvStreamTransportManager::Init()
{
ChipLogProgress(Zcl, "Push AV Stream Transport Initialized");
return;
}

CHIP_ERROR PushAvStreamTransportManager::LoadCurrentConnections(std::vector<TransportConfigurationStorage> & currentConnections)
{
ChipLogProgress(Zcl, "Push AV Current Connections loaded");
Expand Down
Loading