OLD | NEW |
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 bytes_removed += gop_size; | 340 bytes_removed += gop_size; |
341 } | 341 } |
342 if (bytes_removed > 0) { | 342 if (bytes_removed > 0) { |
343 *removal_end_timestamp = gop_itr == keyframe_map_.end() ? | 343 *removal_end_timestamp = gop_itr == keyframe_map_.end() ? |
344 GetBufferedEndTimestamp() : gop_itr->first; | 344 GetBufferedEndTimestamp() : gop_itr->first; |
345 } | 345 } |
346 return bytes_removed; | 346 return bytes_removed; |
347 } | 347 } |
348 | 348 |
| 349 bool SourceBufferRange::FirstGOPEarlierThanMediaTime( |
| 350 DecodeTimestamp media_time) const { |
| 351 if (keyframe_map_.size() == 1u) |
| 352 return (GetEndTimestamp() < media_time); |
| 353 |
| 354 KeyframeMap::const_iterator second_gop = keyframe_map_.begin(); |
| 355 ++second_gop; |
| 356 return second_gop->first <= media_time; |
| 357 } |
| 358 |
349 bool SourceBufferRange::FirstGOPContainsNextBufferPosition() const { | 359 bool SourceBufferRange::FirstGOPContainsNextBufferPosition() const { |
350 if (!HasNextBufferPosition()) | 360 if (!HasNextBufferPosition()) |
351 return false; | 361 return false; |
352 | 362 |
353 // If there is only one GOP, it must contain the next buffer position. | 363 // If there is only one GOP, it must contain the next buffer position. |
354 if (keyframe_map_.size() == 1u) | 364 if (keyframe_map_.size() == 1u) |
355 return true; | 365 return true; |
356 | 366 |
357 KeyframeMap::const_iterator second_gop = keyframe_map_.begin(); | 367 KeyframeMap::const_iterator second_gop = keyframe_map_.begin(); |
358 ++second_gop; | 368 ++second_gop; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 } | 624 } |
615 | 625 |
616 if (buffer->timestamp() + buffer->duration() <= start.ToPresentationTime()) | 626 if (buffer->timestamp() + buffer->duration() <= start.ToPresentationTime()) |
617 continue; | 627 continue; |
618 buffers->push_back(buffer); | 628 buffers->push_back(buffer); |
619 } | 629 } |
620 return previous_size < buffers->size(); | 630 return previous_size < buffers->size(); |
621 } | 631 } |
622 | 632 |
623 } // namespace media | 633 } // namespace media |
OLD | NEW |