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.h" | 10 #include "media/filters/chunk_demuxer.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 26 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
27 base::Unretained(message_loop_factory), | 27 base::Unretained(message_loop_factory), |
28 "AudioDecoderThread"))); | 28 "AudioDecoderThread"))); |
29 | 29 |
30 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = | 30 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
31 new media::FFmpegVideoDecoder( | 31 new media::FFmpegVideoDecoder( |
32 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 32 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
33 base::Unretained(message_loop_factory), | 33 base::Unretained(message_loop_factory), |
34 "VideoDecoderThread"), | 34 "VideoDecoderThread"), |
35 decryptor); | 35 decryptor); |
36 filter_collection->AddVideoDecoder(ffmpeg_video_decoder); | 36 filter_collection->GetVideoDecoders().push_back(ffmpeg_video_decoder); |
37 } | 37 } |
38 | 38 |
39 bool BuildMediaStreamCollection(const WebKit::WebURL& url, | 39 bool BuildMediaStreamCollection(const WebKit::WebURL& url, |
40 MediaStreamClient* client, | 40 MediaStreamClient* client, |
41 media::MessageLoopFactory* message_loop_factory, | 41 media::MessageLoopFactory* message_loop_factory, |
42 media::FilterCollection* filter_collection) { | 42 media::FilterCollection* filter_collection) { |
43 if (!client) | 43 if (!client) |
44 return false; | 44 return false; |
45 | 45 |
46 scoped_refptr<media::VideoDecoder> video_decoder = client->GetVideoDecoder( | 46 scoped_refptr<media::VideoDecoder> video_decoder = client->GetVideoDecoder( |
47 url, message_loop_factory); | 47 url, message_loop_factory); |
48 if (!video_decoder) | 48 if (!video_decoder) |
49 return false; | 49 return false; |
50 | 50 |
51 // Remove any "traditional" decoders (e.g. GpuVideoDecoder) from the | 51 // Remove all other decoders and just use the MediaStream one. |
52 // collection. | 52 filter_collection->GetVideoDecoders().clear(); |
53 // NOTE: http://crbug.com/110800 is about replacing this ad-hockery with | 53 filter_collection->GetVideoDecoders().push_back(video_decoder); |
Ami GONE FROM CHROMIUM
2012/08/09 20:30:18
This comment should live on.
acolwell GONE FROM CHROMIUM
2012/08/09 22:23:32
Done.
| |
54 // something more designed. | |
55 scoped_refptr<media::VideoDecoder> old_videodecoder; | |
56 do { | |
57 filter_collection->SelectVideoDecoder(&old_videodecoder); | |
58 } while (old_videodecoder); | |
59 | |
60 filter_collection->AddVideoDecoder(video_decoder); | |
61 | 54 |
62 filter_collection->SetDemuxer(new media::DummyDemuxer(true, false)); | 55 filter_collection->SetDemuxer(new media::DummyDemuxer(true, false)); |
63 | 56 |
64 return true; | 57 return true; |
65 } | 58 } |
66 | 59 |
67 bool BuildMediaSourceCollection( | 60 bool BuildMediaSourceCollection( |
68 const WebKit::WebURL& url, | 61 const WebKit::WebURL& url, |
69 const WebKit::WebURL& media_source_url, | 62 const WebKit::WebURL& media_source_url, |
70 media::ChunkDemuxerClient* client, | 63 media::ChunkDemuxerClient* client, |
(...skipping 17 matching lines...) Expand all Loading... | |
88 media::Decryptor* decryptor) { | 81 media::Decryptor* decryptor) { |
89 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 82 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
90 message_loop_factory->GetMessageLoop("PipelineThread"), | 83 message_loop_factory->GetMessageLoop("PipelineThread"), |
91 data_source)); | 84 data_source)); |
92 | 85 |
93 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, | 86 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, |
94 decryptor); | 87 decryptor); |
95 } | 88 } |
96 | 89 |
97 } // webkit_media | 90 } // webkit_media |
OLD | NEW |