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

Side by Side Diff: media/test/pipeline_integration_test_base.cc

Issue 2710133003: Replace FFmpegDemuxer thread per element with base::TaskScheduler. (Closed)
Patch Set: Give WeakPtr to URLProtocol. Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/test/pipeline_integration_test_base.h" 5 #include "media/test/pipeline_integration_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED), 53 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED),
54 current_duration_(kInfiniteDuration) { 54 current_duration_(kInfiniteDuration) {
55 ResetVideoHash(); 55 ResetVideoHash();
56 EXPECT_CALL(*this, OnVideoAverageKeyframeDistanceUpdate()).Times(AnyNumber()); 56 EXPECT_CALL(*this, OnVideoAverageKeyframeDistanceUpdate()).Times(AnyNumber());
57 } 57 }
58 58
59 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { 59 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() {
60 if (pipeline_->IsRunning()) 60 if (pipeline_->IsRunning())
61 Stop(); 61 Stop();
62 62
63 demuxer_.reset();
63 pipeline_.reset(); 64 pipeline_.reset();
64 base::RunLoop().RunUntilIdle(); 65 base::RunLoop().RunUntilIdle();
65 } 66 }
66 67
67 // TODO(xhwang): Method definitions in this file needs to be reordered. 68 // TODO(xhwang): Method definitions in this file needs to be reordered.
68 69
69 void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time, 70 void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time,
70 PipelineStatus status) { 71 PipelineStatus status) {
71 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); 72 EXPECT_EQ(seek_time, pipeline_->GetMediaTime());
72 pipeline_status_ = status; 73 pipeline_status_ = status;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 base::TimeDelta::FromMilliseconds(10)); 305 base::TimeDelta::FromMilliseconds(10));
305 base::RunLoop().Run(); 306 base::RunLoop().Run();
306 return (pipeline_status_ == PIPELINE_OK); 307 return (pipeline_status_ == PIPELINE_OK);
307 } 308 }
308 309
309 void PipelineIntegrationTestBase::CreateDemuxer( 310 void PipelineIntegrationTestBase::CreateDemuxer(
310 std::unique_ptr<DataSource> data_source) { 311 std::unique_ptr<DataSource> data_source) {
311 data_source_ = std::move(data_source); 312 data_source_ = std::move(data_source);
312 313
313 #if !defined(MEDIA_DISABLE_FFMPEG) 314 #if !defined(MEDIA_DISABLE_FFMPEG)
315 task_scheduler_.reset(new base::test::ScopedTaskScheduler(&message_loop_));
314 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( 316 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer(
315 message_loop_.task_runner(), data_source_.get(), 317 message_loop_.task_runner(), data_source_.get(),
316 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, 318 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB,
317 base::Unretained(this)), 319 base::Unretained(this)),
318 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, 320 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB,
319 base::Unretained(this)), 321 base::Unretained(this)),
320 new MediaLog())); 322 new MediaLog()));
321 #endif 323 #endif
322 } 324 }
323 325
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 DCHECK(clockless_playback_); 445 DCHECK(clockless_playback_);
444 return clockless_audio_sink_->render_time(); 446 return clockless_audio_sink_->render_time();
445 } 447 }
446 448
447 base::TimeTicks DummyTickClock::NowTicks() { 449 base::TimeTicks DummyTickClock::NowTicks() {
448 now_ += base::TimeDelta::FromSeconds(60); 450 now_ += base::TimeDelta::FromSeconds(60);
449 return now_; 451 return now_;
450 } 452 }
451 453
452 } // namespace media 454 } // namespace media
OLDNEW
« media/filters/ffmpeg_demuxer.cc ('K') | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698