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

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

Issue 312403002: Fix crashes caused when SourceBuffer.remove() is called starting at the presentation duration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | media/filters/source_buffer_stream_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_stream.h" 5 #include "media/filters/source_buffer_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 void SourceBufferStream::Remove(base::TimeDelta start, base::TimeDelta end, 583 void SourceBufferStream::Remove(base::TimeDelta start, base::TimeDelta end,
584 base::TimeDelta duration) { 584 base::TimeDelta duration) {
585 DVLOG(1) << __FUNCTION__ << "(" << start.InSecondsF() 585 DVLOG(1) << __FUNCTION__ << "(" << start.InSecondsF()
586 << ", " << end.InSecondsF() 586 << ", " << end.InSecondsF()
587 << ", " << duration.InSecondsF() << ")"; 587 << ", " << duration.InSecondsF() << ")";
588 DCHECK(start >= base::TimeDelta()) << start.InSecondsF(); 588 DCHECK(start >= base::TimeDelta()) << start.InSecondsF();
589 DCHECK(start < end) << "start " << start.InSecondsF() 589 DCHECK(start < end) << "start " << start.InSecondsF()
590 << " end " << end.InSecondsF(); 590 << " end " << end.InSecondsF();
591 DCHECK(duration != kNoTimestamp()); 591 DCHECK(duration != kNoTimestamp());
592 DCHECK(start <= duration) << "start " << start.InSecondsF()
593 << " duration " << duration.InSecondsF();
592 594
593 base::TimeDelta remove_end_timestamp = duration; 595 base::TimeDelta remove_end_timestamp = duration;
594 base::TimeDelta keyframe_timestamp = FindKeyframeAfterTimestamp(end); 596 base::TimeDelta keyframe_timestamp = FindKeyframeAfterTimestamp(end);
595 if (keyframe_timestamp != kNoTimestamp()) { 597 if (keyframe_timestamp != kNoTimestamp()) {
596 remove_end_timestamp = keyframe_timestamp; 598 remove_end_timestamp = keyframe_timestamp;
wolenetz 2014/06/05 21:38:03 nit: ILTM like adding DCHECK(keyframe_timestamp >
acolwell GONE FROM CHROMIUM 2014/06/05 22:56:25 I don't think we need this here since the DCHECK i
597 } else if (end < remove_end_timestamp) { 599 } else if (end < remove_end_timestamp) {
598 remove_end_timestamp = end; 600 remove_end_timestamp = end;
599 } 601 }
600 602
603 if (start == remove_end_timestamp)
wolenetz 2014/06/05 21:38:03 remove_end_timestamp is either duration (in which
acolwell GONE FROM CHROMIUM 2014/06/05 22:56:25 I moved this to ChunkDemuxer::Remove(). I can't go
604 return;
605
601 BufferQueue deleted_buffers; 606 BufferQueue deleted_buffers;
602 RemoveInternal(start, remove_end_timestamp, false, &deleted_buffers); 607 RemoveInternal(start, remove_end_timestamp, false, &deleted_buffers);
603 608
604 if (!deleted_buffers.empty()) 609 if (!deleted_buffers.empty())
605 SetSelectedRangeIfNeeded(deleted_buffers.front()->GetDecodeTimestamp()); 610 SetSelectedRangeIfNeeded(deleted_buffers.front()->GetDecodeTimestamp());
606 } 611 }
607 612
608 void SourceBufferStream::RemoveInternal( 613 void SourceBufferStream::RemoveInternal(
609 base::TimeDelta start, base::TimeDelta end, bool is_exclusive, 614 base::TimeDelta start, base::TimeDelta end, bool is_exclusive,
610 BufferQueue* deleted_buffers) { 615 BufferQueue* deleted_buffers) {
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 return false; 2241 return false;
2237 2242
2238 DCHECK_NE(have_splice_buffers, have_preroll_buffer); 2243 DCHECK_NE(have_splice_buffers, have_preroll_buffer);
2239 splice_buffers_index_ = 0; 2244 splice_buffers_index_ = 0;
2240 pending_buffer_.swap(*out_buffer); 2245 pending_buffer_.swap(*out_buffer);
2241 pending_buffers_complete_ = false; 2246 pending_buffers_complete_ = false;
2242 return true; 2247 return true;
2243 } 2248 }
2244 2249
2245 } // namespace media 2250 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698