Cap the number of SourceBuffers that may be added to a MediaSource.
authorannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Aug 2012 16:45:50 +0000 (16:45 +0000)
committerannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Aug 2012 16:45:50 +0000 (16:45 +0000)
commitc4924e51a3b47b6bec1226bdc1c363c9af7fb0b2
tree827a0b8312266a4b25816bd9cd782c8ee6ccb5bb
parentde03720a0e2678ba5f15c224964fb99c4bb441ba
Cap the number of SourceBuffers that may be added to a MediaSource.
https://bugs.webkit.org/show_bug.cgi?id=93406

Reviewed by Eric Carlson.

Make sure that no more SourceBuffer objects are added to a MediaSource
than can fit into the sourceBuffers SourceBufferList (internally stored
as a Vector). Also, make sure that new SourceBuffers are added with a
unique id even if the variable we are using to generate id wraps around.

No new tests.  It would not be realistic to add so many SourceBuffers to
test the id variable wrapping.  Existing tests should not be affected.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource):
(WebCore::MediaSource::addSourceBuffer): Obtain a unique id before creating
    a new SourceBuffer.
* Modules/mediasource/MediaSource.h:
* Modules/mediasource/SourceBufferList.cpp:
(WebCore::SourceBufferList::SourceBufferList):
(WebCore::SourceBufferList::generateUniqueId): Search for and generate a
    unique id.
(WebCore):
(WebCore::SourceBufferList::contains): Check if a SourceBuffer with a
    given id already exists in this SourceBufferList.
* Modules/mediasource/SourceBufferList.h:
(SourceBufferList):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/MediaSource.h
Source/WebCore/Modules/mediasource/SourceBufferList.cpp
Source/WebCore/Modules/mediasource/SourceBufferList.h