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

Side by Side Diff: media/tools/player_wtl/movie.cc

Issue 9632024: Create video and audio decoder threads on demand. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Log an error when Initialize is called more than once. Created 8 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 | Annotate | Revision Log
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/tools/player_wtl/movie.h" 5 #include "media/tools/player_wtl/movie.h"
6 6
7 #include "base/bind.h"
7 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
8 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 #include "media/audio/audio_manager.h" 11 #include "media/audio/audio_manager.h"
11 #include "media/base/filter_collection.h" 12 #include "media/base/filter_collection.h"
12 #include "media/base/media_log.h" 13 #include "media/base/media_log.h"
13 #include "media/base/message_loop_factory.h" 14 #include "media/base/message_loop_factory.h"
14 #include "media/base/pipeline.h" 15 #include "media/base/pipeline.h"
15 #include "media/filters/ffmpeg_audio_decoder.h" 16 #include "media/filters/ffmpeg_audio_decoder.h"
16 #include "media/filters/ffmpeg_demuxer_factory.h" 17 #include "media/filters/ffmpeg_demuxer_factory.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 scoped_refptr<FileDataSource> data_source = new FileDataSource(); 74 scoped_refptr<FileDataSource> data_source = new FileDataSource();
74 if (data_source->Initialize(url_utf8) != PIPELINE_OK) { 75 if (data_source->Initialize(url_utf8) != PIPELINE_OK) {
75 return false; 76 return false;
76 } 77 }
77 78
78 // Create filter collection. 79 // Create filter collection.
79 scoped_ptr<FilterCollection> collection(new FilterCollection()); 80 scoped_ptr<FilterCollection> collection(new FilterCollection());
80 collection->SetDemuxerFactory(scoped_ptr<DemuxerFactory>( 81 collection->SetDemuxerFactory(scoped_ptr<DemuxerFactory>(
81 new FFmpegDemuxerFactory(data_source, pipeline_loop))); 82 new FFmpegDemuxerFactory(data_source, pipeline_loop)));
82 collection->AddAudioDecoder(new FFmpegAudioDecoder( 83 collection->AddAudioDecoder(new FFmpegAudioDecoder(
83 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); 84 base::Bind(&MessageLoopFactory::GetMessageLoop,
85 base::Unretained(message_loop_factory_.get()),
86 "AudioDecoderThread")));
84 collection->AddVideoDecoder(new FFmpegVideoDecoder( 87 collection->AddVideoDecoder(new FFmpegVideoDecoder(
85 message_loop_factory_->GetMessageLoop("VideoDecoderThread"))); 88 base::Bind(&MessageLoopFactory::GetMessageLoop,
89 base::Unretained(message_loop_factory_.get()),
90 "VideoDecoderThread")));
86 91
87 // TODO(vrk): Re-enabled audio. (crbug.com/112159) 92 // TODO(vrk): Re-enabled audio. (crbug.com/112159)
88 collection->AddAudioRenderer(new media::NullAudioRenderer()); 93 collection->AddAudioRenderer(new media::NullAudioRenderer());
89 collection->AddVideoRenderer(video_renderer); 94 collection->AddVideoRenderer(video_renderer);
90 95
91 // Create and start our pipeline. 96 // Create and start our pipeline.
92 media::PipelineStatusNotification note; 97 media::PipelineStatusNotification note;
93 pipeline_->Start( 98 pipeline_->Start(
94 collection.Pass(), 99 collection.Pass(),
95 url_utf8, 100 url_utf8,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void Movie::Close() { 187 void Movie::Close() {
183 if (pipeline_) { 188 if (pipeline_) {
184 pipeline_->Stop(media::PipelineStatusCB()); 189 pipeline_->Stop(media::PipelineStatusCB());
185 pipeline_ = NULL; 190 pipeline_ = NULL;
186 } 191 }
187 192
188 message_loop_factory_.reset(); 193 message_loop_factory_.reset();
189 } 194 }
190 195
191 } // namespace media 196 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698