Chromium Code Reviews| 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 "chromecast/media/cma/test/frame_segmenter_for_test.h" | 5 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" | |
| 12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/test/scoped_task_scheduler.h" | |
| 13 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" | 16 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" |
| 15 #include "media/base/decoder_buffer.h" | 17 #include "media/base/decoder_buffer.h" |
| 16 #include "media/base/demuxer.h" | 18 #include "media/base/demuxer.h" |
| 17 #include "media/base/media_log.h" | 19 #include "media/base/media_log.h" |
| 18 #include "media/base/media_tracks.h" | 20 #include "media/base/media_tracks.h" |
| 19 #include "media/base/test_helpers.h" | 21 #include "media/base/test_helpers.h" |
| 20 #include "media/filters/ffmpeg_demuxer.h" | 22 #include "media/filters/ffmpeg_demuxer.h" |
| 21 #include "media/filters/file_data_source.h" | 23 #include "media/filters/file_data_source.h" |
| 22 #include "media/filters/h264_parser.h" | 24 #include "media/filters/h264_parser.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 | 308 |
| 307 DemuxResult::~DemuxResult() { | 309 DemuxResult::~DemuxResult() { |
| 308 } | 310 } |
| 309 | 311 |
| 310 DemuxResult FFmpegDemuxForTest(const base::FilePath& filepath, | 312 DemuxResult FFmpegDemuxForTest(const base::FilePath& filepath, |
| 311 bool audio) { | 313 bool audio) { |
| 312 FakeDemuxerHost fake_demuxer_host; | 314 FakeDemuxerHost fake_demuxer_host; |
| 313 ::media::FileDataSource data_source; | 315 ::media::FileDataSource data_source; |
| 314 CHECK(data_source.Initialize(filepath)); | 316 CHECK(data_source.Initialize(filepath)); |
| 315 | 317 |
| 318 base::test::ScopedTaskScheduler task_scheduler(base::MessageLoop::current()); | |
|
gab
2017/02/26 18:01:35
There should really just be one ScopedTaskSchedule
DaleCurtis
2017/02/27 21:26:30
Done, but took a few more changes.
| |
| 316 ::media::FFmpegDemuxer demuxer( | 319 ::media::FFmpegDemuxer demuxer( |
| 317 base::ThreadTaskRunnerHandle::Get(), &data_source, | 320 base::ThreadTaskRunnerHandle::Get(), &data_source, |
| 318 base::Bind(&OnEncryptedMediaInitData), base::Bind(&OnMediaTracksUpdated), | 321 base::Bind(&OnEncryptedMediaInitData), base::Bind(&OnMediaTracksUpdated), |
| 319 new ::media::MediaLog()); | 322 new ::media::MediaLog()); |
| 320 ::media::WaitableMessageLoopEvent init_event; | 323 ::media::WaitableMessageLoopEvent init_event; |
| 321 demuxer.Initialize(&fake_demuxer_host, | 324 demuxer.Initialize(&fake_demuxer_host, |
| 322 init_event.GetPipelineStatusCB(), | 325 init_event.GetPipelineStatusCB(), |
| 323 false); | 326 false); |
| 324 init_event.RunAndWaitForStatus(::media::PIPELINE_OK); | 327 init_event.RunAndWaitForStatus(::media::PIPELINE_OK); |
| 325 | 328 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 345 CHECK(!demux_result.frames.empty()); | 348 CHECK(!demux_result.frames.empty()); |
| 346 end_of_stream = demux_result.frames.back()->end_of_stream(); | 349 end_of_stream = demux_result.frames.back()->end_of_stream(); |
| 347 } | 350 } |
| 348 | 351 |
| 349 demuxer.Stop(); | 352 demuxer.Stop(); |
| 350 return demux_result; | 353 return demux_result; |
| 351 } | 354 } |
| 352 | 355 |
| 353 } // namespace media | 356 } // namespace media |
| 354 } // namespace chromecast | 357 } // namespace chromecast |
| OLD | NEW |