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

Side by Side Diff: media/cast/video_sender/video_encoder_impl_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
« no previous file with comments | « media/cast/video_sender/video_encoder_impl.cc ('k') | media/cast/video_sender/video_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 void SetExpectedResult(bool expected_key_frame, 29 void SetExpectedResult(bool expected_key_frame,
30 uint8 expected_frame_id, 30 uint8 expected_frame_id,
31 uint8 expected_last_referenced_frame_id, 31 uint8 expected_last_referenced_frame_id,
32 const base::TimeTicks& expected_capture_time) { 32 const base::TimeTicks& expected_capture_time) {
33 expected_key_frame_ = expected_key_frame; 33 expected_key_frame_ = expected_key_frame;
34 expected_frame_id_ = expected_frame_id; 34 expected_frame_id_ = expected_frame_id;
35 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id; 35 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id;
36 expected_capture_time_ = expected_capture_time; 36 expected_capture_time_ = expected_capture_time;
37 } 37 }
38 38
39 void DeliverEncodedVideoFrame(scoped_ptr<EncodedVideoFrame> encoded_frame, 39 void DeliverEncodedVideoFrame(
40 const base::TimeTicks& capture_time) { 40 scoped_ptr<transport::EncodedVideoFrame> encoded_frame,
41 const base::TimeTicks& capture_time) {
41 EXPECT_EQ(expected_key_frame_, encoded_frame->key_frame); 42 EXPECT_EQ(expected_key_frame_, encoded_frame->key_frame);
42 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id); 43 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id);
43 EXPECT_EQ(expected_last_referenced_frame_id_, 44 EXPECT_EQ(expected_last_referenced_frame_id_,
44 encoded_frame->last_referenced_frame_id); 45 encoded_frame->last_referenced_frame_id);
45 EXPECT_EQ(expected_capture_time_, capture_time); 46 EXPECT_EQ(expected_capture_time_, capture_time);
46 } 47 }
47 48
48 protected: 49 protected:
49 virtual ~TestVideoEncoderCallback() {} 50 virtual ~TestVideoEncoderCallback() {}
50 51
(...skipping 17 matching lines...) Expand all
68 video_config_.use_external_encoder = false; 69 video_config_.use_external_encoder = false;
69 video_config_.width = 320; 70 video_config_.width = 320;
70 video_config_.height = 240; 71 video_config_.height = 240;
71 video_config_.max_bitrate = 5000000; 72 video_config_.max_bitrate = 5000000;
72 video_config_.min_bitrate = 1000000; 73 video_config_.min_bitrate = 1000000;
73 video_config_.start_bitrate = 2000000; 74 video_config_.start_bitrate = 2000000;
74 video_config_.max_qp = 56; 75 video_config_.max_qp = 56;
75 video_config_.min_qp = 0; 76 video_config_.min_qp = 0;
76 video_config_.max_frame_rate = 30; 77 video_config_.max_frame_rate = 30;
77 video_config_.max_number_of_video_buffers_used = 3; 78 video_config_.max_number_of_video_buffers_used = 3;
78 video_config_.codec = kVp8; 79 video_config_.codec = transport::kVp8;
79 gfx::Size size(video_config_.width, video_config_.height); 80 gfx::Size size(video_config_.width, video_config_.height);
80 video_frame_ = media::VideoFrame::CreateFrame(VideoFrame::I420, 81 video_frame_ = media::VideoFrame::CreateFrame(VideoFrame::I420,
81 size, gfx::Rect(size), size, base::TimeDelta()); 82 size, gfx::Rect(size), size, base::TimeDelta());
82 PopulateVideoFrame(video_frame_, 123); 83 PopulateVideoFrame(video_frame_, 123);
83 } 84 }
84 85
85 virtual ~VideoEncoderImplTest() {} 86 virtual ~VideoEncoderImplTest() {}
86 87
87 virtual void SetUp() { 88 virtual void SetUp() {
88 task_runner_ = new test::FakeTaskRunner(&testing_clock_); 89 task_runner_ = new test::FakeTaskRunner(&testing_clock_);
89 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, 90 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_,
90 task_runner_, task_runner_, task_runner_, task_runner_, 91 task_runner_, task_runner_, task_runner_, task_runner_,
91 GetDefaultCastLoggingConfig()); 92 task_runner_, GetDefaultCastLoggingConfig());
92 } 93 }
93 94
94 void Configure(uint8 max_unacked_frames) { 95 void Configure(uint8 max_unacked_frames) {
95 video_encoder_.reset(new VideoEncoderImpl(cast_environment_, video_config_, 96 video_encoder_.reset(new VideoEncoderImpl(cast_environment_, video_config_,
96 max_unacked_frames)); 97 max_unacked_frames));
97 } 98 }
98 99
99 base::SimpleTestTickClock testing_clock_; 100 base::SimpleTestTickClock testing_clock_;
100 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_; 101 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_;
101 VideoSenderConfig video_config_; 102 VideoSenderConfig video_config_;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 for (int i = 5; i < 17; ++i) { 238 for (int i = 5; i < 17; ++i) {
238 test_video_encoder_callback_->SetExpectedResult(false, i, 4, capture_time); 239 test_video_encoder_callback_->SetExpectedResult(false, i, 4, capture_time);
239 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(video_frame_, capture_time, 240 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(video_frame_, capture_time,
240 frame_encoded_callback)); 241 frame_encoded_callback));
241 task_runner_->RunTasks(); 242 task_runner_->RunTasks();
242 } 243 }
243 } 244 }
244 245
245 } // namespace cast 246 } // namespace cast
246 } // namespace media 247 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_sender/video_encoder_impl.cc ('k') | media/cast/video_sender/video_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698