SetSessionDescriptionObserver.h 1.0 KB

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