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