| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 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 | |
| 11 // This file contains the class CaptureRenderAdapter. The class connects a | |
| 12 // VideoCapturer to any number of VideoRenders such that the former feeds the | |
| 13 // latter. | |
| 14 // CaptureRenderAdapter is Thread-unsafe. This means that none of its APIs may | |
| 15 // be called concurrently. | |
| 16 | |
| 17 #ifndef WEBRTC_MEDIA_BASE_CAPTURERENDERADAPTER_H_ | |
| 18 #define WEBRTC_MEDIA_BASE_CAPTURERENDERADAPTER_H_ | |
| 19 | |
| 20 #include <vector> | |
| 21 | |
| 22 #include "webrtc/base/criticalsection.h" | |
| 23 #include "webrtc/base/sigslot.h" | |
| 24 #include "webrtc/media/base/videocapturer.h" | |
| 25 #include "webrtc/media/base/videosinkinterface.h" | |
| 26 | |
| 27 namespace cricket { | |
| 28 | |
| 29 class VideoCapturer; | |
| 30 class VideoProcessor; | |
| 31 | |
| 32 class CaptureRenderAdapter : public sigslot::has_slots<> { | |
| 33 public: | |
| 34 static CaptureRenderAdapter* Create(VideoCapturer* video_capturer); | |
| 35 ~CaptureRenderAdapter(); | |
| 36 | |
| 37 void AddSink(rtc::VideoSinkInterface<VideoFrame>* sink); | |
| 38 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink); | |
| 39 | |
| 40 VideoCapturer* video_capturer() { return video_capturer_; } | |
| 41 private: | |
| 42 | |
| 43 explicit CaptureRenderAdapter(VideoCapturer* video_capturer); | |
| 44 void Init(); | |
| 45 | |
| 46 // Callback for frames received from the capturer. | |
| 47 void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* video_frame); | |
| 48 | |
| 49 // Just pointers since ownership is not handed over to this class. | |
| 50 std::vector<rtc::VideoSinkInterface<VideoFrame>*> sinks_; | |
| 51 VideoCapturer* video_capturer_; | |
| 52 // Critical section synchronizing the capture thread. | |
| 53 rtc::CriticalSection capture_crit_; | |
| 54 }; | |
| 55 | |
| 56 } // namespace cricket | |
| 57 | |
| 58 #endif // WEBRTC_MEDIA_BASE_CAPTURERENDERADAPTER_H_ | |
| OLD | NEW |