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

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

Issue 10164017: Implement sourceAddId() & sourceRemoveId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style fixes 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if (web_video_frame) { 638 if (web_video_frame) {
639 scoped_refptr<media::VideoFrame> video_frame( 639 scoped_refptr<media::VideoFrame> video_frame(
640 WebVideoFrameImpl::toVideoFrame(web_video_frame)); 640 WebVideoFrameImpl::toVideoFrame(web_video_frame));
641 proxy_->PutCurrentFrame(video_frame); 641 proxy_->PutCurrentFrame(video_frame);
642 delete web_video_frame; 642 delete web_video_frame;
643 } else { 643 } else {
644 proxy_->PutCurrentFrame(NULL); 644 proxy_->PutCurrentFrame(NULL);
645 } 645 }
646 } 646 }
647 647
648 #define COMPILE_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \
649 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayer::webkit_name) == \
650 static_cast<int>(media::ChunkDemuxer::chromium_name), \
651 mismatching_status_enums)
652 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusOk, kOk);
653 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusNotSupported, kNotSupported);
654 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusReachedIdLimit, kReachedIdLimit);
655
656 WebKit::WebMediaPlayer::AddIdStatus WebMediaPlayerImpl::sourceAddId(
657 const WebKit::WebString& id,
658 const WebKit::WebString& type) {
659 DCHECK_EQ(main_loop_, MessageLoop::current());
660 return static_cast<WebKit::WebMediaPlayer::AddIdStatus>(
661 proxy_->DemuxerAddId(id.utf8().data(), type.utf8().data()));
662 }
663
664 bool WebMediaPlayerImpl::sourceRemoveId(const WebKit::WebString& id) {
665 DCHECK(!id.isEmpty());
666 return proxy_->DemuxerRemoveId(id.utf8().data());
667 }
668
648 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, 669 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data,
649 unsigned length) { 670 unsigned length) {
671 return sourceAppend(WebKit::WebString::fromUTF8("DefaultSourceId"),
672 data, length);
673 }
674
675 bool WebMediaPlayerImpl::sourceAppend(const WebKit::WebString& id,
676 const unsigned char* data,
677 unsigned length) {
650 DCHECK_EQ(main_loop_, MessageLoop::current()); 678 DCHECK_EQ(main_loop_, MessageLoop::current());
651 return proxy_->DemuxerAppend(data, length); 679 return proxy_->DemuxerAppend(id.utf8().data(), data, length);
652 } 680 }
653 681
654 void WebMediaPlayerImpl::sourceEndOfStream( 682 void WebMediaPlayerImpl::sourceEndOfStream(
655 WebMediaPlayer::EndOfStreamStatus status) { 683 WebMediaPlayer::EndOfStreamStatus status) {
656 DCHECK_EQ(main_loop_, MessageLoop::current()); 684 DCHECK_EQ(main_loop_, MessageLoop::current());
657 media::PipelineStatus pipeline_status = media::PIPELINE_OK; 685 media::PipelineStatus pipeline_status = media::PIPELINE_OK;
658 686
659 switch(status) { 687 switch(status) {
660 case WebMediaPlayer::EndOfStreamStatusNoError: 688 case WebMediaPlayer::EndOfStreamStatusNoError:
661 break; 689 break;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 return audio_source_provider_; 1051 return audio_source_provider_;
1024 } 1052 }
1025 1053
1026 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 1054 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
1027 DCHECK_EQ(main_loop_, MessageLoop::current()); 1055 DCHECK_EQ(main_loop_, MessageLoop::current());
1028 incremented_externally_allocated_memory_ = true; 1056 incremented_externally_allocated_memory_ = true;
1029 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 1057 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
1030 } 1058 }
1031 1059
1032 } // namespace webkit_media 1060 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698