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/sender/external_video_encoder_unittest.cc

Issue 439863003: Cast: Use fixed bitrate and set it once for hardware encoder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cooments Created 6 years, 4 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 | « no previous file | media/cast/sender/video_sender.h » ('j') | media/cast/sender/video_sender.cc » ('J')
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_,
113 task_runner_, 113 task_runner_,
114 task_runner_); 114 task_runner_);
115 115
116 fake_vea_ = new test::FakeVideoEncodeAccelerator(task_runner_); 116 fake_vea_ = new test::FakeVideoEncodeAccelerator(task_runner_,
117 &stored_bitrates_);
117 scoped_ptr<VideoEncodeAccelerator> fake_vea(fake_vea_); 118 scoped_ptr<VideoEncodeAccelerator> fake_vea(fake_vea_);
118 video_encoder_.reset( 119 video_encoder_.reset(
119 new ExternalVideoEncoder(cast_environment_, 120 new ExternalVideoEncoder(cast_environment_,
120 video_config_, 121 video_config_,
121 base::Bind(&CreateVideoEncodeAccelerator, 122 base::Bind(&CreateVideoEncodeAccelerator,
122 task_runner_, 123 task_runner_,
123 base::Passed(&fake_vea)), 124 base::Passed(&fake_vea)),
124 base::Bind(&CreateSharedMemory))); 125 base::Bind(&CreateSharedMemory)));
125 } 126 }
126 127
127 virtual ~ExternalVideoEncoderTest() {} 128 virtual ~ExternalVideoEncoderTest() {}
128 129
129 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. 130 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
130 test::FakeVideoEncodeAccelerator* fake_vea_; // Owned by video_encoder_. 131 test::FakeVideoEncodeAccelerator* fake_vea_; // Owned by video_encoder_.
132 std::vector<uint32> stored_bitrates_;
miu 2014/08/05 21:52:07 This should be checked in one or more unit tests (
Alpha Left Google 2014/08/06 01:24:54 Done.
131 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_; 133 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_;
132 VideoSenderConfig video_config_; 134 VideoSenderConfig video_config_;
133 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 135 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
134 scoped_ptr<VideoEncoder> video_encoder_; 136 scoped_ptr<VideoEncoder> video_encoder_;
135 scoped_refptr<media::VideoFrame> video_frame_; 137 scoped_refptr<media::VideoFrame> video_frame_;
136 scoped_refptr<CastEnvironment> cast_environment_; 138 scoped_refptr<CastEnvironment> cast_environment_;
137 139
138 DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoderTest); 140 DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoderTest);
139 }; 141 };
140 142
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 video_frame_, capture_time, frame_encoded_callback)); 184 video_frame_, capture_time, frame_encoded_callback));
183 task_runner_->RunTasks(); 185 task_runner_->RunTasks();
184 186
185 // We need to run the task to cleanup the GPU instance. 187 // We need to run the task to cleanup the GPU instance.
186 video_encoder_.reset(NULL); 188 video_encoder_.reset(NULL);
187 task_runner_->RunTasks(); 189 task_runner_->RunTasks();
188 } 190 }
189 191
190 } // namespace cast 192 } // namespace cast
191 } // namespace media 193 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/cast/sender/video_sender.h » ('j') | media/cast/sender/video_sender.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698