video_observer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef EXAMPLES_UNITYPLUGIN_VIDEO_OBSERVER_H_
  11. #define EXAMPLES_UNITYPLUGIN_VIDEO_OBSERVER_H_
  12. #include <mutex>
  13. #include "api/media_stream_interface.h"
  14. #include "api/video/video_sink_interface.h"
  15. #include "examples/unityplugin/unity_plugin_apis.h"
  16. class VideoObserver : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
  17. public:
  18. VideoObserver() {}
  19. ~VideoObserver() {}
  20. void SetVideoCallback(I420FRAMEREADY_CALLBACK callback);
  21. protected:
  22. // VideoSinkInterface implementation
  23. void OnFrame(const webrtc::VideoFrame& frame) override;
  24. private:
  25. I420FRAMEREADY_CALLBACK OnI420FrameReady = nullptr;
  26. std::mutex mutex;
  27. };
  28. #endif // EXAMPLES_UNITYPLUGIN_VIDEO_OBSERVER_H_