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

Side by Side Diff: media/cast/video_sender/external_video_encoder_unittest.cc

Issue 109413004: Cast:Adding cast_transport_config and cleaning up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 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 | Annotate | Revision Log
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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 20 matching lines...) Expand all
31 void SetExpectedResult(bool expected_key_frame, 31 void SetExpectedResult(bool expected_key_frame,
32 uint8 expected_frame_id, 32 uint8 expected_frame_id,
33 uint8 expected_last_referenced_frame_id, 33 uint8 expected_last_referenced_frame_id,
34 const base::TimeTicks& expected_capture_time) { 34 const base::TimeTicks& expected_capture_time) {
35 expected_key_frame_ = expected_key_frame; 35 expected_key_frame_ = expected_key_frame;
36 expected_frame_id_ = expected_frame_id; 36 expected_frame_id_ = expected_frame_id;
37 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id; 37 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id;
38 expected_capture_time_ = expected_capture_time; 38 expected_capture_time_ = expected_capture_time;
39 } 39 }
40 40
41 void DeliverEncodedVideoFrame(scoped_ptr<EncodedVideoFrame> encoded_frame, 41 void DeliverEncodedVideoFrame(
42 const base::TimeTicks& capture_time) { 42 scoped_ptr<transport::EncodedVideoFrame> encoded_frame,
43 const base::TimeTicks& capture_time) {
43 EXPECT_EQ(expected_key_frame_, encoded_frame->key_frame); 44 EXPECT_EQ(expected_key_frame_, encoded_frame->key_frame);
44 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id); 45 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id);
45 EXPECT_EQ(expected_last_referenced_frame_id_, 46 EXPECT_EQ(expected_last_referenced_frame_id_,
46 encoded_frame->last_referenced_frame_id); 47 encoded_frame->last_referenced_frame_id);
47 EXPECT_EQ(expected_capture_time_, capture_time); 48 EXPECT_EQ(expected_capture_time_, capture_time);
48 } 49 }
49 50
50 protected: 51 protected:
51 virtual ~TestVideoEncoderCallback() {} 52 virtual ~TestVideoEncoderCallback() {}
52 53
(...skipping 18 matching lines...) Expand all
71 video_config_.use_external_encoder = true; 72 video_config_.use_external_encoder = true;
72 video_config_.width = 320; 73 video_config_.width = 320;
73 video_config_.height = 240; 74 video_config_.height = 240;
74 video_config_.max_bitrate = 5000000; 75 video_config_.max_bitrate = 5000000;
75 video_config_.min_bitrate = 1000000; 76 video_config_.min_bitrate = 1000000;
76 video_config_.start_bitrate = 2000000; 77 video_config_.start_bitrate = 2000000;
77 video_config_.max_qp = 56; 78 video_config_.max_qp = 56;
78 video_config_.min_qp = 0; 79 video_config_.min_qp = 0;
79 video_config_.max_frame_rate = 30; 80 video_config_.max_frame_rate = 30;
80 video_config_.max_number_of_video_buffers_used = 3; 81 video_config_.max_number_of_video_buffers_used = 3;
81 video_config_.codec = kVp8; 82 video_config_.codec = transport::kVp8;
82 gfx::Size size(video_config_.width, video_config_.height); 83 gfx::Size size(video_config_.width, video_config_.height);
83 video_frame_ = media::VideoFrame::CreateFrame(VideoFrame::I420, 84 video_frame_ = media::VideoFrame::CreateFrame(VideoFrame::I420,
84 size, gfx::Rect(size), size, base::TimeDelta()); 85 size, gfx::Rect(size), size, base::TimeDelta());
85 PopulateVideoFrame(video_frame_, 123); 86 PopulateVideoFrame(video_frame_, 123);
86 } 87 }
87 88
88 virtual ~ExternalVideoEncoderTest() {} 89 virtual ~ExternalVideoEncoderTest() {}
89 90
90 virtual void SetUp() { 91 virtual void SetUp() {
91 task_runner_ = new test::FakeTaskRunner(&testing_clock_); 92 task_runner_ = new test::FakeTaskRunner(&testing_clock_);
92 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, 93 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_,
93 task_runner_, task_runner_, task_runner_, task_runner_, 94 task_runner_, task_runner_, task_runner_, task_runner_, task_runner_,
94 GetDefaultCastLoggingConfig()); 95 GetDefaultCastLoggingConfig());
95 video_encoder_.reset(new ExternalVideoEncoder( 96 video_encoder_.reset(new ExternalVideoEncoder(
96 cast_environment_, 97 cast_environment_,
97 video_config_, 98 video_config_,
98 new test::FakeGpuVideoAcceleratorFactories(task_runner_))); 99 new test::FakeGpuVideoAcceleratorFactories(task_runner_)));
99 } 100 }
100 101
101 base::SimpleTestTickClock testing_clock_; 102 base::SimpleTestTickClock testing_clock_;
102 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_; 103 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_;
103 VideoSenderConfig video_config_; 104 VideoSenderConfig video_config_;
(...skipping 22 matching lines...) Expand all
126 test_video_encoder_callback_->SetExpectedResult(false, i + 1, i, 127 test_video_encoder_callback_->SetExpectedResult(false, i + 1, i,
127 capture_time); 128 capture_time);
128 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(video_frame_, capture_time, 129 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(video_frame_, capture_time,
129 frame_encoded_callback)); 130 frame_encoded_callback));
130 task_runner_->RunTasks(); 131 task_runner_->RunTasks();
131 } 132 }
132 } 133 }
133 134
134 } // namespace cast 135 } // namespace cast
135 } // namespace media 136 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_sender/external_video_encoder.cc ('k') | media/cast/video_sender/video_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698