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

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

Issue 1171263004: Allow setting memory limits on media::DemuxerStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged CL that adds get/set buffer size on WMP 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
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)) {
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
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698