| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 669 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, | 648 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, |
| 670 unsigned length) { | 649 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) { | |
| 678 DCHECK_EQ(main_loop_, MessageLoop::current()); | 650 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 679 return proxy_->DemuxerAppend(id.utf8().data(), data, length); | 651 return proxy_->DemuxerAppend(data, length); |
| 680 } | 652 } |
| 681 | 653 |
| 682 void WebMediaPlayerImpl::sourceEndOfStream( | 654 void WebMediaPlayerImpl::sourceEndOfStream( |
| 683 WebMediaPlayer::EndOfStreamStatus status) { | 655 WebMediaPlayer::EndOfStreamStatus status) { |
| 684 DCHECK_EQ(main_loop_, MessageLoop::current()); | 656 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 685 media::PipelineStatus pipeline_status = media::PIPELINE_OK; | 657 media::PipelineStatus pipeline_status = media::PIPELINE_OK; |
| 686 | 658 |
| 687 switch(status) { | 659 switch(status) { |
| 688 case WebMediaPlayer::EndOfStreamStatusNoError: | 660 case WebMediaPlayer::EndOfStreamStatusNoError: |
| 689 break; | 661 break; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 return audio_source_provider_; | 1023 return audio_source_provider_; |
| 1052 } | 1024 } |
| 1053 | 1025 |
| 1054 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1026 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1055 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1027 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1056 incremented_externally_allocated_memory_ = true; | 1028 incremented_externally_allocated_memory_ = true; |
| 1057 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1029 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1058 } | 1030 } |
| 1059 | 1031 |
| 1060 } // namespace webkit_media | 1032 } // namespace webkit_media |
| OLD | NEW |