| 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/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 Loading... |
| 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 #define COMPILE_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \ | |
| 645 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayer::webkit_name) == \ | |
| 646 static_cast<int>(media::ChunkDemuxer::chromium_name), \ | |
| 647 mismatching_status_enums) | |
| 648 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusOk, kOk); | |
| 649 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusNotSupported, kNotSupported); | |
| 650 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusReachedIdLimit, kReachedIdLimit); | |
| 651 | |
| 652 WebKit::WebMediaPlayer::AddIdStatus WebMediaPlayerImpl::sourceAddId( | |
| 653 const WebKit::WebString& id, | |
| 654 const WebKit::WebString& type) { | |
| 655 DCHECK_EQ(main_loop_, MessageLoop::current()); | |
| 656 return static_cast<WebKit::WebMediaPlayer::AddIdStatus>( | |
| 657 proxy_->DemuxerAddId(id.utf8().data(), type.utf8().data())); | |
| 658 } | |
| 659 | |
| 660 bool WebMediaPlayerImpl::sourceRemoveId(const WebKit::WebString& id) { | |
| 661 DCHECK(!id.isEmpty()); | |
| 662 return proxy_->DemuxerRemoveId(id.utf8().data()); | |
| 663 } | |
| 664 | |
| 665 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, | 644 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, |
| 666 unsigned length) { | 645 unsigned length) { |
| 667 return sourceAppend(WebKit::WebString::fromUTF8("DefaultSourceId"), | |
| 668 data, length); | |
| 669 } | |
| 670 | |
| 671 bool WebMediaPlayerImpl::sourceAppend(const WebKit::WebString& id, | |
| 672 const unsigned char* data, | |
| 673 unsigned length) { | |
| 674 DCHECK_EQ(main_loop_, MessageLoop::current()); | 646 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 675 return proxy_->DemuxerAppend(id.utf8().data(), data, length); | 647 return proxy_->DemuxerAppend(data, length); |
| 676 } | 648 } |
| 677 | 649 |
| 678 void WebMediaPlayerImpl::sourceEndOfStream( | 650 void WebMediaPlayerImpl::sourceEndOfStream( |
| 679 WebMediaPlayer::EndOfStreamStatus status) { | 651 WebMediaPlayer::EndOfStreamStatus status) { |
| 680 DCHECK_EQ(main_loop_, MessageLoop::current()); | 652 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 681 media::PipelineStatus pipeline_status = media::PIPELINE_OK; | 653 media::PipelineStatus pipeline_status = media::PIPELINE_OK; |
| 682 | 654 |
| 683 switch(status) { | 655 switch(status) { |
| 684 case WebMediaPlayer::EndOfStreamStatusNoError: | 656 case WebMediaPlayer::EndOfStreamStatusNoError: |
| 685 break; | 657 break; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 return audio_source_provider_; | 912 return audio_source_provider_; |
| 941 } | 913 } |
| 942 | 914 |
| 943 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 915 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 944 DCHECK_EQ(main_loop_, MessageLoop::current()); | 916 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 945 incremented_externally_allocated_memory_ = true; | 917 incremented_externally_allocated_memory_ = true; |
| 946 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 918 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 947 } | 919 } |
| 948 | 920 |
| 949 } // namespace webkit_media | 921 } // namespace webkit_media |
| OLD | NEW |