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

Unified Diff: media/tools/player_x11/player_x11.cc

Issue 14371023: Remove reference counting from media::Pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/pipeline_integration_test_base.h ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/tools/player_x11/player_x11.cc
diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc
index b6ff88e05e8d170ae79fe2dc3187effe83bd9d44..711bf5c498beff3d1fe70e13a66536295bed3927 100644
--- a/media/tools/player_x11/player_x11.cc
+++ b/media/tools/player_x11/player_x11.cc
@@ -108,11 +108,11 @@ static void SaveStatusAndSignal(base::WaitableEvent* event,
}
// TODO(vrk): Re-enabled audio. (crbug.com/112159)
-void InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
+void InitPipeline(media::Pipeline* pipeline,
+ const scoped_refptr<base::MessageLoopProxy>& message_loop,
media::Demuxer* demuxer,
const PaintCB& paint_cb,
bool /* enable_audio */,
- scoped_refptr<media::Pipeline>* pipeline,
base::MessageLoop* paint_message_loop) {
// Create our filter factories.
scoped_ptr<media::FilterCollection> collection(
@@ -139,12 +139,10 @@ void InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
media::SetDecryptorReadyCB()));
collection->SetAudioRenderer(audio_renderer.Pass());
- // Create the pipeline and start it.
base::WaitableEvent event(true, false);
media::PipelineStatus status;
- *pipeline = new media::Pipeline(message_loop, new media::MediaLog());
- (*pipeline)->Start(
+ pipeline->Start(
collection.Pass(), base::Closure(), media::PipelineStatusCB(),
base::Bind(&SaveStatusAndSignal, &event, &status),
base::Bind(&OnBufferingState), base::Closure());
@@ -154,7 +152,7 @@ void InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
CHECK_EQ(status, media::PIPELINE_OK) << "Pipeline initialization failed";
// And start the playback.
- (*pipeline)->SetPlaybackRate(1.0f);
+ pipeline->SetPlaybackRate(1.0f);
}
void TerminateHandler(int signal) {
@@ -219,7 +217,7 @@ void PeriodicalUpdate(
message_loop->PostDelayedTask(
FROM_HERE,
base::Bind(&PeriodicalUpdate,
- make_scoped_refptr(pipeline),
+ base::Unretained(pipeline),
message_loop,
audio_only),
base::TimeDelta::FromMilliseconds(10));
@@ -269,7 +267,6 @@ int main(int argc, char** argv) {
base::MessageLoop message_loop;
base::Thread media_thread("MediaThread");
media_thread.Start();
- scoped_refptr<media::Pipeline> pipeline;
PaintCB paint_cb;
if (command_line->HasSwitch("use-gl")) {
@@ -286,15 +283,17 @@ int main(int argc, char** argv) {
media_thread.message_loop_proxy(), data_source.get(),
base::Bind(&NeedKey)));
- InitPipeline(media_thread.message_loop_proxy(), demuxer.get(),
- paint_cb, command_line->HasSwitch("audio"), &pipeline,
- &message_loop);
+ media::Pipeline pipeline(media_thread.message_loop_proxy(),
+ new media::MediaLog());
+ InitPipeline(&pipeline, media_thread.message_loop_proxy(), demuxer.get(),
+ paint_cb, command_line->HasSwitch("audio"), &message_loop);
// Main loop of the application.
g_running = true;
message_loop.PostTask(FROM_HERE, base::Bind(
- &PeriodicalUpdate, pipeline, &message_loop, !pipeline->HasVideo()));
+ &PeriodicalUpdate, base::Unretained(&pipeline), &message_loop,
+ !pipeline.HasVideo()));
message_loop.Run();
// Cleanup tasks.
« no previous file with comments | « media/filters/pipeline_integration_test_base.h ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698