OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 13 matching lines...) Expand all Loading... |
24 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 24 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
25 #include "webrtc/modules/video_coding/include/video_coding.h" | 25 #include "webrtc/modules/video_coding/include/video_coding.h" |
26 #include "webrtc/modules/video_processing/include/video_processing.h" | 26 #include "webrtc/modules/video_processing/include/video_processing.h" |
27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
28 #include "webrtc/typedefs.h" | 28 #include "webrtc/typedefs.h" |
29 #include "webrtc/video_send_stream.h" | 29 #include "webrtc/video_send_stream.h" |
30 | 30 |
31 namespace webrtc { | 31 namespace webrtc { |
32 | 32 |
33 class Config; | 33 class Config; |
34 class CpuOveruseMetricsObserver; | |
35 class CpuOveruseObserver; | |
36 class CriticalSectionWrapper; | 34 class CriticalSectionWrapper; |
37 class OveruseFrameDetector; | 35 class OveruseFrameDetector; |
38 class ProcessThread; | 36 class ProcessThread; |
39 class RegistrableCpuOveruseMetricsObserver; | |
40 class SendStatisticsProxy; | 37 class SendStatisticsProxy; |
41 class VideoRenderer; | 38 class VideoRenderer; |
42 | 39 |
43 class VideoCaptureCallback { | 40 class VideoCaptureCallback { |
44 public: | 41 public: |
45 virtual ~VideoCaptureCallback() {} | 42 virtual ~VideoCaptureCallback() {} |
46 | 43 |
47 virtual void DeliverFrame(VideoFrame video_frame) = 0; | 44 virtual void DeliverFrame(VideoFrame video_frame) = 0; |
48 }; | 45 }; |
49 | 46 |
50 namespace internal { | 47 namespace internal { |
51 class VideoCaptureInput : public webrtc::VideoCaptureInput { | 48 class VideoCaptureInput : public webrtc::VideoCaptureInput { |
52 public: | 49 public: |
53 VideoCaptureInput(ProcessThread* module_process_thread, | 50 VideoCaptureInput(VideoCaptureCallback* frame_callback, |
54 VideoCaptureCallback* frame_callback, | |
55 VideoRenderer* local_renderer, | 51 VideoRenderer* local_renderer, |
56 SendStatisticsProxy* send_stats_proxy, | 52 SendStatisticsProxy* send_stats_proxy, |
57 CpuOveruseObserver* overuse_observer, | 53 OveruseFrameDetector* overuse_detector, |
58 EncodingTimeObserver* encoding_time_observer); | 54 EncodingTimeObserver* encoding_time_observer); |
59 ~VideoCaptureInput(); | 55 ~VideoCaptureInput(); |
60 | 56 |
61 void IncomingCapturedFrame(const VideoFrame& video_frame) override; | 57 void IncomingCapturedFrame(const VideoFrame& video_frame) override; |
62 | 58 |
63 private: | 59 private: |
64 // Thread functions for deliver captured frames to receivers. | 60 // Thread functions for deliver captured frames to receivers. |
65 static bool EncoderThreadFunction(void* obj); | 61 static bool EncoderThreadFunction(void* obj); |
66 bool EncoderProcess(); | 62 bool EncoderProcess(); |
67 | 63 |
68 rtc::scoped_ptr<CriticalSectionWrapper> capture_cs_; | 64 rtc::scoped_ptr<CriticalSectionWrapper> capture_cs_; |
69 ProcessThread* const module_process_thread_; | |
70 | 65 |
71 VideoCaptureCallback* const frame_callback_; | 66 VideoCaptureCallback* const frame_callback_; |
72 VideoRenderer* const local_renderer_; | 67 VideoRenderer* const local_renderer_; |
73 SendStatisticsProxy* const stats_proxy_; | 68 SendStatisticsProxy* const stats_proxy_; |
74 | 69 |
75 // Frame used in IncomingFrameI420. | 70 // Frame used in IncomingFrameI420. |
76 rtc::scoped_ptr<CriticalSectionWrapper> incoming_frame_cs_; | 71 rtc::scoped_ptr<CriticalSectionWrapper> incoming_frame_cs_; |
77 VideoFrame incoming_frame_; | 72 VideoFrame incoming_frame_; |
78 | 73 |
79 rtc::PlatformThread encoder_thread_; | 74 rtc::PlatformThread encoder_thread_; |
80 rtc::Event capture_event_; | 75 rtc::Event capture_event_; |
81 | 76 |
82 volatile int stop_; | 77 volatile int stop_; |
83 | 78 |
84 VideoFrame captured_frame_ GUARDED_BY(capture_cs_.get()); | 79 VideoFrame captured_frame_ GUARDED_BY(capture_cs_.get()); |
85 // Used to make sure incoming time stamp is increasing for every frame. | 80 // Used to make sure incoming time stamp is increasing for every frame. |
86 int64_t last_captured_timestamp_; | 81 int64_t last_captured_timestamp_; |
87 // Delta used for translating between NTP and internal timestamps. | 82 // Delta used for translating between NTP and internal timestamps. |
88 const int64_t delta_ntp_internal_ms_; | 83 const int64_t delta_ntp_internal_ms_; |
89 | 84 |
90 rtc::scoped_ptr<OveruseFrameDetector> overuse_detector_; | 85 OveruseFrameDetector* const overuse_detector_; |
91 EncodingTimeObserver* const encoding_time_observer_; | 86 EncodingTimeObserver* const encoding_time_observer_; |
92 }; | 87 }; |
93 | 88 |
94 } // namespace internal | 89 } // namespace internal |
95 } // namespace webrtc | 90 } // namespace webrtc |
96 | 91 |
97 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ | 92 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ |
OLD | NEW |