MediaStreamObserver.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <pc/media_stream_observer.h>
  3. #include "WebRTCPlugin.h"
  4. namespace unity
  5. {
  6. namespace webrtc
  7. {
  8. class Context;
  9. class MediaStreamObserver : public ::webrtc::MediaStreamObserver, public sigslot::has_slots<>
  10. {
  11. public:
  12. explicit MediaStreamObserver(webrtc::MediaStreamInterface* stream, Context* context);
  13. void RegisterOnAddTrack(DelegateMediaStreamOnAddTrack callback);
  14. void RegisterOnRemoveTrack(DelegateMediaStreamOnRemoveTrack callback);
  15. private:
  16. void OnVideoTrackAdded(webrtc::VideoTrackInterface* track, webrtc::MediaStreamInterface* stream);
  17. void OnAudioTrackAdded(webrtc::AudioTrackInterface* track, webrtc::MediaStreamInterface* stream);
  18. void OnVideoTrackRemoved(webrtc::VideoTrackInterface* track, webrtc::MediaStreamInterface* stream);
  19. void OnAudioTrackRemoved(webrtc::AudioTrackInterface* track, webrtc::MediaStreamInterface* stream);
  20. std::list<DelegateMediaStreamOnAddTrack> m_listOnAddTrack;
  21. std::list<DelegateMediaStreamOnRemoveTrack> m_listOnRemoveTrack;
  22. Context* m_context;
  23. };
  24. } // end namespace webrtc
  25. } // end namespace unity