OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // If the constraint can't be met or the capturer fails to start, the state | 27 // If the constraint can't be met or the capturer fails to start, the state |
28 // transition to kEnded, otherwise it transitions to kLive. | 28 // transition to kEnded, otherwise it transitions to kLive. |
29 namespace webrtc { | 29 namespace webrtc { |
30 | 30 |
31 class MediaConstraintsInterface; | 31 class MediaConstraintsInterface; |
32 | 32 |
33 class VideoCapturerTrackSource : public VideoTrackSource, | 33 class VideoCapturerTrackSource : public VideoTrackSource, |
34 public sigslot::has_slots<> { | 34 public sigslot::has_slots<> { |
35 public: | 35 public: |
36 // Creates an instance of VideoCapturerTrackSource. | 36 // Creates an instance of VideoCapturerTrackSource. |
37 // VideoCapturerTrackSource take ownership of |capturer|. | 37 // VideoCapturerTrackSource takes ownership of |capturer|. |
38 // |constraints| can be NULL and in that case the camera is opened using a | 38 // |constraints| can be NULL and in that case the camera is opened using a |
39 // default resolution. | 39 // default resolution. |
40 static rtc::scoped_refptr<VideoTrackSourceInterface> Create( | 40 static rtc::scoped_refptr<VideoTrackSourceInterface> Create( |
41 rtc::Thread* worker_thread, | 41 rtc::Thread* worker_thread, |
42 cricket::VideoCapturer* capturer, | 42 std::unique_ptr<cricket::VideoCapturer> capturer, |
43 const webrtc::MediaConstraintsInterface* constraints, | 43 const webrtc::MediaConstraintsInterface* constraints, |
44 bool remote); | 44 bool remote); |
45 | 45 |
46 static rtc::scoped_refptr<VideoTrackSourceInterface> Create( | 46 static rtc::scoped_refptr<VideoTrackSourceInterface> Create( |
47 rtc::Thread* worker_thread, | 47 rtc::Thread* worker_thread, |
48 cricket::VideoCapturer* capturer, | 48 std::unique_ptr<cricket::VideoCapturer> capturer, |
49 bool remote); | 49 bool remote); |
50 | 50 |
51 bool is_screencast() const override { | 51 bool is_screencast() const override { |
52 return video_capturer_->IsScreencast(); | 52 return video_capturer_->IsScreencast(); |
53 } | 53 } |
54 rtc::Optional<bool> needs_denoising() const override { | 54 rtc::Optional<bool> needs_denoising() const override { |
55 return needs_denoising_; | 55 return needs_denoising_; |
56 } | 56 } |
57 | 57 |
58 bool GetStats(Stats* stats) override; | 58 bool GetStats(Stats* stats) override; |
59 | 59 |
60 protected: | 60 protected: |
61 VideoCapturerTrackSource(rtc::Thread* worker_thread, | 61 VideoCapturerTrackSource(rtc::Thread* worker_thread, |
62 cricket::VideoCapturer* capturer, | 62 std::unique_ptr<cricket::VideoCapturer> capturer, |
63 bool remote); | 63 bool remote); |
64 virtual ~VideoCapturerTrackSource(); | 64 virtual ~VideoCapturerTrackSource(); |
65 void Initialize(const webrtc::MediaConstraintsInterface* constraints); | 65 void Initialize(const webrtc::MediaConstraintsInterface* constraints); |
66 | 66 |
67 private: | 67 private: |
68 void Stop(); | 68 void Stop(); |
69 | 69 |
70 void OnStateChange(cricket::VideoCapturer* capturer, | 70 void OnStateChange(cricket::VideoCapturer* capturer, |
71 cricket::CaptureState capture_state); | 71 cricket::CaptureState capture_state); |
72 | 72 |
73 rtc::Thread* signaling_thread_; | 73 rtc::Thread* signaling_thread_; |
74 rtc::Thread* worker_thread_; | 74 rtc::Thread* worker_thread_; |
75 rtc::AsyncInvoker invoker_; | 75 rtc::AsyncInvoker invoker_; |
76 std::unique_ptr<cricket::VideoCapturer> video_capturer_; | 76 std::unique_ptr<cricket::VideoCapturer> video_capturer_; |
77 bool started_; | 77 bool started_; |
78 cricket::VideoFormat format_; | 78 cricket::VideoFormat format_; |
79 rtc::Optional<bool> needs_denoising_; | 79 rtc::Optional<bool> needs_denoising_; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace webrtc | 82 } // namespace webrtc |
83 | 83 |
84 #endif // WEBRTC_PC_VIDEOCAPTURERTRACKSOURCE_H_ | 84 #endif // WEBRTC_PC_VIDEOCAPTURERTRACKSOURCE_H_ |
OLD | NEW |