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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 563773002: Allow setting different memory limits for different stream types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 55472bd5eb19aee9fcf0128efd290249101af443..470d22cf5f195ea641c26889241a42d32c5d538f 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -156,9 +156,10 @@ class SourceState {
void MarkEndOfStream();
void UnmarkEndOfStream();
void Shutdown();
- // Sets the memory limit on each stream. |memory_limit| is the
- // maximum number of bytes each stream is allowed to hold in its buffer.
- void SetMemoryLimitsForTesting(int memory_limit);
+ // Sets the memory limit on each stream of a specific type.
+ // |memory_limit| is the maximum number of bytes each stream of type |type|
+ // is allowed to hold in its buffer.
+ void SetMemoryLimits(DemuxerStream::Type type, int memory_limit);
bool IsSeekWaitingForData() const;
private:
@@ -485,16 +486,26 @@ void SourceState::Shutdown() {
}
}
-void SourceState::SetMemoryLimitsForTesting(int memory_limit) {
- if (audio_)
- audio_->set_memory_limit_for_testing(memory_limit);
-
- if (video_)
- video_->set_memory_limit_for_testing(memory_limit);
-
- for (TextStreamMap::iterator itr = text_stream_map_.begin();
- itr != text_stream_map_.end(); ++itr) {
- itr->second->set_memory_limit_for_testing(memory_limit);
+void SourceState::SetMemoryLimits(DemuxerStream::Type type, int memory_limit) {
+ switch (type) {
+ case DemuxerStream::AUDIO:
+ if (audio_)
+ audio_->set_memory_limit(memory_limit);
+ break;
+ case DemuxerStream::VIDEO:
+ if (video_)
+ video_->set_memory_limit(memory_limit);
+ break;
+ case DemuxerStream::TEXT:
+ for (TextStreamMap::iterator itr = text_stream_map_.begin();
+ itr != text_stream_map_.end(); ++itr) {
+ itr->second->set_memory_limit(memory_limit);
+ }
+ break;
+ case DemuxerStream::UNKNOWN:
+ case DemuxerStream::NUM_TYPES:
+ NOTREACHED();
+ break;
}
}
@@ -1500,10 +1511,10 @@ void ChunkDemuxer::Shutdown() {
base::ResetAndReturn(&seek_cb_).Run(PIPELINE_ERROR_ABORT);
}
-void ChunkDemuxer::SetMemoryLimitsForTesting(int memory_limit) {
+void ChunkDemuxer::SetMemoryLimits(DemuxerStream::Type type, int memory_limit) {
for (SourceStateMap::iterator itr = source_state_map_.begin();
itr != source_state_map_.end(); ++itr) {
- itr->second->SetMemoryLimitsForTesting(memory_limit);
+ itr->second->SetMemoryLimits(type, memory_limit);
}
}
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698