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 |
11 #ifndef WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ | 11 #ifndef WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ |
12 #define WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ | 12 #define WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
17 #include "webrtc/base/event.h" | 17 #include "webrtc/base/event.h" |
18 #include "webrtc/base/platform_thread.h" | 18 #include "webrtc/base/platform_thread.h" |
19 #include "webrtc/base/scoped_ptr.h" | |
20 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
21 #include "webrtc/common_types.h" | 20 #include "webrtc/common_types.h" |
22 #include "webrtc/engine_configurations.h" | 21 #include "webrtc/engine_configurations.h" |
23 #include "webrtc/modules/video_capture/video_capture.h" | 22 #include "webrtc/modules/video_capture/video_capture.h" |
24 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 23 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
25 #include "webrtc/modules/video_coding/include/video_coding.h" | 24 #include "webrtc/modules/video_coding/include/video_coding.h" |
26 #include "webrtc/modules/video_processing/include/video_processing.h" | 25 #include "webrtc/modules/video_processing/include/video_processing.h" |
27 #include "webrtc/typedefs.h" | 26 #include "webrtc/typedefs.h" |
28 #include "webrtc/video_send_stream.h" | 27 #include "webrtc/video_send_stream.h" |
29 | 28 |
30 namespace webrtc { | 29 namespace webrtc { |
31 | 30 |
32 class Config; | 31 class Config; |
33 class CpuOveruseMetricsObserver; | |
34 class CpuOveruseObserver; | |
35 class OveruseFrameDetector; | 32 class OveruseFrameDetector; |
36 class ProcessThread; | |
37 class RegistrableCpuOveruseMetricsObserver; | |
38 class SendStatisticsProxy; | 33 class SendStatisticsProxy; |
39 class VideoRenderer; | 34 class VideoRenderer; |
40 | 35 |
41 class VideoCaptureCallback { | 36 class VideoCaptureCallback { |
42 public: | 37 public: |
43 virtual ~VideoCaptureCallback() {} | 38 virtual ~VideoCaptureCallback() {} |
44 | 39 |
45 virtual void DeliverFrame(VideoFrame video_frame) = 0; | 40 virtual void DeliverFrame(VideoFrame video_frame) = 0; |
46 }; | 41 }; |
47 | 42 |
48 namespace internal { | 43 namespace internal { |
49 class VideoCaptureInput : public webrtc::VideoCaptureInput { | 44 class VideoCaptureInput : public webrtc::VideoCaptureInput { |
50 public: | 45 public: |
51 VideoCaptureInput(ProcessThread* module_process_thread, | 46 VideoCaptureInput(VideoCaptureCallback* frame_callback, |
52 VideoCaptureCallback* frame_callback, | |
53 VideoRenderer* local_renderer, | 47 VideoRenderer* local_renderer, |
54 SendStatisticsProxy* send_stats_proxy, | 48 SendStatisticsProxy* send_stats_proxy, |
55 CpuOveruseObserver* overuse_observer, | 49 OveruseFrameDetector* overuse_detector); |
56 EncodingTimeObserver* encoding_time_observer); | |
57 ~VideoCaptureInput(); | 50 ~VideoCaptureInput(); |
58 | 51 |
59 void IncomingCapturedFrame(const VideoFrame& video_frame) override; | 52 void IncomingCapturedFrame(const VideoFrame& video_frame) override; |
60 | 53 |
61 private: | 54 private: |
62 // Thread functions for deliver captured frames to receivers. | 55 // Thread functions for deliver captured frames to receivers. |
63 static bool EncoderThreadFunction(void* obj); | 56 static bool EncoderThreadFunction(void* obj); |
64 bool EncoderProcess(); | 57 bool EncoderProcess(); |
65 | 58 |
66 rtc::CriticalSection crit_; | 59 rtc::CriticalSection crit_; |
67 ProcessThread* const module_process_thread_; | |
68 | 60 |
69 VideoCaptureCallback* const frame_callback_; | 61 VideoCaptureCallback* const frame_callback_; |
70 VideoRenderer* const local_renderer_; | 62 VideoRenderer* const local_renderer_; |
71 SendStatisticsProxy* const stats_proxy_; | 63 SendStatisticsProxy* const stats_proxy_; |
72 | 64 |
73 rtc::PlatformThread encoder_thread_; | 65 rtc::PlatformThread encoder_thread_; |
74 rtc::Event capture_event_; | 66 rtc::Event capture_event_; |
75 | 67 |
76 volatile int stop_; | 68 volatile int stop_; |
77 | 69 |
78 VideoFrame captured_frame_ GUARDED_BY(crit_); | 70 VideoFrame captured_frame_ GUARDED_BY(crit_); |
79 // Used to make sure incoming time stamp is increasing for every frame. | 71 // Used to make sure incoming time stamp is increasing for every frame. |
80 int64_t last_captured_timestamp_; | 72 int64_t last_captured_timestamp_; |
81 // Delta used for translating between NTP and internal timestamps. | 73 // Delta used for translating between NTP and internal timestamps. |
82 const int64_t delta_ntp_internal_ms_; | 74 const int64_t delta_ntp_internal_ms_; |
83 | 75 |
84 rtc::scoped_ptr<OveruseFrameDetector> overuse_detector_; | 76 OveruseFrameDetector* const overuse_detector_; |
85 EncodingTimeObserver* const encoding_time_observer_; | |
86 }; | 77 }; |
87 | 78 |
88 } // namespace internal | 79 } // namespace internal |
89 } // namespace webrtc | 80 } // namespace webrtc |
90 | 81 |
91 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ | 82 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ |
OLD | NEW |