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 "base/command_line.h" |
9 #include "media/base/filter_collection.h" | 9 #include "media/base/filter_collection.h" |
10 #include "media/base/media_switches.h" | 10 #include "media/base/media_switches.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 new media::FFmpegVideoDecoder(message_loop); | 45 new media::FFmpegVideoDecoder(message_loop); |
46 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); | 46 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
47 | 47 |
48 if (cmd_line->HasSwitch(switches::kEnableVp9Playback)) { | 48 if (cmd_line->HasSwitch(switches::kEnableVp9Playback)) { |
49 scoped_refptr<media::VpxVideoDecoder> vpx_video_decoder = | 49 scoped_refptr<media::VpxVideoDecoder> vpx_video_decoder = |
50 new media::VpxVideoDecoder(message_loop); | 50 new media::VpxVideoDecoder(message_loop); |
51 filter_collection->GetVideoDecoders()->push_back(vpx_video_decoder); | 51 filter_collection->GetVideoDecoders()->push_back(vpx_video_decoder); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 bool BuildMediaStreamCollection( | |
56 const WebKit::WebURL& url, | |
57 MediaStreamClient* client, | |
58 const scoped_refptr<base::MessageLoopProxy>& message_loop, | |
59 media::FilterCollection* filter_collection) { | |
60 if (!client) | |
61 return false; | |
62 | |
63 scoped_refptr<media::VideoDecoder> video_decoder = client->GetVideoDecoder( | |
64 url, message_loop); | |
65 if (!video_decoder) | |
66 return false; | |
67 | |
68 // Remove all other decoders and just use the MediaStream one. | |
69 // NOTE: http://crbug.com/110800 is about replacing this ad-hockery with | |
70 // something more designed. | |
71 filter_collection->GetVideoDecoders()->clear(); | |
72 filter_collection->GetVideoDecoders()->push_back(video_decoder); | |
73 | |
74 filter_collection->SetDemuxer(new media::DummyDemuxer(true, false)); | |
75 | |
76 return true; | |
77 } | |
78 | |
79 void BuildMediaSourceCollection( | 55 void BuildMediaSourceCollection( |
80 const scoped_refptr<media::ChunkDemuxer>& demuxer, | 56 const scoped_refptr<media::ChunkDemuxer>& demuxer, |
81 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 57 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
82 media::FilterCollection* filter_collection) { | 58 media::FilterCollection* filter_collection) { |
83 DCHECK(demuxer); | 59 DCHECK(demuxer); |
84 filter_collection->SetDemuxer(demuxer); | 60 filter_collection->SetDemuxer(demuxer); |
85 | 61 |
86 // Remove GPUVideoDecoder until it supports codec config changes. | 62 // Remove GPUVideoDecoder until it supports codec config changes. |
87 // TODO(acolwell): Remove this once http://crbug.com/151045 is fixed. | 63 // TODO(acolwell): Remove this once http://crbug.com/151045 is fixed. |
88 DCHECK_LE(filter_collection->GetVideoDecoders()->size(), 1u); | 64 DCHECK_LE(filter_collection->GetVideoDecoders()->size(), 1u); |
89 filter_collection->GetVideoDecoders()->clear(); | 65 filter_collection->GetVideoDecoders()->clear(); |
90 | 66 |
91 AddDefaultDecodersToCollection(message_loop, filter_collection); | 67 AddDefaultDecodersToCollection(message_loop, filter_collection); |
92 } | 68 } |
93 | 69 |
94 void BuildDefaultCollection( | 70 void BuildDefaultCollection( |
95 const scoped_refptr<media::DataSource>& data_source, | 71 const scoped_refptr<media::DataSource>& data_source, |
96 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 72 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
97 media::FilterCollection* filter_collection) { | 73 media::FilterCollection* filter_collection) { |
98 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 74 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
99 message_loop, data_source)); | 75 message_loop, data_source)); |
100 | 76 |
101 AddDefaultDecodersToCollection(message_loop, filter_collection); | 77 AddDefaultDecodersToCollection(message_loop, filter_collection); |
102 } | 78 } |
103 | 79 |
104 } // webkit_media | 80 } // webkit_media |
OLD | NEW |