Index: media/base/seekable_buffer.cc |
=================================================================== |
--- media/base/seekable_buffer.cc (revision 17048) |
+++ media/base/seekable_buffer.cc (working copy) |
@@ -32,13 +32,13 @@ |
bool SeekableBuffer::Append(size_t size, const uint8* data) { |
// Since the forward capacity is only used to check the criteria for buffer |
- // full, we will always append data to the buffer. |
+ // full, we always append data to the buffer. |
Buffer* buffer = new Buffer(size); |
memcpy(buffer->data.get(), data, size); |
buffers_.push_back(buffer); |
- // After we have written the first buffer, update the |current_buffer_| to |
- // point to it. |
+ // After we have written the first buffer, update |current_buffer_| to point |
+ // to it. |
if (current_buffer_ == buffers_.end()) { |
DCHECK_EQ(0u, forward_bytes_); |
current_buffer_ = buffers_.begin(); |
@@ -82,31 +82,31 @@ |
// Loop until we taken enough bytes and rewind by the desired |size|. |
while (taken < size) { |
// |current_buffer_| can never be invalid when we are in this loop. It can |
- // only be invalid before any data is appended, this case should be handled |
- // by checks before we enter this loop. |
+ // only be invalid before any data is appended. The invalid case should be |
+ // handled by checks before we enter this loop. |
DCHECK(current_buffer_ != buffers_.end()); |
- // We try to at most |size| bytes in the backward direction, we also have |
- // to account for the offset we are in the current buffer, take the minimum |
- // between the two to determine the amount of bytes to take from the |
+ // We try to consume at most |size| bytes in the backward direction. We also |
+ // have to account for the offset we are in the current buffer, so take the |
+ // minimum between the two to determine the amount of bytes to take from the |
// current buffer. |
size_t consumed = std::min(size - taken, current_buffer_offset_); |
// Decreases the offset in the current buffer since we are rewinding. |
current_buffer_offset_ -= consumed; |
- // Increase the amount of bytes taken in the backward direction, this |
+ // Increase the amount of bytes taken in the backward direction. This |
// determines when to stop the loop. |
taken += consumed; |
- // Forward bytes increases, and backward bytes decreases by the amount |
+ // Forward bytes increases and backward bytes decreases by the amount |
// consumed in the current buffer. |
forward_bytes_ += consumed; |
backward_bytes_ -= consumed; |
DCHECK_GE(backward_bytes_, 0u); |
- // The current buffer pointed by current iterator has been consumed, |
- // move the iterator backward so it points to the previous buffer. |
+ // The current buffer pointed by current iterator has been consumed. Move |
+ // the iterator backward so it points to the previous buffer. |
if (current_buffer_offset_ == 0) { |
if (current_buffer_ == buffers_.begin()) |
break; |
@@ -131,7 +131,7 @@ |
backward_bytes_ -= buffer->size; |
DCHECK_GE(backward_bytes_, 0u); |
- delete *i; |
+ delete buffer; |
buffers_.erase(i); |
} |
} |
@@ -155,7 +155,7 @@ |
size_t copied = std::min(size - taken, |
buffer->size - current_buffer_offset_); |
- // |data| is NULL if we are seeking forward, thus there's no need to copy. |
+ // |data| is NULL if we are seeking forward, so there's no need to copy. |
if (data) |
memcpy(data + taken, buffer->data.get() + current_buffer_offset_, copied); |
@@ -163,11 +163,11 @@ |
// loop. |
taken += copied; |
- // We have read |copied| bytes from the current buffer, advances the offset. |
+ // We have read |copied| bytes from the current buffer. Advances the offset. |
current_buffer_offset_ += copied; |
- // We have less forward bytes and more backward bytes, update these counters |
- // by |copied|. |
+ // We have less forward bytes and more backward bytes. Updates these |
+ // counters by |copied|. |
forward_bytes_ -= copied; |
backward_bytes_ += copied; |
DCHECK_GE(forward_bytes_, 0u); |