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

Side by Side Diff: content/renderer/media/android/media_source_delegate.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 "content/renderer/media/android/media_source_delegate.h" 5 #include "content/renderer/media/android/media_source_delegate.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 size_t MediaSourceDelegate::AudioDecodedByteCount() const { 199 size_t MediaSourceDelegate::AudioDecodedByteCount() const {
200 return statistics_.audio_bytes_decoded; 200 return statistics_.audio_bytes_decoded;
201 } 201 }
202 202
203 size_t MediaSourceDelegate::VideoDecodedByteCount() const { 203 size_t MediaSourceDelegate::VideoDecodedByteCount() const {
204 return statistics_.video_bytes_decoded; 204 return statistics_.video_bytes_decoded;
205 } 205 }
206 206
207 size_t MediaSourceDelegate::getAudioBufferSize() const {
208 media::DemuxerStream* stream = nullptr;
209 if (chunk_demuxer_)
210 stream = chunk_demuxer_->GetStream(DemuxerStream::AUDIO);
211 if (stream)
212 return stream->GetMemoryLimit();
213 return 0;
214 }
215
216 void MediaSourceDelegate::setAudioBufferSize(size_t size) {
217 media::DemuxerStream* stream = nullptr;
218 if (chunk_demuxer_)
219 stream = chunk_demuxer_->GetStream(DemuxerStream::AUDIO);
220 if (stream)
221 return stream->SetMemoryLimit(size);
222 }
223
224 size_t MediaSourceDelegate::getVideoBufferSize() const {
225 media::DemuxerStream* stream = nullptr;
226 if (chunk_demuxer_)
227 stream = chunk_demuxer_->GetStream(DemuxerStream::VIDEO);
228 if (stream)
229 return stream->GetMemoryLimit();
230 return 0;
231 }
232
233 void MediaSourceDelegate::setVideoBufferSize(size_t size) {
234 media::DemuxerStream* stream = nullptr;
235 if (chunk_demuxer_)
236 stream = chunk_demuxer_->GetStream(DemuxerStream::VIDEO);
237 if (stream)
238 return stream->SetMemoryLimit(size);
239 }
240
207 void MediaSourceDelegate::CancelPendingSeek(const base::TimeDelta& seek_time) { 241 void MediaSourceDelegate::CancelPendingSeek(const base::TimeDelta& seek_time) {
208 DCHECK(main_task_runner_->BelongsToCurrentThread()); 242 DCHECK(main_task_runner_->BelongsToCurrentThread());
209 DVLOG(1) << __FUNCTION__ << "(" << seek_time.InSecondsF() << ") : " 243 DVLOG(1) << __FUNCTION__ << "(" << seek_time.InSecondsF() << ") : "
210 << demuxer_client_id_; 244 << demuxer_client_id_;
211 245
212 if (!chunk_demuxer_) 246 if (!chunk_demuxer_)
213 return; 247 return;
214 248
215 { 249 {
216 // Remember to trivially finish any newly arriving browser seek requests 250 // Remember to trivially finish any newly arriving browser seek requests
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 configs->video_size = config.natural_size(); 788 configs->video_size = config.natural_size();
755 configs->is_video_encrypted = config.is_encrypted(); 789 configs->is_video_encrypted = config.is_encrypted();
756 configs->video_extra_data = std::vector<uint8>( 790 configs->video_extra_data = std::vector<uint8>(
757 config.extra_data(), config.extra_data() + config.extra_data_size()); 791 config.extra_data(), config.extra_data() + config.extra_data_size());
758 return true; 792 return true;
759 } 793 }
760 return false; 794 return false;
761 } 795 }
762 796
763 } // namespace content 797 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698