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

Side by Side Diff: webrtc/video/video_capture_input_unittest.cc

Issue 1569853002: Measure encoding time on encode callbacks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add extended overuse time Created 4 years, 11 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 #include "webrtc/video/video_capture_input.h" 10 #include "webrtc/video/video_capture_input.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 output_frame_event_(false, false), 54 output_frame_event_(false, false),
55 stats_proxy_(Clock::GetRealTimeClock(), 55 stats_proxy_(Clock::GetRealTimeClock(),
56 webrtc::VideoSendStream::Config(nullptr), 56 webrtc::VideoSendStream::Config(nullptr),
57 webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo) {} 57 webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo) {}
58 58
59 virtual void SetUp() { 59 virtual void SetUp() {
60 EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_)) 60 EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_))
61 .WillRepeatedly( 61 .WillRepeatedly(
62 WithArg<0>(Invoke(this, &VideoCaptureInputTest::AddOutputFrame))); 62 WithArg<0>(Invoke(this, &VideoCaptureInputTest::AddOutputFrame)));
63 63
64 Config config; 64 overuse_detector_.reset(new OveruseFrameDetector(Clock::GetRealTimeClock(),
65 input_.reset(new internal::VideoCaptureInput( 65 CpuOveruseOptions(),
66 mock_process_thread_.get(), mock_frame_callback_.get(), nullptr, 66 nullptr,
67 &stats_proxy_, nullptr, nullptr)); 67 &stats_proxy_));
68 input_.reset(new internal::VideoCaptureInput(mock_frame_callback_.get(),
69 nullptr,
70 &stats_proxy_,
71 overuse_detector_.get(),
72 nullptr));
68 } 73 }
69 74
70 virtual void TearDown() { 75 virtual void TearDown() {
71 // VideoCaptureInput accesses |mock_process_thread_| in destructor and 76 // VideoCaptureInput accesses |mock_process_thread_| in destructor and
72 // should 77 // should
73 // be deleted first. 78 // be deleted first.
74 input_.reset(); 79 input_.reset();
75 } 80 }
76 81
77 void AddInputFrame(VideoFrame* frame) { 82 void AddInputFrame(VideoFrame* frame) {
78 input_->IncomingCapturedFrame(*frame); 83 input_->IncomingCapturedFrame(*frame);
79 } 84 }
80 85
81 void AddOutputFrame(const VideoFrame& frame) { 86 void AddOutputFrame(const VideoFrame& frame) {
82 if (frame.native_handle() == NULL) 87 if (frame.native_handle() == NULL)
83 output_frame_ybuffers_.push_back(frame.buffer(kYPlane)); 88 output_frame_ybuffers_.push_back(frame.buffer(kYPlane));
84 output_frames_.push_back(new VideoFrame(frame)); 89 output_frames_.push_back(new VideoFrame(frame));
85 output_frame_event_.Set(); 90 output_frame_event_.Set();
86 } 91 }
87 92
88 void WaitOutputFrame() { 93 void WaitOutputFrame() {
89 EXPECT_TRUE(output_frame_event_.Wait(FRAME_TIMEOUT_MS)); 94 EXPECT_TRUE(output_frame_event_.Wait(FRAME_TIMEOUT_MS));
90 } 95 }
91 96
92 rtc::scoped_ptr<MockProcessThread> mock_process_thread_; 97 rtc::scoped_ptr<MockProcessThread> mock_process_thread_;
93 rtc::scoped_ptr<MockVideoCaptureCallback> mock_frame_callback_; 98 rtc::scoped_ptr<MockVideoCaptureCallback> mock_frame_callback_;
94 99
100 rtc::scoped_ptr<OveruseFrameDetector> overuse_detector_;
101
95 // Used to send input capture frames to VideoCaptureInput. 102 // Used to send input capture frames to VideoCaptureInput.
96 rtc::scoped_ptr<internal::VideoCaptureInput> input_; 103 rtc::scoped_ptr<internal::VideoCaptureInput> input_;
97 104
98 // Input capture frames of VideoCaptureInput. 105 // Input capture frames of VideoCaptureInput.
99 ScopedVector<VideoFrame> input_frames_; 106 ScopedVector<VideoFrame> input_frames_;
100 107
101 // Indicate an output frame has arrived. 108 // Indicate an output frame has arrived.
102 rtc::Event output_frame_event_; 109 rtc::Event output_frame_event_;
103 110
104 // Output delivered frames of VideoCaptureInput. 111 // Output delivered frames of VideoCaptureInput.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 const int kSizeY = width * height * 2; 303 const int kSizeY = width * height * 2;
297 uint8_t buffer[kSizeY]; 304 uint8_t buffer[kSizeY];
298 memset(buffer, data, kSizeY); 305 memset(buffer, data, kSizeY);
299 frame->CreateFrame(buffer, buffer, buffer, width, height, width, width / 2, 306 frame->CreateFrame(buffer, buffer, buffer, width, height, width, width / 2,
300 width / 2); 307 width / 2);
301 frame->set_render_time_ms(data); 308 frame->set_render_time_ms(data);
302 return frame; 309 return frame;
303 } 310 }
304 311
305 } // namespace webrtc 312 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698