Skip to content

Commit

Permalink
Add missing failure callbacks (#132)
Browse files Browse the repository at this point in the history
* Add missing failure callbacks

* Bump version

* Convert the dummy observer to log errors instead of removing it.

* Add missing enter.
  • Loading branch information
mamaheux authored Nov 26, 2023
1 parent 7b76bec commit db0d96c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.5
0.6.6
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@
using namespace opentera;
using namespace std;

class DummySetSessionDescriptionObserver : public webrtc::SetSessionDescriptionObserver
class OnlyFailureSetSessionDescriptionObserver : public webrtc::SetSessionDescriptionObserver
{
function<void(const string&)> m_onError;

public:
static DummySetSessionDescriptionObserver* Create()
explicit OnlyFailureSetSessionDescriptionObserver(function<void(const string&)> onError) : m_onError(move(onError))
{
}

static OnlyFailureSetSessionDescriptionObserver* Create(function<void(const string&)> onError)
{
return new rtc::RefCountedObject<DummySetSessionDescriptionObserver>();
return new rtc::RefCountedObject<OnlyFailureSetSessionDescriptionObserver>(move(onError));
}

void OnSuccess() override {}
void OnFailure(webrtc::RTCError error) override {}

void OnFailure(webrtc::RTCError error) override
{
m_onError(error.message());
}
};

void CreateSessionDescriptionObserverHelper::OnSuccess(webrtc::SessionDescriptionInterface* desc)
Expand Down Expand Up @@ -102,7 +112,7 @@ void PeerConnectionHandler::receivePeerCallAnswer(const string& sdp)
auto desc = webrtc::CreateSessionDescription("answer", sdp, &error);
if (desc)
{
m_peerConnection->SetRemoteDescription(DummySetSessionDescriptionObserver::Create(), desc);
m_peerConnection->SetRemoteDescription(OnlyFailureSetSessionDescriptionObserver::Create(m_onError), desc);
}
else
{
Expand Down Expand Up @@ -175,7 +185,7 @@ void PeerConnectionHandler::OnIceGatheringChange(webrtc::PeerConnectionInterface

void PeerConnectionHandler::OnCreateSessionDescriptionObserverSuccess(webrtc::SessionDescriptionInterface* desc)
{
m_peerConnection->SetLocalDescription(DummySetSessionDescriptionObserver::Create(), desc);
m_peerConnection->SetLocalDescription(OnlyFailureSetSessionDescriptionObserver::Create(m_onError), desc);

string sdp;
desc->ToString(&sdp);
Expand Down

0 comments on commit db0d96c

Please sign in to comment.