Index: media/filters/source_buffer_stream.cc |
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc |
index e17a4f1c91952b64cf280a9777404e4adeec71d2..60d34df2b0753bf495e1027fea31384fec212ea6 100644 |
--- a/media/filters/source_buffer_stream.cc |
+++ b/media/filters/source_buffer_stream.cc |
@@ -759,6 +759,21 @@ size_t SourceBufferStream::FreeBuffers(size_t total_bytes_to_free, |
// if the buffers surrounding it get deleted during garbage collection. |
SourceBufferRange* new_range_for_append = NULL; |
+ // If media_time is before the first buffered range, that means we are in the |
wolenetz
2015/09/15 22:36:13
nit:s/media_time/|media_time|/
servolk
2015/09/16 00:28:08
Done.
|
+ // process of seeking back in the stream. HTMLMediaElement adjusts media_time |
wolenetz
2015/09/15 22:36:13
nit: s/HTMLMediaElement/caller/
nit: s/media_time/
servolk
2015/09/16 00:28:08
Done.
|
+ // as soon as seeking is started. In those cases we can allow garbage |
+ // collection to delete data from the front, since the player will append new |
+ // data at the seek target position. |
+ if (!ranges_.empty() && |
+ ranges_.front()->GetStartTimestamp() > media_time) { |
+ DVLOG(5) << "media_time (" << media_time.InSecondsF() << ") is earlier than" |
+ << " start of buffered data (" |
+ << ranges_.front()->GetStartTimestamp().InSecondsF() |
+ << "), using media_time=" |
+ << ranges_.front()->GetEndTimestamp().InSecondsF(); |
+ media_time = ranges_.front()->GetEndTimestamp(); |
wolenetz
2015/09/15 22:36:12
nit: While this looks like it would work, could th
servolk
2015/09/16 00:28:08
Acknowledged. I've reworked this as we discussed o
|
+ } |
wolenetz
2015/09/15 23:04:51
As discussed further in chat, it seems we should a
servolk
2015/09/16 00:28:08
Done in the lastest patchset.
|
+ |
wolenetz
2015/09/15 22:36:12
Please add a unit test that verifies this works as
servolk
2015/09/16 00:28:08
I've added a ChunkDemuxer unit tests that verifies
|
while (!ranges_.empty() && bytes_freed < total_bytes_to_free) { |
SourceBufferRange* current_range = NULL; |
BufferQueue buffers; |