Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: webkit/glue/webmediaplayer_impl.cc

Issue 8395053: Adding flag for turning on the Media Source API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/glue/webmediaplayer_impl.h" 5 #include "webkit/glue/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 new media::CompositeDataSourceFactory()); 185 new media::CompositeDataSourceFactory());
186 186
187 if (use_simple_data_source) { 187 if (use_simple_data_source) {
188 data_source_factory->AddFactory(simple_data_source_factory.release()); 188 data_source_factory->AddFactory(simple_data_source_factory.release());
189 data_source_factory->AddFactory(buffered_data_source_factory.release()); 189 data_source_factory->AddFactory(buffered_data_source_factory.release());
190 } else { 190 } else {
191 data_source_factory->AddFactory(buffered_data_source_factory.release()); 191 data_source_factory->AddFactory(buffered_data_source_factory.release());
192 data_source_factory->AddFactory(simple_data_source_factory.release()); 192 data_source_factory->AddFactory(simple_data_source_factory.release());
193 } 193 }
194 194
195 filter_collection_->SetDemuxerFactory(new media::FFmpegDemuxerFactory( 195 scoped_ptr<media::DemuxerFactory> demuxer_factory(
196 data_source_factory.release(), pipeline_message_loop)); 196 new media::FFmpegDemuxerFactory(data_source_factory.release(),
197 pipeline_message_loop));
198
199 std::string sourceUrl = GetClient()->sourceURL().spec();
scherkus (not reviewing) 2011/10/26 18:15:31 source_url
acolwell GONE FROM CHROMIUM 2011/10/26 18:30:46 Done.
200
201 if (!sourceUrl.empty()) {
202 demuxer_factory.reset(
203 new media::ChunkDemuxerFactory(sourceUrl,
204 demuxer_factory.release(),
205 proxy_));
206 }
207 filter_collection_->SetDemuxerFactory(demuxer_factory.release());
197 208
198 // Add in the default filter factories. 209 // Add in the default filter factories.
199 filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder( 210 filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder(
200 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); 211 message_loop_factory_->GetMessageLoop("AudioDecoderThread")));
201 filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder( 212 filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder(
202 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL)); 213 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL));
203 filter_collection_->AddAudioRenderer(new media::NullAudioRenderer()); 214 filter_collection_->AddAudioRenderer(new media::NullAudioRenderer());
204 215
205 return true; 216 return true;
206 } 217 }
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 void WebMediaPlayerImpl::putCurrentFrame( 649 void WebMediaPlayerImpl::putCurrentFrame(
639 WebKit::WebVideoFrame* web_video_frame) { 650 WebKit::WebVideoFrame* web_video_frame) {
640 if (web_video_frame) { 651 if (web_video_frame) {
641 scoped_refptr<media::VideoFrame> video_frame( 652 scoped_refptr<media::VideoFrame> video_frame(
642 WebVideoFrameImpl::toVideoFrame(web_video_frame)); 653 WebVideoFrameImpl::toVideoFrame(web_video_frame));
643 proxy_->PutCurrentFrame(video_frame); 654 proxy_->PutCurrentFrame(video_frame);
644 delete web_video_frame; 655 delete web_video_frame;
645 } 656 }
646 } 657 }
647 658
648 // TODO(acolwell): Uncomment once WebKit changes are checked in.
649 // https://bugs.webkit.org/show_bug.cgi?id=64731
650 /*
651 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, 659 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data,
652 unsigned length) { 660 unsigned length) {
653 DCHECK_EQ(main_loop_, MessageLoop::current()); 661 DCHECK_EQ(main_loop_, MessageLoop::current());
654 return proxy_->DemuxerAppend(data, length); 662 return proxy_->DemuxerAppend(data, length);
655 } 663 }
656 664
657 void WebMediaPlayerImpl::sourceEndOfStream( 665 void WebMediaPlayerImpl::sourceEndOfStream(
658 WebKit::WebMediaPlayer::EndOfStreamStatus status) { 666 WebKit::WebMediaPlayer::EndOfStreamStatus status) {
659 DCHECK_EQ(main_loop_, MessageLoop::current()); 667 DCHECK_EQ(main_loop_, MessageLoop::current());
660 media::PipelineStatus pipeline_status = media::PIPELINE_OK; 668 media::PipelineStatus pipeline_status = media::PIPELINE_OK;
661 669
662 switch(status) { 670 switch(status) {
663 case WebKit::WebMediaPlayer::EosNoError: 671 case WebKit::WebMediaPlayer::EosNoError:
664 break; 672 break;
665 case WebKit::WebMediaPlayer::EosNetworkError: 673 case WebKit::WebMediaPlayer::EosNetworkError:
666 pipeline_status = media::PIPELINE_ERROR_NETWORK; 674 pipeline_status = media::PIPELINE_ERROR_NETWORK;
667 break; 675 break;
668 case WebKit::WebMediaPlayer::EosDecodeError: 676 case WebKit::WebMediaPlayer::EosDecodeError:
669 pipeline_status = media::PIPELINE_ERROR_DECODE; 677 pipeline_status = media::PIPELINE_ERROR_DECODE;
670 break; 678 break;
671 default: 679 default:
672 NOTIMPLEMENTED(); 680 NOTIMPLEMENTED();
673 } 681 }
674 682
675 proxy_->DemuxerEndOfStream(pipeline_status); 683 proxy_->DemuxerEndOfStream(pipeline_status);
676 } 684 }
677 */
678 685
679 void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() { 686 void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() {
680 Destroy(); 687 Destroy();
681 main_loop_ = NULL; 688 main_loop_ = NULL;
682 } 689 }
683 690
684 void WebMediaPlayerImpl::Repaint() { 691 void WebMediaPlayerImpl::Repaint() {
685 DCHECK_EQ(main_loop_, MessageLoop::current()); 692 DCHECK_EQ(main_loop_, MessageLoop::current());
686 GetClient()->repaint(); 693 GetClient()->repaint();
687 } 694 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 DCHECK_EQ(main_loop_, MessageLoop::current()); 797 DCHECK_EQ(main_loop_, MessageLoop::current());
791 if (is_downloading_data) 798 if (is_downloading_data)
792 SetNetworkState(WebKit::WebMediaPlayer::Loading); 799 SetNetworkState(WebKit::WebMediaPlayer::Loading);
793 else 800 else
794 SetNetworkState(WebKit::WebMediaPlayer::Idle); 801 SetNetworkState(WebKit::WebMediaPlayer::Idle);
795 } 802 }
796 803
797 void WebMediaPlayerImpl::OnDemuxerOpened() { 804 void WebMediaPlayerImpl::OnDemuxerOpened() {
798 DCHECK_EQ(main_loop_, MessageLoop::current()); 805 DCHECK_EQ(main_loop_, MessageLoop::current());
799 806
800 // TODO(acolwell): Uncomment once WebKit changes are checked in. 807 GetClient()->sourceOpened();
801 // https://bugs.webkit.org/show_bug.cgi?id=64731
802 //GetClient()->sourceOpened();
803 } 808 }
804 809
805 void WebMediaPlayerImpl::SetNetworkState( 810 void WebMediaPlayerImpl::SetNetworkState(
806 WebKit::WebMediaPlayer::NetworkState state) { 811 WebKit::WebMediaPlayer::NetworkState state) {
807 DCHECK_EQ(main_loop_, MessageLoop::current()); 812 DCHECK_EQ(main_loop_, MessageLoop::current());
808 // Always notify to ensure client has the latest value. 813 // Always notify to ensure client has the latest value.
809 network_state_ = state; 814 network_state_ = state;
810 GetClient()->networkStateChanged(); 815 GetClient()->networkStateChanged();
811 } 816 }
812 817
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 return client_; 863 return client_;
859 } 864 }
860 865
861 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 866 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
862 DCHECK_EQ(main_loop_, MessageLoop::current()); 867 DCHECK_EQ(main_loop_, MessageLoop::current());
863 incremented_externally_allocated_memory_ = true; 868 incremented_externally_allocated_memory_ = true;
864 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 869 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
865 } 870 }
866 871
867 } // namespace webkit_glue 872 } // namespace webkit_glue
OLDNEW
« content/public/common/content_switches.cc ('K') | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698