OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
9 #include "media/base/android/media_codec_audio_decoder.h" | 9 #include "media/base/android/media_codec_audio_decoder.h" |
10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecAudioDecoder( | 272 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecAudioDecoder( |
273 task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested, | 273 task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested, |
274 base::Unretained(this)), | 274 base::Unretained(this)), |
275 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)), | 275 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)), |
276 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained, | 276 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained, |
277 base::Unretained(this)), | 277 base::Unretained(this)), |
278 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)), | 278 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)), |
279 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)), | 279 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)), |
280 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)), | 280 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)), |
281 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime, | 281 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime, |
282 base::Unretained(this)))); | 282 base::Unretained(this)), |
| 283 nullptr)); |
283 | 284 |
284 data_available_cb_ = base::Bind(&MediaCodecDecoder::OnDemuxerDataAvailable, | 285 data_available_cb_ = base::Bind(&MediaCodecDecoder::OnDemuxerDataAvailable, |
285 base::Unretained(decoder_.get())); | 286 base::Unretained(decoder_.get())); |
286 } | 287 } |
287 | 288 |
288 void MediaCodecDecoderTest::CreateVideoDecoder() { | 289 void MediaCodecDecoderTest::CreateVideoDecoder() { |
289 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecVideoDecoder( | 290 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecVideoDecoder( |
290 task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested, | 291 task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested, |
291 base::Unretained(this)), | 292 base::Unretained(this)), |
292 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)), | 293 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)), |
293 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained, | 294 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained, |
294 base::Unretained(this)), | 295 base::Unretained(this)), |
295 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)), | 296 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)), |
296 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)), | 297 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)), |
297 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)), | 298 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)), |
298 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime, | 299 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime, |
299 base::Unretained(this)), | 300 base::Unretained(this)), |
300 base::Bind(&MediaCodecDecoderTest::OnVideoSizeChanged, | 301 base::Bind(&MediaCodecDecoderTest::OnVideoSizeChanged, |
301 base::Unretained(this)), | 302 base::Unretained(this)), |
302 base::Bind(&MediaCodecDecoderTest::OnVideoCodecCreated, | 303 base::Bind(&MediaCodecDecoderTest::OnVideoCodecCreated, |
303 base::Unretained(this)))); | 304 base::Unretained(this)), |
| 305 nullptr)); |
304 | 306 |
305 data_available_cb_ = base::Bind(&MediaCodecDecoder::OnDemuxerDataAvailable, | 307 data_available_cb_ = base::Bind(&MediaCodecDecoder::OnDemuxerDataAvailable, |
306 base::Unretained(decoder_.get())); | 308 base::Unretained(decoder_.get())); |
307 } | 309 } |
308 | 310 |
309 void MediaCodecDecoderTest::OnDataRequested() { | 311 void MediaCodecDecoderTest::OnDataRequested() { |
310 if (!data_factory_) | 312 if (!data_factory_) |
311 return; | 313 return; |
312 | 314 |
313 DemuxerData data; | 315 DemuxerData data; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 757 |
756 EXPECT_TRUE(decoder_->IsStopped()); | 758 EXPECT_TRUE(decoder_->IsStopped()); |
757 EXPECT_TRUE(decoder_->IsCompleted()); | 759 EXPECT_TRUE(decoder_->IsCompleted()); |
758 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max()); | 760 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max()); |
759 | 761 |
760 // Check that the reported video size is the one from the in-stream configs. | 762 // Check that the reported video size is the one from the in-stream configs. |
761 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_); | 763 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_); |
762 } | 764 } |
763 | 765 |
764 } // namespace media | 766 } // namespace media |
OLD | NEW |