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

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

Issue 1692403002: MSE - Fix crash caused by incorrect GC of GOP with next buffer position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Increased hardening + more code comments per chat w/chcunningham@ Created 4 years, 10 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_range.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 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 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_
6 #define MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ 6 #define MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Returns true if everything in the range was deleted. Otherwise 107 // Returns true if everything in the range was deleted. Otherwise
108 // returns false. 108 // returns false.
109 bool TruncateAt(DecodeTimestamp timestamp, 109 bool TruncateAt(DecodeTimestamp timestamp,
110 BufferQueue* deleted_buffers, bool is_exclusive); 110 BufferQueue* deleted_buffers, bool is_exclusive);
111 // Deletes all buffers in range. 111 // Deletes all buffers in range.
112 void DeleteAll(BufferQueue* deleted_buffers); 112 void DeleteAll(BufferQueue* deleted_buffers);
113 113
114 // Deletes a GOP from the front or back of the range and moves these 114 // Deletes a GOP from the front or back of the range and moves these
115 // buffers into |deleted_buffers|. Returns the number of bytes deleted from 115 // buffers into |deleted_buffers|. Returns the number of bytes deleted from
116 // the range (i.e. the size in bytes of |deleted_buffers|). 116 // the range (i.e. the size in bytes of |deleted_buffers|).
117 // This range must NOT be empty when these methods are called.
118 // The GOP being deleted must NOT contain the next buffer position.
117 size_t DeleteGOPFromFront(BufferQueue* deleted_buffers); 119 size_t DeleteGOPFromFront(BufferQueue* deleted_buffers);
118 size_t DeleteGOPFromBack(BufferQueue* deleted_buffers); 120 size_t DeleteGOPFromBack(BufferQueue* deleted_buffers);
119 121
120 // Gets the range of GOP to secure at least |bytes_to_free| from 122 // Gets the range of GOP to secure at least |bytes_to_free| from
121 // [|start_timestamp|, |end_timestamp|). 123 // [|start_timestamp|, |end_timestamp|).
122 // Returns the size of the buffers to secure if the buffers of 124 // Returns the size of the buffers to secure if the buffers of
123 // [|start_timestamp|, |end_removal_timestamp|) is removed. 125 // [|start_timestamp|, |end_removal_timestamp|) is removed.
124 // Will not update |end_removal_timestamp| if the returned size is 0. 126 // Will not update |end_removal_timestamp| if the returned size is 0.
125 size_t GetRemovalGOP( 127 size_t GetRemovalGOP(
126 DecodeTimestamp start_timestamp, DecodeTimestamp end_timestamp, 128 DecodeTimestamp start_timestamp, DecodeTimestamp end_timestamp,
127 size_t bytes_to_free, DecodeTimestamp* end_removal_timestamp); 129 size_t bytes_to_free, DecodeTimestamp* end_removal_timestamp);
128 130
131 // Returns true iff the buffered end time of the first GOP in this range is
132 // at or before |media_time|.
129 bool FirstGOPEarlierThanMediaTime(DecodeTimestamp media_time) const; 133 bool FirstGOPEarlierThanMediaTime(DecodeTimestamp media_time) const;
130 134
131 // Indicates whether the GOP at the beginning or end of the range contains the 135 // Indicates whether the GOP at the beginning or end of the range contains the
132 // next buffer position. 136 // next buffer position.
133 bool FirstGOPContainsNextBufferPosition() const; 137 bool FirstGOPContainsNextBufferPosition() const;
134 bool LastGOPContainsNextBufferPosition() const; 138 bool LastGOPContainsNextBufferPosition() const;
135 139
136 // Updates |out_buffer| with the next buffer in presentation order. Seek() 140 // Updates |out_buffer| with the next buffer in presentation order. Seek()
137 // must be called before calls to GetNextBuffer(), and buffers are returned 141 // must be called before calls to GetNextBuffer(), and buffers are returned
138 // in order from the last call to Seek(). Returns true if |out_buffer| is 142 // in order from the last call to Seek(). Returns true if |out_buffer| is
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 294
291 // Stores the amount of memory taken up by the data in |buffers_|. 295 // Stores the amount of memory taken up by the data in |buffers_|.
292 size_t size_in_bytes_; 296 size_t size_in_bytes_;
293 297
294 DISALLOW_COPY_AND_ASSIGN(SourceBufferRange); 298 DISALLOW_COPY_AND_ASSIGN(SourceBufferRange);
295 }; 299 };
296 300
297 } // namespace media 301 } // namespace media
298 302
299 #endif // MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ 303 #endif // MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/source_buffer_range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698