[MSE] Implement per TrackBuffer buffered.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jan 2015 20:36:25 +0000 (20:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jan 2015 20:36:25 +0000 (20:36 +0000)
commit3d26920a07584b0c727ca9c0697220d081c12f36
treec1824818583c6b697740440f4d766ae380745c3c
parent0edfc7549a81a4c7d48db85425b8886e8c06d442
[MSE] Implement per TrackBuffer buffered.
https://bugs.webkit.org/show_bug.cgi?id=139813.

Patch by Bartlomiej Gajda <b.gajda@samsung.com> on 2015-01-14
Reviewed by Jer Noble.

Source/WebCore:

Added implementation of SourceBuffer buffered() algorithm as per specification,
and caching mechanism called when samples are added, removed, or MediaSource
readyState is changed.

Tests: media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html
       media/media-source/media-source-multiple-trackBuffers-buffered.html

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setReadyState):
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::TrackBuffer::TrackBuffer):
(WebCore::SourceBuffer::SourceBuffer):
(WebCore::SourceBuffer::buffered):
(WebCore::SourceBuffer::invalidateBuffered):
(WebCore::SourceBuffer::recalculateBuffered):
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
(WebCore::SourceBuffer::removeCodedFrames):
(WebCore::SourceBuffer::evictCodedFrames):
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
(WebCore::SourceBuffer::bufferedAccountingForEndOfStream):
(WebCore::SourceBuffer::hasCurrentTime):
* Modules/mediasource/SourceBuffer.h:

LayoutTests:

Added tests which checks how buffered behaves for two trackBuffers in single SourceBuffer
after appends, and with MediaSource readyState switching to ended and back to open.

* media/media-source/media-source-multiple-trackBuffers-buffered-expected.txt: Added.
* media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state-expected.txt: Added.
* media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html: Added.
* media/media-source/media-source-multiple-trackBuffers-buffered.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-expected.txt [new file with mode: 0644]
LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state-expected.txt [new file with mode: 0644]
LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html [new file with mode: 0644]
LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/Modules/mediasource/SourceBuffer.h