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

Side by Side Diff: media/cast/sender/video_encoder_unittest.cc

Issue 1829163002: Lazily prune the multibuffer block cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no export Created 4 years, 8 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "media/base/fake_single_thread_task_runner.h"
15 #include "media/base/video_frame.h" 16 #include "media/base/video_frame.h"
16 #include "media/cast/cast_defines.h" 17 #include "media/cast/cast_defines.h"
17 #include "media/cast/cast_environment.h" 18 #include "media/cast/cast_environment.h"
18 #include "media/cast/common/rtp_time.h" 19 #include "media/cast/common/rtp_time.h"
19 #include "media/cast/sender/fake_video_encode_accelerator_factory.h" 20 #include "media/cast/sender/fake_video_encode_accelerator_factory.h"
20 #include "media/cast/sender/video_encoder.h" 21 #include "media/cast/sender/video_encoder.h"
21 #include "media/cast/sender/video_frame_factory.h" 22 #include "media/cast/sender/video_frame_factory.h"
22 #include "media/cast/test/fake_single_thread_task_runner.h"
23 #include "media/cast/test/utility/default_config.h" 23 #include "media/cast/test/utility/default_config.h"
24 #include "media/cast/test/utility/video_utility.h" 24 #include "media/cast/test/utility/video_utility.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 #include "media/cast/sender/h264_vt_encoder.h" 28 #include "media/cast/sender/h264_vt_encoder.h"
29 #endif 29 #endif
30 30
31 namespace media { 31 namespace media {
32 namespace cast { 32 namespace cast {
33 33
34 class VideoEncoderTest 34 class VideoEncoderTest
35 : public ::testing::TestWithParam<std::pair<Codec, bool>> { 35 : public ::testing::TestWithParam<std::pair<Codec, bool>> {
36 protected: 36 protected:
37 VideoEncoderTest() 37 VideoEncoderTest()
38 : testing_clock_(new base::SimpleTestTickClock()), 38 : testing_clock_(new base::SimpleTestTickClock()),
39 task_runner_(new test::FakeSingleThreadTaskRunner(testing_clock_)), 39 task_runner_(new FakeSingleThreadTaskRunner(testing_clock_)),
40 cast_environment_( 40 cast_environment_(
41 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_), 41 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_),
42 task_runner_, 42 task_runner_,
43 task_runner_, 43 task_runner_,
44 task_runner_)), 44 task_runner_)),
45 video_config_(GetDefaultVideoSenderConfig()), 45 video_config_(GetDefaultVideoSenderConfig()),
46 operational_status_(STATUS_UNINITIALIZED), 46 operational_status_(STATUS_UNINITIALIZED),
47 count_frames_delivered_(0) { 47 count_frames_delivered_(0) {
48 testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks()); 48 testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
49 first_frame_time_ = testing_clock_->NowTicks(); 49 first_frame_time_ = testing_clock_->NowTicks();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 ASSERT_TRUE(std::isfinite(encoded_frame->deadline_utilization)); 255 ASSERT_TRUE(std::isfinite(encoded_frame->deadline_utilization));
256 EXPECT_LE(0.0, encoded_frame->deadline_utilization); 256 EXPECT_LE(0.0, encoded_frame->deadline_utilization);
257 ASSERT_TRUE(std::isfinite(encoded_frame->lossy_utilization)); 257 ASSERT_TRUE(std::isfinite(encoded_frame->lossy_utilization));
258 EXPECT_LE(0.0, encoded_frame->lossy_utilization); 258 EXPECT_LE(0.0, encoded_frame->lossy_utilization);
259 } 259 }
260 260
261 ++count_frames_delivered_; 261 ++count_frames_delivered_;
262 } 262 }
263 263
264 base::SimpleTestTickClock* const testing_clock_; // Owned by CastEnvironment. 264 base::SimpleTestTickClock* const testing_clock_; // Owned by CastEnvironment.
265 const scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 265 const scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
266 const scoped_refptr<CastEnvironment> cast_environment_; 266 const scoped_refptr<CastEnvironment> cast_environment_;
267 VideoSenderConfig video_config_; 267 VideoSenderConfig video_config_;
268 scoped_ptr<FakeVideoEncodeAcceleratorFactory> vea_factory_; 268 scoped_ptr<FakeVideoEncodeAcceleratorFactory> vea_factory_;
269 base::TimeTicks first_frame_time_; 269 base::TimeTicks first_frame_time_;
270 OperationalStatus operational_status_; 270 OperationalStatus operational_status_;
271 scoped_ptr<VideoEncoder> video_encoder_; 271 scoped_ptr<VideoEncoder> video_encoder_;
272 scoped_ptr<VideoFrameFactory> video_frame_factory_; 272 scoped_ptr<VideoFrameFactory> video_frame_factory_;
273 273
274 int count_frames_delivered_; 274 int count_frames_delivered_;
275 275
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 #endif 419 #endif
420 return values; 420 return values;
421 } 421 }
422 } // namespace 422 } // namespace
423 423
424 INSTANTIATE_TEST_CASE_P( 424 INSTANTIATE_TEST_CASE_P(
425 , VideoEncoderTest, ::testing::ValuesIn(DetermineEncodersToTest())); 425 , VideoEncoderTest, ::testing::ValuesIn(DetermineEncodersToTest()));
426 426
427 } // namespace cast 427 } // namespace cast
428 } // namespace media 428 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/congestion_control_unittest.cc ('k') | media/cast/sender/video_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698