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

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

Issue 1185453004: Implemented setting memory limits through WebMediaPlayer interface Base URL: https://chromium.googlesource.com/chromium/src.git@set-mem-limits-on-demux-stream
Patch Set: int -> size_t Created 5 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 return stats.audio_bytes_decoded; 588 return stats.audio_bytes_decoded;
589 } 589 }
590 590
591 unsigned WebMediaPlayerImpl::videoDecodedByteCount() const { 591 unsigned WebMediaPlayerImpl::videoDecodedByteCount() const {
592 DCHECK(main_task_runner_->BelongsToCurrentThread()); 592 DCHECK(main_task_runner_->BelongsToCurrentThread());
593 593
594 PipelineStatistics stats = pipeline_.GetStatistics(); 594 PipelineStatistics stats = pipeline_.GetStatistics();
595 return stats.video_bytes_decoded; 595 return stats.video_bytes_decoded;
596 } 596 }
597 597
598 size_t WebMediaPlayerImpl::getAudioBufferSize() const {
599 if (demuxer_ && demuxer_->GetStream(DemuxerStream::AUDIO)) {
ddorwin 2015/06/17 21:02:27 Is it possible for these to be called when there i
servolk 2015/06/17 22:20:58 There are not yet invoked from anywhere.
600 return demuxer_->GetStream(DemuxerStream::AUDIO)->GetMemoryLimit();
601 }
602 return 0;
603 }
604
605 void WebMediaPlayerImpl::setAudioBufferSize(size_t size) {
606 if (demuxer_ && demuxer_->GetStream(DemuxerStream::AUDIO)) {
607 demuxer_->GetStream(DemuxerStream::AUDIO)->SetMemoryLimit(size);
608 }
609 }
610
611 size_t WebMediaPlayerImpl::getVideoBufferSize() const {
612 if (demuxer_ && demuxer_->GetStream(DemuxerStream::VIDEO)) {
613 return demuxer_->GetStream(DemuxerStream::VIDEO)->GetMemoryLimit();
614 }
615 return 0;
616 }
617
618 void WebMediaPlayerImpl::setVideoBufferSize(size_t size) {
619 if (demuxer_ && demuxer_->GetStream(DemuxerStream::VIDEO)) {
620 demuxer_->GetStream(DemuxerStream::VIDEO)->SetMemoryLimit(size);
621 }
622 }
623
598 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( 624 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
599 blink::WebGraphicsContext3D* web_graphics_context, 625 blink::WebGraphicsContext3D* web_graphics_context,
600 unsigned int texture, 626 unsigned int texture,
601 unsigned int level, 627 unsigned int level,
602 unsigned int internal_format, 628 unsigned int internal_format,
603 unsigned int type, 629 unsigned int type,
604 bool premultiply_alpha, 630 bool premultiply_alpha,
605 bool flip_y) { 631 bool flip_y) {
606 return copyVideoTextureToPlatformTexture(web_graphics_context, texture, 632 return copyVideoTextureToPlatformTexture(web_graphics_context, texture,
607 internal_format, type, 633 internal_format, type,
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1059
1034 // pause() may be called after playback has ended and the HTMLMediaElement 1060 // pause() may be called after playback has ended and the HTMLMediaElement
1035 // requires that currentTime() == duration() after ending. We want to ensure 1061 // requires that currentTime() == duration() after ending. We want to ensure
1036 // |paused_time_| matches currentTime() in this case or a future seek() may 1062 // |paused_time_| matches currentTime() in this case or a future seek() may
1037 // incorrectly discard what it thinks is a seek to the existing time. 1063 // incorrectly discard what it thinks is a seek to the existing time.
1038 paused_time_ = 1064 paused_time_ =
1039 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1065 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1040 } 1066 }
1041 1067
1042 } // namespace media 1068 } // namespace media
OLDNEW
« content/renderer/media/android/webmediaplayer_android.cc ('K') | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698