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 "media/base/filter_collection.h" | 8 #include "media/base/filter_collection.h" |
9 #include "media/base/message_loop_factory.h" | 9 #include "media/base/message_loop_factory.h" |
10 #include "media/filters/chunk_demuxer_factory.h" | 10 #include "media/filters/chunk_demuxer.h" |
11 #include "media/filters/dummy_demuxer_factory.h" | 11 #include "media/filters/dummy_demuxer.h" |
12 #include "media/filters/ffmpeg_audio_decoder.h" | 12 #include "media/filters/ffmpeg_audio_decoder.h" |
13 #include "media/filters/ffmpeg_demuxer_factory.h" | 13 #include "media/filters/ffmpeg_demuxer.h" |
14 #include "media/filters/ffmpeg_video_decoder.h" | 14 #include "media/filters/ffmpeg_video_decoder.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
16 #include "webkit/media/media_stream_client.h" | 16 #include "webkit/media/media_stream_client.h" |
17 | 17 |
18 namespace webkit_media { | 18 namespace webkit_media { |
19 | 19 |
20 // Constructs and adds the default audio/video decoders to |filter_collection|. | 20 // Constructs and adds the default audio/video decoders to |filter_collection|. |
21 static void AddDefaultDecodersToCollection( | 21 static void AddDefaultDecodersToCollection( |
22 media::MessageLoopFactory* message_loop_factory, | 22 media::MessageLoopFactory* message_loop_factory, |
23 media::FilterCollection* filter_collection) { | 23 media::FilterCollection* filter_collection) { |
(...skipping 27 matching lines...) Expand all Loading... |
51 do { | 51 do { |
52 filter_collection->SelectVideoDecoder(&old_videodecoder); | 52 filter_collection->SelectVideoDecoder(&old_videodecoder); |
53 } while (old_videodecoder); | 53 } while (old_videodecoder); |
54 | 54 |
55 filter_collection->AddVideoDecoder(video_decoder); | 55 filter_collection->AddVideoDecoder(video_decoder); |
56 | 56 |
57 // TODO(vrk/wjia): Setting true for local_source is under the assumption | 57 // TODO(vrk/wjia): Setting true for local_source is under the assumption |
58 // that the MediaStream represents a local webcam. This will need to | 58 // that the MediaStream represents a local webcam. This will need to |
59 // change in the future when GetVideoDecoder is no longer hardcoded to | 59 // change in the future when GetVideoDecoder is no longer hardcoded to |
60 // only return CaptureVideoDecoders. | 60 // only return CaptureVideoDecoders. |
61 scoped_ptr<media::DemuxerFactory> demuxer_factory( | 61 // |
62 new media::DummyDemuxerFactory(true, false, true)); | 62 // See http://crbug.com/120426 for details. |
63 filter_collection->SetDemuxerFactory(demuxer_factory.Pass()); | 63 filter_collection->SetDemuxer(new media::DummyDemuxer(true, false, true)); |
64 | 64 |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 bool BuildMediaSourceCollection(const WebKit::WebURL& url, | 68 bool BuildMediaSourceCollection(const WebKit::WebURL& url, |
69 const WebKit::WebURL& media_source_url, | 69 const WebKit::WebURL& media_source_url, |
70 media::ChunkDemuxerClient* client, | 70 media::ChunkDemuxerClient* client, |
71 media::MessageLoopFactory* message_loop_factory, | 71 media::MessageLoopFactory* message_loop_factory, |
72 media::FilterCollection* filter_collection) { | 72 media::FilterCollection* filter_collection) { |
73 if (media_source_url.isEmpty() || url != media_source_url) | 73 if (media_source_url.isEmpty() || url != media_source_url) |
74 return false; | 74 return false; |
75 | 75 |
76 scoped_ptr<media::DemuxerFactory> demuxer_factory( | 76 filter_collection->SetDemuxer(new media::ChunkDemuxer(client)); |
77 new media::ChunkDemuxerFactory(client)); | |
78 filter_collection->SetDemuxerFactory(demuxer_factory.Pass()); | |
79 | 77 |
80 AddDefaultDecodersToCollection(message_loop_factory, filter_collection); | 78 AddDefaultDecodersToCollection(message_loop_factory, filter_collection); |
81 return true; | 79 return true; |
82 } | 80 } |
83 | 81 |
84 void BuildDefaultCollection(const scoped_refptr<media::DataSource>& data_source, | 82 void BuildDefaultCollection(const scoped_refptr<media::DataSource>& data_source, |
| 83 bool local_source, |
85 media::MessageLoopFactory* message_loop_factory, | 84 media::MessageLoopFactory* message_loop_factory, |
86 media::FilterCollection* filter_collection) { | 85 media::FilterCollection* filter_collection) { |
87 scoped_ptr<media::DemuxerFactory> demuxer_factory( | 86 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
88 new media::FFmpegDemuxerFactory( | 87 message_loop_factory->GetMessageLoop("PipelineThread"), |
89 data_source, message_loop_factory->GetMessageLoop("PipelineThread"))); | 88 data_source, |
90 filter_collection->SetDemuxerFactory(demuxer_factory.Pass()); | 89 local_source)); |
91 | 90 |
92 AddDefaultDecodersToCollection(message_loop_factory, filter_collection); | 91 AddDefaultDecodersToCollection(message_loop_factory, filter_collection); |
93 } | 92 } |
94 | 93 |
95 } // webkit_media | 94 } // webkit_media |
OLD | NEW |