CreateSessionDescriptionObserver.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <api/jsep.h>
  3. #include "WebRTCPlugin.h"
  4. namespace unity
  5. {
  6. namespace webrtc
  7. {
  8. class CreateSessionDescriptionObserver;
  9. using DelegateCreateSessionDesc = void (*)(
  10. PeerConnectionObject*, CreateSessionDescriptionObserver*, RTCSdpType, const char*, RTCErrorType, const char*);
  11. class CreateSessionDescriptionObserver : public ::webrtc::CreateSessionDescriptionObserver
  12. {
  13. public:
  14. static rtc::scoped_refptr<CreateSessionDescriptionObserver> Create(PeerConnectionObject* connection);
  15. static void RegisterCallback(DelegateCreateSessionDesc callback) { s_createSessionDescCallback = callback; }
  16. void OnSuccess(SessionDescriptionInterface* desc) override;
  17. void OnFailure(webrtc::RTCError error) override;
  18. protected:
  19. explicit CreateSessionDescriptionObserver(PeerConnectionObject* connection);
  20. ~CreateSessionDescriptionObserver() override = default;
  21. private:
  22. PeerConnectionObject* m_connection;
  23. static DelegateCreateSessionDesc s_createSessionDescCallback;
  24. };
  25. } // end namespace webrtc
  26. } // end namespace unity