Chromium Code Reviews| 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 all other decoders and just use the MediaStream one. | |
| 51 // Remove any "traditional" decoders (e.g. GpuVideoDecoder) from the | 52 // Remove any "traditional" decoders (e.g. GpuVideoDecoder) from the |
|
scherkus (not reviewing)
2012/08/14 22:00:24
is this comment duplicated?
acolwell GONE FROM CHROMIUM
2012/08/15 21:36:57
Done.
| |
| 52 // collection. | 53 // collection. |
| 53 // NOTE: http://crbug.com/110800 is about replacing this ad-hockery with | 54 // NOTE: http://crbug.com/110800 is about replacing this ad-hockery with |
| 54 // something more designed. | 55 // something more designed. |
| 55 scoped_refptr<media::VideoDecoder> old_videodecoder; | 56 filter_collection->GetVideoDecoders()->clear(); |
| 56 do { | 57 filter_collection->GetVideoDecoders()->push_back(video_decoder); |
| 57 filter_collection->SelectVideoDecoder(&old_videodecoder); | |
| 58 } while (old_videodecoder); | |
| 59 | |
| 60 filter_collection->AddVideoDecoder(video_decoder); | |
| 61 | 58 |
| 62 filter_collection->SetDemuxer(new media::DummyDemuxer(true, false)); | 59 filter_collection->SetDemuxer(new media::DummyDemuxer(true, false)); |
| 63 | 60 |
| 64 return true; | 61 return true; |
| 65 } | 62 } |
| 66 | 63 |
| 67 bool BuildMediaSourceCollection( | 64 bool BuildMediaSourceCollection( |
| 68 const WebKit::WebURL& url, | 65 const WebKit::WebURL& url, |
| 69 const WebKit::WebURL& media_source_url, | 66 const WebKit::WebURL& media_source_url, |
| 70 media::ChunkDemuxerClient* client, | 67 media::ChunkDemuxerClient* client, |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 88 media::Decryptor* decryptor) { | 85 media::Decryptor* decryptor) { |
| 89 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 86 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
| 90 message_loop_factory->GetMessageLoop("PipelineThread"), | 87 message_loop_factory->GetMessageLoop("PipelineThread"), |
| 91 data_source)); | 88 data_source)); |
| 92 | 89 |
| 93 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, | 90 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, |
| 94 decryptor); | 91 decryptor); |
| 95 } | 92 } |
| 96 | 93 |
| 97 } // webkit_media | 94 } // webkit_media |
| OLD | NEW |