OLD | NEW |
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 <queue> | 5 #include <queue> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/test/launcher/unit_test_launcher.h" | 10 #include "base/test/launcher/unit_test_launcher.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 clock_ = new base::SimpleTestTickClock(); | 201 clock_ = new base::SimpleTestTickClock(); |
202 clock_->Advance(base::TimeTicks::Now() - base::TimeTicks()); | 202 clock_->Advance(base::TimeTicks::Now() - base::TimeTicks()); |
203 | 203 |
204 cast_environment_ = new CastEnvironment( | 204 cast_environment_ = new CastEnvironment( |
205 scoped_ptr<base::TickClock>(clock_).Pass(), | 205 scoped_ptr<base::TickClock>(clock_).Pass(), |
206 message_loop_.message_loop_proxy(), message_loop_.message_loop_proxy(), | 206 message_loop_.message_loop_proxy(), message_loop_.message_loop_proxy(), |
207 message_loop_.message_loop_proxy()); | 207 message_loop_.message_loop_proxy()); |
208 encoder_.reset(new H264VideoToolboxEncoder( | 208 encoder_.reset(new H264VideoToolboxEncoder( |
209 cast_environment_, | 209 cast_environment_, |
210 video_sender_config_, | 210 video_sender_config_, |
211 gfx::Size(kVideoWidth, kVideoHeight), | |
212 0u, | |
213 base::Bind(&SaveOperationalStatus, &operational_status_))); | 211 base::Bind(&SaveOperationalStatus, &operational_status_))); |
214 message_loop_.RunUntilIdle(); | 212 message_loop_.RunUntilIdle(); |
215 EXPECT_EQ(STATUS_INITIALIZED, operational_status_); | 213 EXPECT_EQ(STATUS_INITIALIZED, operational_status_); |
216 } | 214 } |
217 | 215 |
218 void TearDown() override { | 216 void TearDown() override { |
219 encoder_.reset(); | 217 encoder_.reset(); |
220 message_loop_.RunUntilIdle(); | 218 message_loop_.RunUntilIdle(); |
221 } | 219 } |
222 | 220 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 encoder_.reset(); | 297 encoder_.reset(); |
300 message_loop_.RunUntilIdle(); | 298 message_loop_.RunUntilIdle(); |
301 | 299 |
302 EXPECT_EQ(5, checker->count_frames_checked()); | 300 EXPECT_EQ(5, checker->count_frames_checked()); |
303 } | 301 } |
304 #endif | 302 #endif |
305 | 303 |
306 TEST_F(H264VideoToolboxEncoderTest, CheckVideoFrameFactory) { | 304 TEST_F(H264VideoToolboxEncoderTest, CheckVideoFrameFactory) { |
307 auto video_frame_factory = encoder_->CreateVideoFrameFactory(); | 305 auto video_frame_factory = encoder_->CreateVideoFrameFactory(); |
308 ASSERT_TRUE(video_frame_factory.get()); | 306 ASSERT_TRUE(video_frame_factory.get()); |
309 CreateFrameAndMemsetPlane(video_frame_factory.get()); | 307 // The first call to |MaybeCreateFrame| will return null but post a task to |
310 // TODO(jfroy): Need to test that the encoder can encode VideoFrames provided | 308 // the encoder to initialize for the specified frame size. We then drain the |
311 // by the VideoFrameFactory. | 309 // message loop. After that, the encoder should have initialized and we |
312 encoder_.reset(); | 310 // request a frame again. |
| 311 ASSERT_FALSE(video_frame_factory->MaybeCreateFrame( |
| 312 gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta())); |
313 message_loop_.RunUntilIdle(); | 313 message_loop_.RunUntilIdle(); |
314 CreateFrameAndMemsetPlane(video_frame_factory.get()); | 314 CreateFrameAndMemsetPlane(video_frame_factory.get()); |
315 } | 315 } |
316 | 316 |
317 } // namespace cast | 317 } // namespace cast |
318 } // namespace media | 318 } // namespace media |
OLD | NEW |