12345678910111213141516171819202122232425262728293031323334353637 |
- #include "pch.h"
- #include "PeerConnectionObject.h"
- #include "CreateSessionDescriptionObserver.h"
- namespace unity
- {
- namespace webrtc
- {
- DelegateCreateSessionDesc CreateSessionDescriptionObserver::s_createSessionDescCallback = nullptr;
- rtc::scoped_refptr<CreateSessionDescriptionObserver>
- CreateSessionDescriptionObserver::Create(PeerConnectionObject* connection)
- {
- return new rtc::RefCountedObject<CreateSessionDescriptionObserver>(connection);
- }
- CreateSessionDescriptionObserver::CreateSessionDescriptionObserver(PeerConnectionObject* connection)
- {
- m_connection = connection;
- }
- void CreateSessionDescriptionObserver::OnSuccess(SessionDescriptionInterface* desc)
- {
- std::string out;
- desc->ToString(&out);
- const auto sdpType = ConvertSdpType(desc->GetType());
- s_createSessionDescCallback(m_connection, this, sdpType, out.c_str(), RTCErrorType::NONE, nullptr);
- }
- void CreateSessionDescriptionObserver::OnFailure(webrtc::RTCError error)
- {
- s_createSessionDescCallback(m_connection, this, RTCSdpType(), nullptr, error.type(), error.message());
- }
- } // end namespace webrtc
- } // end namespace unity
|