OLD | NEW |
---|---|
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 "webkit/media/filter_helpers.h" | 5 #include "webkit/media/filter_helpers.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | |
8 #include "media/base/filter_collection.h" | 9 #include "media/base/filter_collection.h" |
10 #include "media/base/media_switches.h" | |
9 #include "media/filters/decrypting_audio_decoder.h" | 11 #include "media/filters/decrypting_audio_decoder.h" |
10 #include "media/filters/decrypting_video_decoder.h" | 12 #include "media/filters/decrypting_video_decoder.h" |
11 #include "media/filters/chunk_demuxer.h" | 13 #include "media/filters/chunk_demuxer.h" |
12 #include "media/filters/dummy_demuxer.h" | 14 #include "media/filters/dummy_demuxer.h" |
13 #include "media/filters/ffmpeg_audio_decoder.h" | 15 #include "media/filters/ffmpeg_audio_decoder.h" |
14 #include "media/filters/ffmpeg_demuxer.h" | 16 #include "media/filters/ffmpeg_demuxer.h" |
15 #include "media/filters/ffmpeg_video_decoder.h" | 17 #include "media/filters/ffmpeg_video_decoder.h" |
18 #include "media/filters/opus_audio_decoder.h" | |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
17 #include "webkit/media/crypto/proxy_decryptor.h" | 20 #include "webkit/media/crypto/proxy_decryptor.h" |
18 #include "webkit/media/media_stream_client.h" | 21 #include "webkit/media/media_stream_client.h" |
19 | 22 |
20 namespace webkit_media { | 23 namespace webkit_media { |
21 | 24 |
22 // Constructs and adds the default audio/video decoders to |filter_collection|. | 25 // Constructs and adds the default audio/video decoders to |filter_collection|. |
23 // Note that decoders in the |filter_collection| are ordered. The first | 26 // Note that decoders in the |filter_collection| are ordered. The first |
24 // audio/video decoder in the |filter_collection| that supports the input | 27 // audio/video decoder in the |filter_collection| that supports the input |
25 // audio/video stream will be selected as the audio/video decoder in the media | 28 // audio/video stream will be selected as the audio/video decoder in the media |
26 // pipeline. This is done by trying to initialize the decoder with the input | 29 // pipeline. This is done by trying to initialize the decoder with the input |
27 // stream. Some decoder may only accept certain types of streams. For example, | 30 // stream. Some decoder may only accept certain types of streams. For example, |
28 // DecryptingVideoDecoder only supports encrypted video stream. | 31 // DecryptingVideoDecoder only supports encrypted video stream. |
29 static void AddDefaultDecodersToCollection( | 32 static void AddDefaultDecodersToCollection( |
30 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 33 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
31 media::FilterCollection* filter_collection, | 34 media::FilterCollection* filter_collection, |
32 ProxyDecryptor* proxy_decryptor) { | 35 ProxyDecryptor* proxy_decryptor) { |
36 | |
37 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
38 if (cmd_line->HasSwitch(switches::kEnableVp9OpusPlayback)) { | |
39 scoped_refptr<media::OpusAudioDecoder> opus_audio_decoder = | |
40 new media::OpusAudioDecoder(message_loop); | |
41 filter_collection->GetAudioDecoders()->push_back(opus_audio_decoder); | |
42 } | |
xhwang
2012/12/14 08:41:48
media pipeline tries each audio decoder in the ord
Tom Finegan
2012/12/14 20:21:34
Done.
| |
43 | |
33 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder = | 44 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder = |
34 new media::FFmpegAudioDecoder(message_loop); | 45 new media::FFmpegAudioDecoder(message_loop); |
35 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder); | 46 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder); |
36 | 47 |
37 if (proxy_decryptor) { | 48 if (proxy_decryptor) { |
38 scoped_refptr<media::DecryptingAudioDecoder> decrypting_audio_decoder = | 49 scoped_refptr<media::DecryptingAudioDecoder> decrypting_audio_decoder = |
39 new media::DecryptingAudioDecoder( | 50 new media::DecryptingAudioDecoder( |
40 message_loop, | 51 message_loop, |
41 base::Bind(&ProxyDecryptor::RequestDecryptorNotification, | 52 base::Bind(&ProxyDecryptor::RequestDecryptorNotification, |
42 base::Unretained(proxy_decryptor))); | 53 base::Unretained(proxy_decryptor))); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 media::FilterCollection* filter_collection, | 119 media::FilterCollection* filter_collection, |
109 ProxyDecryptor* proxy_decryptor) { | 120 ProxyDecryptor* proxy_decryptor) { |
110 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 121 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
111 message_loop, data_source)); | 122 message_loop, data_source)); |
112 | 123 |
113 AddDefaultDecodersToCollection(message_loop, filter_collection, | 124 AddDefaultDecodersToCollection(message_loop, filter_collection, |
114 proxy_decryptor); | 125 proxy_decryptor); |
115 } | 126 } |
116 | 127 |
117 } // webkit_media | 128 } // webkit_media |
OLD | NEW |