Skip to content

Commit

Permalink
Merge branch 'master' into development/Compositor2306
Browse files Browse the repository at this point in the history
  • Loading branch information
pwielders authored Aug 8, 2023
2 parents 9b3a694 + 8997b10 commit 17a5486
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 86 deletions.
29 changes: 20 additions & 9 deletions BluetoothAudio/AudioEndpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ namespace A2DP {

ASSERT(_handler != nullptr);

TRACE(ServerFlow, (_T("Configuring endpoint %d by client"), Id()));

_lock.Lock();

// Configure Media Transport
Expand Down Expand Up @@ -287,6 +289,8 @@ namespace A2DP {
{
uint32_t result = Core::ERROR_ILLEGAL_STATE;

TRACE(ServerFlow, (_T("Starting endpoint %d by client"), Id()));

_lock.Lock();

if (State() == StreamEndPoint::OPENED) {
Expand All @@ -308,6 +312,8 @@ namespace A2DP {

_lock.Lock();

TRACE(ServerFlow, (_T("Suspending endpoint %d by client"), Id()));

if (State() == StreamEndPoint::STARTED) {

result = _remote.Suspend(*this);
Expand All @@ -325,6 +331,8 @@ namespace A2DP {
{
uint32_t result = Core::ERROR_ILLEGAL_STATE;

TRACE(ServerFlow, (_T("Opening endpoint %d by client"), Id()));

_lock.Lock();

if (State() == StreamEndPoint::CONFIGURED) {
Expand All @@ -344,6 +352,8 @@ namespace A2DP {
{
uint32_t result = Core::ERROR_ILLEGAL_STATE;

TRACE(ServerFlow, (_T("Closing endpoint %d by client"), Id()));

_lock.Lock();

if ((State() == StreamEndPoint::OPENED) || (State() == StreamEndPoint::STARTED)) {
Expand All @@ -363,12 +373,14 @@ namespace A2DP {
{
uint32_t result = Core::ERROR_ILLEGAL_STATE;

TRACE(ServerFlow, (_T("Aborting endpoint %d by client"), Id()));

_lock.Lock();

if ((State() == StreamEndPoint::CONFIGURED) || (State() == StreamEndPoint::OPENED) || (State() == StreamEndPoint::STARTED)) {

result = _remote.Abort(*this);
if (result == Core::ERROR_NONE) {;
if (result == Core::ERROR_NONE) {
result = OnAbort();
}
}
Expand All @@ -385,7 +397,7 @@ namespace A2DP {
&& (State() != Bluetooth::AVDTP::StreamEndPoint::CLOSING)
&& (State() != Bluetooth::AVDTP::StreamEndPoint::ABORTING)) {

TRACE(ServerFlow, (_T("Endpoint %d device disconnected unexpectedly"), Id()));
TRACE(ServerFlow, (_T("Endpoint %d device disconnected unexpectedly!"), Id()));

// Deallocate the sink and teardown internal data, no point in closing the remote
// device as it's not longer reachable.
Expand Down Expand Up @@ -441,8 +453,7 @@ namespace A2DP {
else {
failedCategory = Service::MEDIA_CODEC;

TRACE(ServerFlow, (_T("Requested MEDIA_CODEC configuration is unsupported or invalid for codec %02x"),
Codec()->Type()));
TRACE(ServerFlow, (_T("Requested MEDIA_CODEC configuration is unsupported or invalid for codec %02x"), Codec()->Type()));
}
}
}
Expand All @@ -467,20 +478,20 @@ namespace A2DP {
_lock.Lock();

if (State() == StreamEndPoint::CONFIGURED) {
if (_handler->OnAcquire() == Core::ERROR_NONE) {
result = _handler->OnAcquire();

if (result == Core::ERROR_NONE) {
TRACE(ServerFlow, (_T("Endpoint %d opened"), Id()));
State(StreamEndPoint::OPENED);
}

result = Core::ERROR_NONE;
}

_lock.Unlock();

if (result != Core::ERROR_NONE) {
TRACE(Trace::Error, (_T("Failed to open endpoint %d [%d]"), Id(), result));
}

_lock.Unlock();

return (result);
}
uint32_t OnClose() override
Expand Down
6 changes: 3 additions & 3 deletions BluetoothAudio/BluetoothAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ namespace Plugin {
/* virtual */ void BluetoothAudio::Deinitialize(PluginHost::IShell* service)
{
if (_service != nullptr) {

ASSERT(_service == service);

SignallingServer::Instance().Stop();

if (_source != nullptr) {
_source->Deinitialize(service);
_source->Release();
Expand All @@ -111,6 +108,9 @@ namespace Plugin {
service->Unregister(&_comNotificationSink);

service->Release();

SignallingServer::Instance().Clear();

_service = nullptr;
}
}
Expand Down
6 changes: 2 additions & 4 deletions BluetoothAudio/BluetoothAudioSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,8 @@ namespace Plugin {
result = Core::ERROR_UNAVAILABLE;
}
else {
TRACE(SinkFlow, (_T("Configuring audio endpoint 0x%02x to: sample rate: %i Hz, resolution: %i bits per sample, channels: %i, frame rate: %i.%02i Hz"), _endpoint->Id(), format.SampleRate, format.Resolution, format.Channels, (format.FrameRate / 100), (format.FrameRate % 100)));
TRACE(SinkFlow, (_T("Configuring audio endpoint 0x%02x to: sample rate: %d Hz, resolution: %d bits per sample, channels: %d, frame rate: %d.%02d Hz"),
_endpoint->Id(), format.SampleRate, format.Resolution, format.Channels, (format.FrameRate / 100), (format.FrameRate % 100)));

Bluetooth::A2DP::IAudioCodec::StreamFormat streamFormat;
streamFormat.SampleRate = format.SampleRate;
Expand Down Expand Up @@ -1548,17 +1549,14 @@ namespace Plugin {
{
_lock.Lock();

ASSERT(_callback == nullptr);
if (_callback != nullptr) {
_callback->Release();
}

ASSERT(_source == nullptr);
if (_source != nullptr) {
_source->Release();
}

ASSERT(_service == nullptr);
if (_service != nullptr) {
_service->Release();
}
Expand Down
Loading

0 comments on commit 17a5486

Please sign in to comment.