Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: webrtc/video/video_capture_input.h

Issue 1569853002: Measure encoding time on encode callbacks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 19 #include "webrtc/base/scoped_ptr.h"
åsapersson 2016/02/04 11:17:55 can this be removed?
pbos-webrtc 2016/02/04 12:38:04 Done.
20 #include "webrtc/base/thread_annotations.h" 20 #include "webrtc/base/thread_annotations.h"
21 #include "webrtc/common_types.h" 21 #include "webrtc/common_types.h"
22 #include "webrtc/engine_configurations.h" 22 #include "webrtc/engine_configurations.h"
23 #include "webrtc/modules/video_capture/video_capture.h" 23 #include "webrtc/modules/video_capture/video_capture.h"
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/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 CpuOveruseMetricsObserver;
34 class CpuOveruseObserver;
35 class OveruseFrameDetector; 33 class OveruseFrameDetector;
36 class ProcessThread; 34 class ProcessThread;
åsapersson 2016/02/04 11:17:55 can this be removed?
pbos-webrtc 2016/02/04 12:38:04 Done.
37 class RegistrableCpuOveruseMetricsObserver;
38 class SendStatisticsProxy; 35 class SendStatisticsProxy;
39 class VideoRenderer; 36 class VideoRenderer;
40 37
41 class VideoCaptureCallback { 38 class VideoCaptureCallback {
42 public: 39 public:
43 virtual ~VideoCaptureCallback() {} 40 virtual ~VideoCaptureCallback() {}
44 41
45 virtual void DeliverFrame(VideoFrame video_frame) = 0; 42 virtual void DeliverFrame(VideoFrame video_frame) = 0;
46 }; 43 };
47 44
48 namespace internal { 45 namespace internal {
49 class VideoCaptureInput : public webrtc::VideoCaptureInput { 46 class VideoCaptureInput : public webrtc::VideoCaptureInput {
50 public: 47 public:
51 VideoCaptureInput(ProcessThread* module_process_thread, 48 VideoCaptureInput(VideoCaptureCallback* frame_callback,
52 VideoCaptureCallback* frame_callback,
53 VideoRenderer* local_renderer, 49 VideoRenderer* local_renderer,
54 SendStatisticsProxy* send_stats_proxy, 50 SendStatisticsProxy* send_stats_proxy,
55 CpuOveruseObserver* overuse_observer, 51 OveruseFrameDetector* overuse_detector);
56 EncodingTimeObserver* encoding_time_observer);
57 ~VideoCaptureInput(); 52 ~VideoCaptureInput();
58 53
59 void IncomingCapturedFrame(const VideoFrame& video_frame) override; 54 void IncomingCapturedFrame(const VideoFrame& video_frame) override;
60 55
61 private: 56 private:
62 // Thread functions for deliver captured frames to receivers. 57 // Thread functions for deliver captured frames to receivers.
63 static bool EncoderThreadFunction(void* obj); 58 static bool EncoderThreadFunction(void* obj);
64 bool EncoderProcess(); 59 bool EncoderProcess();
65 60
66 rtc::CriticalSection crit_; 61 rtc::CriticalSection crit_;
67 ProcessThread* const module_process_thread_;
68 62
69 VideoCaptureCallback* const frame_callback_; 63 VideoCaptureCallback* const frame_callback_;
70 VideoRenderer* const local_renderer_; 64 VideoRenderer* const local_renderer_;
71 SendStatisticsProxy* const stats_proxy_; 65 SendStatisticsProxy* const stats_proxy_;
72 66
73 rtc::PlatformThread encoder_thread_; 67 rtc::PlatformThread encoder_thread_;
74 rtc::Event capture_event_; 68 rtc::Event capture_event_;
75 69
76 volatile int stop_; 70 volatile int stop_;
77 71
78 VideoFrame captured_frame_ GUARDED_BY(crit_); 72 VideoFrame captured_frame_ GUARDED_BY(crit_);
79 // Used to make sure incoming time stamp is increasing for every frame. 73 // Used to make sure incoming time stamp is increasing for every frame.
80 int64_t last_captured_timestamp_; 74 int64_t last_captured_timestamp_;
81 // Delta used for translating between NTP and internal timestamps. 75 // Delta used for translating between NTP and internal timestamps.
82 const int64_t delta_ntp_internal_ms_; 76 const int64_t delta_ntp_internal_ms_;
83 77
84 rtc::scoped_ptr<OveruseFrameDetector> overuse_detector_; 78 OveruseFrameDetector* const overuse_detector_;
85 EncodingTimeObserver* const encoding_time_observer_;
86 }; 79 };
87 80
88 } // namespace internal 81 } // namespace internal
89 } // namespace webrtc 82 } // namespace webrtc
90 83
91 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ 84 #endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698