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

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

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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"
11 #include "media/cast/cast_defines.h" 11 #include "media/cast/cast_defines.h"
12 #include "media/cast/cast_environment.h" 12 #include "media/cast/cast_environment.h"
13 #include "media/cast/sender/external_video_encoder.h"
13 #include "media/cast/test/fake_single_thread_task_runner.h" 14 #include "media/cast/test/fake_single_thread_task_runner.h"
14 #include "media/cast/test/fake_video_encode_accelerator.h" 15 #include "media/cast/test/fake_video_encode_accelerator.h"
15 #include "media/cast/test/utility/video_utility.h" 16 #include "media/cast/test/utility/video_utility.h"
16 #include "media/cast/video_sender/external_video_encoder.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 18
19 namespace media { 19 namespace media {
20 namespace cast { 20 namespace cast {
21 21
22 using testing::_; 22 using testing::_;
23 23
24 namespace { 24 namespace {
25 25
26 void CreateVideoEncodeAccelerator( 26 void CreateVideoEncodeAccelerator(
(...skipping 20 matching lines...) Expand all
47 47
48 void SetExpectedResult(uint32 expected_frame_id, 48 void SetExpectedResult(uint32 expected_frame_id,
49 uint32 expected_last_referenced_frame_id, 49 uint32 expected_last_referenced_frame_id,
50 const base::TimeTicks& expected_capture_time) { 50 const base::TimeTicks& expected_capture_time) {
51 expected_frame_id_ = expected_frame_id; 51 expected_frame_id_ = expected_frame_id;
52 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id; 52 expected_last_referenced_frame_id_ = expected_last_referenced_frame_id;
53 expected_capture_time_ = expected_capture_time; 53 expected_capture_time_ = expected_capture_time;
54 } 54 }
55 55
56 void DeliverEncodedVideoFrame( 56 void DeliverEncodedVideoFrame(
57 scoped_ptr<transport::EncodedFrame> encoded_frame) { 57 scoped_ptr<EncodedFrame> encoded_frame) {
58 if (expected_frame_id_ == expected_last_referenced_frame_id_) { 58 if (expected_frame_id_ == expected_last_referenced_frame_id_) {
59 EXPECT_EQ(transport::EncodedFrame::KEY, encoded_frame->dependency); 59 EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency);
60 } else { 60 } else {
61 EXPECT_EQ(transport::EncodedFrame::DEPENDENT, 61 EXPECT_EQ(EncodedFrame::DEPENDENT,
62 encoded_frame->dependency); 62 encoded_frame->dependency);
63 } 63 }
64 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id); 64 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id);
65 EXPECT_EQ(expected_last_referenced_frame_id_, 65 EXPECT_EQ(expected_last_referenced_frame_id_,
66 encoded_frame->referenced_frame_id); 66 encoded_frame->referenced_frame_id);
67 EXPECT_EQ(expected_capture_time_, encoded_frame->reference_time); 67 EXPECT_EQ(expected_capture_time_, encoded_frame->reference_time);
68 } 68 }
69 69
70 protected: 70 protected:
71 virtual ~TestVideoEncoderCallback() {} 71 virtual ~TestVideoEncoderCallback() {}
(...skipping 20 matching lines...) Expand all
92 video_config_.use_external_encoder = true; 92 video_config_.use_external_encoder = true;
93 video_config_.width = 320; 93 video_config_.width = 320;
94 video_config_.height = 240; 94 video_config_.height = 240;
95 video_config_.max_bitrate = 5000000; 95 video_config_.max_bitrate = 5000000;
96 video_config_.min_bitrate = 1000000; 96 video_config_.min_bitrate = 1000000;
97 video_config_.start_bitrate = 2000000; 97 video_config_.start_bitrate = 2000000;
98 video_config_.max_qp = 56; 98 video_config_.max_qp = 56;
99 video_config_.min_qp = 0; 99 video_config_.min_qp = 0;
100 video_config_.max_frame_rate = 30; 100 video_config_.max_frame_rate = 30;
101 video_config_.max_number_of_video_buffers_used = 3; 101 video_config_.max_number_of_video_buffers_used = 3;
102 video_config_.codec = transport::CODEC_VIDEO_VP8; 102 video_config_.codec = CODEC_VIDEO_VP8;
103 gfx::Size size(video_config_.width, video_config_.height); 103 gfx::Size size(video_config_.width, video_config_.height);
104 video_frame_ = media::VideoFrame::CreateFrame( 104 video_frame_ = media::VideoFrame::CreateFrame(
105 VideoFrame::I420, size, gfx::Rect(size), size, base::TimeDelta()); 105 VideoFrame::I420, size, gfx::Rect(size), size, base::TimeDelta());
106 PopulateVideoFrame(video_frame_, 123); 106 PopulateVideoFrame(video_frame_, 123);
107 107
108 testing_clock_ = new base::SimpleTestTickClock(); 108 testing_clock_ = new base::SimpleTestTickClock();
109 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); 109 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_);
110 cast_environment_ = 110 cast_environment_ =
111 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), 111 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(),
112 task_runner_, 112 task_runner_,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 video_frame_, capture_time, frame_encoded_callback)); 182 video_frame_, capture_time, frame_encoded_callback));
183 task_runner_->RunTasks(); 183 task_runner_->RunTasks();
184 184
185 // We need to run the task to cleanup the GPU instance. 185 // We need to run the task to cleanup the GPU instance.
186 video_encoder_.reset(NULL); 186 video_encoder_.reset(NULL);
187 task_runner_->RunTasks(); 187 task_runner_->RunTasks();
188 } 188 }
189 189
190 } // namespace cast 190 } // namespace cast
191 } // namespace media 191 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/external_video_encoder.cc ('k') | media/cast/sender/fake_software_video_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698