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

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

Issue 10066019: Implement sourceAddId() & sourceRemoveId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months 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) 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/webmediaplayer_impl.h" 5 #include "webkit/media/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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 if (web_video_frame) { 634 if (web_video_frame) {
635 scoped_refptr<media::VideoFrame> video_frame( 635 scoped_refptr<media::VideoFrame> video_frame(
636 WebVideoFrameImpl::toVideoFrame(web_video_frame)); 636 WebVideoFrameImpl::toVideoFrame(web_video_frame));
637 proxy_->PutCurrentFrame(video_frame); 637 proxy_->PutCurrentFrame(video_frame);
638 delete web_video_frame; 638 delete web_video_frame;
639 } else { 639 } else {
640 proxy_->PutCurrentFrame(NULL); 640 proxy_->PutCurrentFrame(NULL);
641 } 641 }
642 } 642 }
643 643
644 WebKit::WebMediaPlayer::AddIdStatus WebMediaPlayerImpl::sourceAddId(
645 const WebKit::WebString& id,
646 const WebKit::WebString& type) {
647 DCHECK_EQ(main_loop_, MessageLoop::current());
648 DCHECK(!id.isEmpty());
scherkus (not reviewing) 2012/04/12 20:58:32 are these actually DCHECK worthy? are we protecte
acolwell GONE FROM CHROMIUM 2012/04/12 22:43:12 Done.
649 DCHECK(!type.isEmpty());
650
651 return static_cast<WebKit::WebMediaPlayer::AddIdStatus>(
scherkus (not reviewing) 2012/04/12 20:58:32 do we have compile asserts to back the static_cast
acolwell GONE FROM CHROMIUM 2012/04/12 22:43:12 Done.
652 proxy_->DemuxerAddId(id.utf8().data(), type.utf8().data()));
653 }
654
655 void WebMediaPlayerImpl::sourceRemoveId(const WebKit::WebString& id) {
656 DCHECK(!id.isEmpty());
657 proxy_->DemuxerRemoveId(id.utf8().data());
658 }
659
644 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, 660 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data,
645 unsigned length) { 661 unsigned length) {
662 return sourceAppend(WebKit::WebString::fromUTF8("DefaultSourceId"),
663 data, length);
664 }
665
666 bool WebMediaPlayerImpl::sourceAppend(const WebKit::WebString& id,
667 const unsigned char* data,
668 unsigned length) {
646 DCHECK_EQ(main_loop_, MessageLoop::current()); 669 DCHECK_EQ(main_loop_, MessageLoop::current());
647 return proxy_->DemuxerAppend(data, length); 670 DCHECK(!id.isEmpty());
scherkus (not reviewing) 2012/04/12 20:58:32 ditto on these DCHECKs
acolwell GONE FROM CHROMIUM 2012/04/12 22:43:12 Done.
671 DCHECK(data);
672 DCHECK_GT(length, 0u);
673 return proxy_->DemuxerAppend(id.utf8().data(), data, length);
648 } 674 }
649 675
650 void WebMediaPlayerImpl::sourceEndOfStream( 676 void WebMediaPlayerImpl::sourceEndOfStream(
651 WebKit::WebMediaPlayer::EndOfStreamStatus status) { 677 WebKit::WebMediaPlayer::EndOfStreamStatus status) {
652 DCHECK_EQ(main_loop_, MessageLoop::current()); 678 DCHECK_EQ(main_loop_, MessageLoop::current());
653 media::PipelineStatus pipeline_status = media::PIPELINE_OK; 679 media::PipelineStatus pipeline_status = media::PIPELINE_OK;
654 680
655 switch(status) { 681 switch(status) {
656 case WebKit::WebMediaPlayer::EosNoError: 682 case WebKit::WebMediaPlayer::EosNoError:
657 break; 683 break;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 return audio_source_provider_; 940 return audio_source_provider_;
915 } 941 }
916 942
917 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 943 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
918 DCHECK_EQ(main_loop_, MessageLoop::current()); 944 DCHECK_EQ(main_loop_, MessageLoop::current());
919 incremented_externally_allocated_memory_ = true; 945 incremented_externally_allocated_memory_ = true;
920 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 946 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
921 } 947 }
922 948
923 } // namespace webkit_media 949 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698