[MSE] Multiple initialization segments with same codecs in tracks fail validation.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Apr 2014 17:54:59 +0000 (17:54 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Apr 2014 17:54:59 +0000 (17:54 +0000)
commitf14b2a78d78bdcc983cde951b39e53bda4aa2969
treed69a0feb4c43b9cdc7abdd90841bd6125e1553ef
parentb85d57c8d6585263ef2ffa488a5e4632f2c59bba
[MSE] Multiple initialization segments with same codecs in tracks fail validation.
https://bugs.webkit.org/show_bug.cgi?id=131768

Source/WebCore:
Additional initialization segments added to the same SourceBuffer with the same
codec values will fail validation. Update the validation check to add the correct
codec information for the initial segment, and check against the correct codecs during
the validation step.

Additionally, after validation, if successful update the Audio, Video, and TextTracks
for the SourceBuffer with the updated initialization segment information.

Reviewed by Eric Carlson.

Test: media/media-source/media-source-multiple-initialization-segments.html

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBufferTimerFired): m_source may have been cleared
    as a result of the append, so check it before using.
(WebCore::SourceBuffer::sourceBufferPrivateDidEndStream): Call streamEndedWithError
    instead of endOfStream as the latter is safe to call within an update.
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): Ditto.
    Update the track lists if validation succeeds.
(WebCore::SourceBuffer::validateInitializationSegment): Switch the audio and video
    codec checks.

Add the ability for Audio, Video, and InbandTextTracks to replace their private tracks:
* html/track/AudioTrack.cpp:
(WebCore::AudioTrack::AudioTrack): Call updateKindFromPrivate().
(WebCore::AudioTrack::setPrivate):
(WebCore::AudioTrack::updateKindFromPrivate): Split out from constructor.
* html/track/AudioTrack.h:
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::InbandTextTrack): Call updateKindFromPrivate().
(WebCore::InbandTextTrack::setPrivate):
(WebCore::InbandTextTrack::setMode): Split up into setModeInternal().
(WebCore::InbandTextTrack::setModeInternal): Broke out from setMode().
(WebCore::InbandTextTrack::updateKindFromPrivate): Split out from constructor.
* html/track/InbandTextTrack.h:
* html/track/TextTrack.h:
(WebCore::TextTrack::isInband): Added, returns false.
* html/track/VideoTrack.cpp:
(WebCore::VideoTrack::VideoTrack): Call updateKindFromPrivate().
(WebCore::VideoTrack::setPrivate):
(WebCore::VideoTrack::updateKindFromPrivate):  Split out from constructor.
* html/track/VideoTrack.h:

LayoutTests:
Reviewed by Eric Carlson.

* media/media-source/media-source-multiple-initialization-segments-expected.txt: Added.
* media/media-source/media-source-multiple-initialization-segments.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/media/media-source/media-source-multiple-initialization-segments-expected.txt [new file with mode: 0644]
LayoutTests/media/media-source/media-source-multiple-initialization-segments.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/html/track/AudioTrack.cpp
Source/WebCore/html/track/AudioTrack.h
Source/WebCore/html/track/InbandTextTrack.cpp
Source/WebCore/html/track/InbandTextTrack.h
Source/WebCore/html/track/TextTrack.h
Source/WebCore/html/track/VideoTrack.cpp
Source/WebCore/html/track/VideoTrack.h