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

Side by Side Diff: media/filters/source_buffer_range.cc

Issue 794343003: Implement evictFrames() to support MSE's coded frame eviction algorithm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated existing SourceBufferStream unittests Created 6 years 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/filters/source_buffer_range.h ('k') | media/filters/source_buffer_stream.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/filters/source_buffer_range.h" 5 #include "media/filters/source_buffer_range.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bytes_removed += gop_size; 309 bytes_removed += gop_size;
310 bytes_to_free -= gop_size; 310 bytes_to_free -= gop_size;
311 } 311 }
312 if (bytes_removed > 0) { 312 if (bytes_removed > 0) {
313 *removal_end_timestamp = gop_itr == keyframe_map_.end() ? 313 *removal_end_timestamp = gop_itr == keyframe_map_.end() ?
314 GetBufferedEndTimestamp() : gop_itr->first; 314 GetBufferedEndTimestamp() : gop_itr->first;
315 } 315 }
316 return bytes_removed; 316 return bytes_removed;
317 } 317 }
318 318
319 bool SourceBufferRange::FirstGOPEarlierThanMediaTime(
320 DecodeTimestamp media_time) const {
321 if (keyframe_map_.size() == 1u)
322 return (GetEndTimestamp() < media_time);
323
324 KeyframeMap::const_iterator second_gop = keyframe_map_.begin();
325 ++second_gop;
326 return second_gop->first <= media_time;
327 }
328
319 bool SourceBufferRange::FirstGOPContainsNextBufferPosition() const { 329 bool SourceBufferRange::FirstGOPContainsNextBufferPosition() const {
320 if (!HasNextBufferPosition()) 330 if (!HasNextBufferPosition())
321 return false; 331 return false;
322 332
323 // If there is only one GOP, it must contain the next buffer position. 333 // If there is only one GOP, it must contain the next buffer position.
324 if (keyframe_map_.size() == 1u) 334 if (keyframe_map_.size() == 1u)
325 return true; 335 return true;
326 336
327 KeyframeMap::const_iterator second_gop = keyframe_map_.begin(); 337 KeyframeMap::const_iterator second_gop = keyframe_map_.begin();
328 ++second_gop; 338 ++second_gop;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 592 }
583 593
584 if (buffer->timestamp() + buffer->duration() <= start.ToPresentationTime()) 594 if (buffer->timestamp() + buffer->duration() <= start.ToPresentationTime())
585 continue; 595 continue;
586 buffers->push_back(buffer); 596 buffers->push_back(buffer);
587 } 597 }
588 return previous_size < buffers->size(); 598 return previous_size < buffers->size();
589 } 599 }
590 600
591 } // namespace media 601 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/source_buffer_range.h ('k') | media/filters/source_buffer_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698