Index: webkit/media/filter_helpers.cc |
diff --git a/webkit/media/filter_helpers.cc b/webkit/media/filter_helpers.cc |
index 791aea76b5d534c8fcc9667a28b79c28c0df47ff..d49f7769cf0cbbe6f3ae7efd17a077802a5e16e2 100644 |
--- a/webkit/media/filter_helpers.cc |
+++ b/webkit/media/filter_helpers.cc |
@@ -7,6 +7,7 @@ |
#include "base/bind.h" |
#include "media/base/filter_collection.h" |
#include "media/base/message_loop_factory.h" |
+#include "media/filters/decrypting_video_decoder.h" |
#include "media/filters/chunk_demuxer.h" |
#include "media/filters/dummy_demuxer.h" |
#include "media/filters/ffmpeg_audio_decoder.h" |
@@ -18,6 +19,12 @@ |
namespace webkit_media { |
// Constructs and adds the default audio/video decoders to |filter_collection|. |
+// Note that decoders in the |filter_collection| are ordered. The first |
+// audio/video decoder in the |filter_collection| that supports the input |
+// audio/video stream will be selected as the audio/video decoder in the media |
+// pipeline. This is done by trying to initialize the decoder with the input |
+// stream. Some decoder may only accept certain types of streams. For example, |
+// DecryptingVideoDecoder only supports encrypted video stream. |
static void AddDefaultDecodersToCollection( |
media::MessageLoopFactory* message_loop_factory, |
media::FilterCollection* filter_collection, |
@@ -27,12 +34,21 @@ static void AddDefaultDecodersToCollection( |
base::Unretained(message_loop_factory), |
media::MessageLoopFactory::kDecoder))); |
+ scoped_refptr<media::DecryptingVideoDecoder> decrypting_video_decoder = |
+ new media::DecryptingVideoDecoder( |
+ base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
+ base::Unretained(message_loop_factory), |
+ media::MessageLoopFactory::kDecoder), |
+ decryptor); |
+ |
scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
new media::FFmpegVideoDecoder( |
base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
base::Unretained(message_loop_factory), |
media::MessageLoopFactory::kDecoder), |
decryptor); |
+ |
+ filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); |
filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
} |