From e24c547f7062bbef2d66548c30103ee9d48c1abf Mon Sep 17 00:00:00 2001 From: "tommi@chromium.org" Date: Sun, 11 Mar 2012 20:02:13 +0000 Subject: Create video and audio decoder threads on demand. Instead of creating these worker threads when the decoder objects are instantiated, we now do it when Initialize is called. Doing this avoids spinning a video decoder thread for an audio tag. BUG=114699,116873 TEST=Thread count in the renderer process goes up by 3 and not 4 when an audio element is created. Review URL: https://chromiumcodereview.appspot.com/9632024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126077 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/media/filter_helpers.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'webkit/media') diff --git a/webkit/media/filter_helpers.cc b/webkit/media/filter_helpers.cc index 3c376f9..c6f5b2e 100644 --- a/webkit/media/filter_helpers.cc +++ b/webkit/media/filter_helpers.cc @@ -4,6 +4,7 @@ #include "webkit/media/filter_helpers.h" +#include "base/bind.h" #include "media/base/filter_collection.h" #include "media/base/message_loop_factory.h" #include "media/filters/chunk_demuxer_factory.h" @@ -21,9 +22,13 @@ static void AddDefaultDecodersToCollection( media::MessageLoopFactory* message_loop_factory, media::FilterCollection* filter_collection) { filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( - message_loop_factory->GetMessageLoop("AudioDecoderThread"))); + base::Bind(&media::MessageLoopFactory::GetMessageLoop, + base::Unretained(message_loop_factory), + "AudioDecoderThread"))); filter_collection->AddVideoDecoder(new media::FFmpegVideoDecoder( - message_loop_factory->GetMessageLoop("VideoDecoderThread"))); + base::Bind(&media::MessageLoopFactory::GetMessageLoop, + base::Unretained(message_loop_factory), + "VideoDecoderThread"))); } bool BuildMediaStreamCollection(const WebKit::WebURL& url, -- cgit v1.1