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 16 matching lines...) Expand all Loading... |
27 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
28 #include "webrtc/video_send_stream.h" | 28 #include "webrtc/video_send_stream.h" |
29 | 29 |
30 namespace webrtc { | 30 namespace webrtc { |
31 | 31 |
32 class Config; | 32 class Config; |
33 class OveruseFrameDetector; | 33 class OveruseFrameDetector; |
34 class SendStatisticsProxy; | 34 class SendStatisticsProxy; |
35 class VideoRenderer; | 35 class VideoRenderer; |
36 | 36 |
37 class VideoCaptureCallback { | |
38 public: | |
39 virtual ~VideoCaptureCallback() {} | |
40 | |
41 virtual void DeliverFrame(VideoFrame video_frame) = 0; | |
42 }; | |
43 | |
44 namespace internal { | 37 namespace internal { |
45 class VideoCaptureInput : public webrtc::VideoCaptureInput { | 38 class VideoCaptureInput : public webrtc::VideoCaptureInput { |
46 public: | 39 public: |
47 VideoCaptureInput(VideoCaptureCallback* frame_callback, | 40 VideoCaptureInput(rtc::Event* capture_event, |
48 VideoRenderer* local_renderer, | 41 VideoRenderer* local_renderer, |
49 SendStatisticsProxy* send_stats_proxy, | 42 SendStatisticsProxy* send_stats_proxy, |
50 OveruseFrameDetector* overuse_detector); | 43 OveruseFrameDetector* overuse_detector); |
51 ~VideoCaptureInput(); | 44 ~VideoCaptureInput(); |
52 | 45 |
53 void IncomingCapturedFrame(const VideoFrame& video_frame) override; | 46 void IncomingCapturedFrame(const VideoFrame& video_frame) override; |
54 | 47 |
| 48 bool GetVideoFrame(VideoFrame* frame); |
| 49 |
55 private: | 50 private: |
56 // Thread functions for deliver captured frames to receivers. | |
57 static bool EncoderThreadFunction(void* obj); | |
58 bool EncoderProcess(); | |
59 | |
60 rtc::CriticalSection crit_; | 51 rtc::CriticalSection crit_; |
61 | 52 |
62 VideoCaptureCallback* const frame_callback_; | |
63 VideoRenderer* const local_renderer_; | 53 VideoRenderer* const local_renderer_; |
64 SendStatisticsProxy* const stats_proxy_; | 54 SendStatisticsProxy* const stats_proxy_; |
65 | 55 rtc::Event* const capture_event_; |
66 rtc::PlatformThread encoder_thread_; | |
67 rtc::Event capture_event_; | |
68 | |
69 volatile int stop_; | |
70 | 56 |
71 VideoFrame captured_frame_ GUARDED_BY(crit_); | 57 VideoFrame captured_frame_ GUARDED_BY(crit_); |
72 Clock* const clock_; | 58 Clock* const clock_; |
73 // Used to make sure incoming time stamp is increasing for every frame. | 59 // Used to make sure incoming time stamp is increasing for every frame. |
74 int64_t last_captured_timestamp_; | 60 int64_t last_captured_timestamp_; |
75 // Delta used for translating between NTP and internal timestamps. | 61 // Delta used for translating between NTP and internal timestamps. |
76 const int64_t delta_ntp_internal_ms_; | 62 const int64_t delta_ntp_internal_ms_; |
77 | 63 |
78 OveruseFrameDetector* const overuse_detector_; | 64 OveruseFrameDetector* const overuse_detector_; |
79 }; | 65 }; |
80 | 66 |
81 } // namespace internal | 67 } // namespace internal |
82 } // namespace webrtc | 68 } // namespace webrtc |
83 | 69 |
84 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ | 70 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ |
OLD | NEW |