Merge blink MediaSource changes since fork.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Sep 2013 17:25:42 +0000 (17:25 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Sep 2013 17:25:42 +0000 (17:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=118752

Rubber-stamped by Eric Carlson.

Source/WebCore:

Tests: http/tests/media/media-source/mediasource-addsourcebuffer.html
       http/tests/media/media-source/mediasource-append-buffer.html
       http/tests/media/media-source/mediasource-buffered.html
       http/tests/media/media-source/mediasource-closed.html
       http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html
       http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
       http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html
       http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html
       http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html
       http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html
       http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html
       http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html
       http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html
       http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html
       http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html
       http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html
       http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html
       http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html
       http/tests/media/media-source/mediasource-is-type-supported.html
       http/tests/media/media-source/mediasource-multiple-attach.html
       http/tests/media/media-source/mediasource-play.html
       http/tests/media/media-source/mediasource-sourcebufferlist.html

Add files to project. Fix compile errors exposed by enabling.

* WebCore.xcodeproj/project.pbxproj:
* Modules/mediasource/MediaSourceRegistry.cpp:
(WebCore::MediaSourceRegistry::lookupMediaSource):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(WebCore::MediaPlayerPrivateAVFoundation::load):
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
(WebCore::MediaPlayerPrivateQTKit::load):
* platform/mac/MIMETypeRegistryMac.mm:
(WebCore::MIMETypeRegistry::isSupportedMediaSourceMIMEType):
* CMakeLists.txt:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:

Merge
https://chromium.googlesource.com/chromium/blink/+/c38e2955db98a300a535b692869fea0e41501497
https://chromium.googlesource.com/chromium/blink/+/8568015e9bee1de7fccee28163f9e4a4b51f9baf
https://chromium.googlesource.com/chromium/blink/+/14417e8fa6294f4e7dbc1e0fac549398522b2f97
https://chromium.googlesource.com/chromium/blink/+/f43a5496f233102f8861a067a9cf8053c010d401
https://chromium.googlesource.com/chromium/blink/+/57771439806f7c6e6a272efb1ea72900f5f6a015
https://chromium.googlesource.com/chromium/blink/+/8c77a790a9d225194db0a8832399d0f9e1fa54ec
https://chromium.googlesource.com/chromium/blink/+/d33ae3fa7a8592e946503ed17f862a27c6d9dde1
https://chromium.googlesource.com/chromium/blink/+/1caaa9c51f06e1b9341d58c994f77fd59fcd236d
https://chromium.googlesource.com/chromium/blink/+/e95720393b0ebe67f19de39bb77cdf2926165512
https://chromium.googlesource.com/chromium/blink/+/bad2c1b4b70faec731b2ad3cc8a4ccf28de6cc38
https://chromium.googlesource.com/chromium/blink/+/a7873430c3d5c9373336c6f3993db3cb4228e9cd
https://chromium.googlesource.com/chromium/blink/+/508966d5e32360b3cec058f9fbae0014542fbc52
https://chromium.googlesource.com/chromium/blink/+/371dfe72f61ce6f73e6c242324da73c415d38be3

LayoutTests:

* http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt: Added.
* http/tests/media/media-source/mediasource-addsourcebuffer.html: Added.
* http/tests/media/media-source/mediasource-append-buffer-expected.txt: Added.
* http/tests/media/media-source/mediasource-append-buffer.html: Added.
* http/tests/media/media-source/mediasource-buffered-expected.txt: Added.
* http/tests/media/media-source/mediasource-buffered.html: Added.
* http/tests/media/media-source/mediasource-closed-expected.txt: Added.
* http/tests/media/media-source/mediasource-closed.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html: Added.
* http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt: Added.
* http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html: Added.
* http/tests/media/media-source/mediasource-config-changes.js: Added.
* http/tests/media/media-source/mediasource-is-type-supported-expected.txt: Added.
* http/tests/media/media-source/mediasource-is-type-supported.html: Added.
* http/tests/media/media-source/mediasource-multiple-attach-expected.txt: Added.
* http/tests/media/media-source/mediasource-multiple-attach.html: Added.
* http/tests/media/media-source/mediasource-play-expected.txt: Added.
* http/tests/media/media-source/mediasource-play.html: Added.
* http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt: Added.
* http/tests/media/media-source/mediasource-sourcebufferlist.html: Added.
* http/tests/media/media-source/mediasource-util.js: Added.
* http/tests/media/media-source/video-media-source-objects-expected.txt:
* http/tests/media/resources/media-source/generate-config-change-tests.py: Added.
* http/tests/media/resources/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json: Added.
* http/tests/media/resources/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156049 268f45cc-cd09-0410-ab3c-d52691b4dbfc

131 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-buffered-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-buffered.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-closed-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-closed.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-config-changes.js [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-is-type-supported.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-multiple-attach-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-multiple-attach.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-play-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-play.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/mediasource-util.js [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/video-media-source-objects-expected.txt
LayoutTests/http/tests/media/resources/media-source/generate-config-change-tests.py [new file with mode: 0755]
LayoutTests/http/tests/media/resources/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json [new file with mode: 0644]
LayoutTests/http/tests/media/resources/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/MediaSource.h
Source/WebCore/Modules/mediasource/MediaSource.idl
Source/WebCore/Modules/mediasource/MediaSourceBase.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediasource/MediaSourceBase.h [new file with mode: 0644]
Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp
Source/WebCore/Modules/mediasource/MediaSourceRegistry.h
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/Modules/mediasource/SourceBuffer.h
Source/WebCore/Modules/mediasource/SourceBuffer.idl
Source/WebCore/Modules/mediasource/SourceBufferList.cpp
Source/WebCore/Modules/mediasource/SourceBufferList.h
Source/WebCore/Modules/mediasource/SourceBufferList.idl
Source/WebCore/Modules/mediasource/URLMediaSource.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediasource/URLMediaSource.h [new file with mode: 0644]
Source/WebCore/Modules/mediasource/URLMediaSource.idl [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitMediaSource.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitMediaSource.h [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitMediaSource.idl [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitSourceBuffer.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitSourceBuffer.h [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitSourceBuffer.idl [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitSourceBufferList.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitSourceBufferList.h [new file with mode: 0644]
Source/WebCore/Modules/mediasource/WebKitSourceBufferList.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/Modules/mediastream/MediaStreamRegistry.cpp
Source/WebCore/Modules/mediastream/MediaStreamRegistry.h
Source/WebCore/Modules/mediastream/URLMediaStream.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/URLMediaStream.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/URLMediaStream.idl [new file with mode: 0644]
Source/WebCore/Target.pri
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/EventNames.h
Source/WebCore/dom/EventTarget.h
Source/WebCore/dom/EventTargetFactory.in
Source/WebCore/fileapi/Blob.cpp
Source/WebCore/fileapi/Blob.h
Source/WebCore/html/DOMURL.cpp
Source/WebCore/html/DOMURL.h
Source/WebCore/html/DOMURL.idl
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMediaSource.cpp [new file with mode: 0644]
Source/WebCore/html/HTMLMediaSource.h [new file with mode: 0644]
Source/WebCore/html/PublicURLManager.cpp [new file with mode: 0644]
Source/WebCore/html/PublicURLManager.h
Source/WebCore/html/URLRegistry.h [new file with mode: 0644]
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/platform/graphics/MediaSourcePrivate.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/mac/MIMETypeRegistryMac.mm

index 31ab8fb..d9688e8 100644 (file)
@@ -1,3 +1,79 @@
+2013-09-18  Jer Noble  <jer.noble@apple.com>
+
+        Merge blink MediaSource changes since fork.
+        https://bugs.webkit.org/show_bug.cgi?id=118752
+
+        Rubber-stamped by Eric Carlson.
+
+        * http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-addsourcebuffer.html: Added.
+        * http/tests/media/media-source/mediasource-append-buffer-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-append-buffer.html: Added.
+        * http/tests/media/media-source/mediasource-buffered-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-buffered.html: Added.
+        * http/tests/media/media-source/mediasource-closed-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-closed.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html: Added.
+        * http/tests/media/media-source/mediasource-config-changes.js: Added.
+        * http/tests/media/media-source/mediasource-is-type-supported-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-is-type-supported.html: Added.
+        * http/tests/media/media-source/mediasource-multiple-attach-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-multiple-attach.html: Added.
+        * http/tests/media/media-source/mediasource-play-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-play.html: Added.
+        * http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt: Added.
+        * http/tests/media/media-source/mediasource-sourcebufferlist.html: Added.
+        * http/tests/media/media-source/mediasource-util.js: Added.
+        * http/tests/media/media-source/video-media-source-objects-expected.txt:
+        * http/tests/media/resources/media-source/generate-config-change-tests.py: Added.
+        * http/tests/media/resources/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json: Added.
+        * http/tests/media/resources/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json: Added.
+
 2013-09-18  Filip Pizlo  <fpizlo@apple.com>
 
         DFG should support Int52 for local variables
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt
new file mode 100644 (file)
index 0000000..4bef82f
--- /dev/null
@@ -0,0 +1,8 @@
+PASS Test addSourceBuffer() with empty type 
+PASS Test addSourceBuffer() with unsupported type 
+PASS Test addSourceBuffer() with Vorbis and VP8 
+PASS Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers 
+FAIL Test addSourceBuffer() with AAC and H.264 assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported expected true got false
+FAIL Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers assert_true: video/mp4;codecs="avc1.4D4001" is supported expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html b/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html
new file mode 100644 (file)
index 0000000..50134be
--- /dev/null
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              assert_throws("InvalidAccessError",
+                          function() { mediaSource.addSourceBuffer(""); },
+                          "addSourceBuffer() threw an exception when passed an empty string.");
+              test.done();
+          }, "Test addSourceBuffer() with empty type");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              assert_throws("NotSupportedError",
+                          function() { mediaSource.addSourceBuffer("invalidType"); },
+                          "addSourceBuffer() threw an exception for an unsupported type.");
+              test.done();
+          }, "Test addSourceBuffer() with unsupported type");
+
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var mimetype = 'video/webm;codecs="vp8,vorbis"';
+
+              assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported");
+
+              var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
+              assert_true(sourceBuffer != null, "New SourceBuffer returned");
+              assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceBuffer is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers[0], sourceBuffer, "SourceBuffer is in mediaSource.activeSourceBuffers");
+              test.done();
+          }, "Test addSourceBuffer() with Vorbis and VP8");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var videoMimetype = 'video/webm;codecs="vp8"';
+              var audioMimetype = 'audio/webm;codecs="vorbis"';
+
+              assert_true(MediaSource.isTypeSupported(videoMimetype), videoMimetype + " is supported");
+              assert_true(MediaSource.isTypeSupported(audioMimetype), audioMimetype + " is supported");
+
+              var sourceBufferA = mediaSource.addSourceBuffer(videoMimetype);
+              var sourceBufferB = mediaSource.addSourceBuffer(audioMimetype);
+              assert_equals(mediaSource.sourceBuffers[0], sourceBufferA, "sourceBufferA is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers[0], sourceBufferA, "sourceBufferA is in mediaSource.activeSourceBuffers");
+              assert_equals(mediaSource.sourceBuffers[1], sourceBufferB, "sourceBufferB is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers[1], sourceBufferB, "sourceBufferB is in mediaSource.activeSourceBuffers");
+              test.done();
+          }, "Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var mimetype = 'video/mp4;codecs="avc1.4D4001,mp4a.40.2"';
+
+              assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported");
+
+              var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
+              assert_true(sourceBuffer != null, "New SourceBuffer returned");
+              assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceBuffer is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers[0], sourceBuffer, "SourceBuffer is in mediaSource.activeSourceBuffers");
+              test.done();
+          }, "Test addSourceBuffer() with AAC and H.264");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var videoMimetype = 'video/mp4;codecs="avc1.4D4001"';
+              var audioMimetype = 'audio/mp4;codecs="mp4a.40.2"';
+
+              assert_true(MediaSource.isTypeSupported(videoMimetype), videoMimetype + " is supported");
+              assert_true(MediaSource.isTypeSupported(audioMimetype), audioMimetype + " is supported");
+
+              var sourceBufferA = mediaSource.addSourceBuffer(videoMimetype);
+              var sourceBufferB = mediaSource.addSourceBuffer(audioMimetype);
+              assert_equals(mediaSource.sourceBuffers[0], sourceBufferA, "sourceBufferA is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers[0], sourceBufferA, "sourceBufferA is in mediaSource.activeSourceBuffers");
+              assert_equals(mediaSource.sourceBuffers[1], sourceBufferB, "sourceBufferB is in mediaSource.sourceBuffers");
+              assert_equals(mediaSource.activeSourceBuffers[1], sourceBufferB, "sourceBufferB is in mediaSource.activeSourceBuffers");
+              test.done();
+          }, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt
new file mode 100644 (file)
index 0000000..1b3cee6
--- /dev/null
@@ -0,0 +1,9 @@
+PASS Test SourceBuffer.appendBuffer() event dispatching. 
+PASS Test SourceBuffer.appendBuffer() call during a pending appendBuffer(). 
+PASS Test SourceBuffer.abort() call during a pending appendBuffer(). 
+PASS Test SourceBuffer.appendBuffer() triggering an 'ended' to 'open' transition. 
+PASS Test MediaSource.removeSourceBuffer() call during a pending appendBuffer(). 
+PASS Test appending an empty ArrayBufferView. 
+PASS Test appending an empty ArrayBuffer. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html b/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html
new file mode 100644 (file)
index 0000000..1685b40
--- /dev/null
@@ -0,0 +1,199 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          mediasource_loaddata_test = function(callback, description)
+          {
+              mediasource_test(function(test, mediaElement, mediaSource)
+              {
+                  var mediaType = 'video/webm;codecs="vp8,vorbis"';
+                  var mediaURL = '/media/resources/media-source/webm/test.webm';
+                  var sourceBuffer = mediaSource.addSourceBuffer(mediaType);
+                  MediaSourceUtil.loadBinaryData(test, mediaURL, function(mediaData)
+                  {
+                      callback(test, mediaElement, mediaSource, sourceBuffer, mediaData);
+
+                  });
+              }, description);
+          };
+
+          mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+          {
+              test.failOnEvent(mediaElement, 'error');
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "update", "Append success.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                 assert_false(sourceBuffer.updating, "updating attribute is false");
+                 test.done();
+              });
+          }, "Test SourceBuffer.appendBuffer() event dispatching.");
+
+          mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+          {
+              test.failOnEvent(mediaElement, 'error');
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "update", "Append success.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              assert_throws("InvalidStateError",
+                  function() { sourceBuffer.appendBuffer(mediaData); },
+                  "appendBuffer() throws an exception there is a pending append.");
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test SourceBuffer.appendBuffer() call during a pending appendBuffer().");
+
+          mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+          {
+              test.failOnEvent(mediaElement, 'error');
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "abort", "Append aborted.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              sourceBuffer.abort();
+
+              assert_false(sourceBuffer.updating, "updating attribute is false");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test SourceBuffer.abort() call during a pending appendBuffer().");
+
+          mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+          {
+              test.failOnEvent(mediaElement, 'error');
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "update", "Append success.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+
+                  test.expectEvent(mediaSource, "sourceended", "MediaSource sourceended event");
+                  mediaSource.endOfStream();
+                  assert_equals(mediaSource.readyState, "ended", "MediaSource readyState is 'ended'");
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, "ended", "MediaSource readyState is 'ended'");
+
+                  test.expectEvent(mediaSource, "sourceopen", "MediaSource sourceopen event");
+                  test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+                  test.expectEvent(sourceBuffer, "update", "Append success.");
+                  test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+                  sourceBuffer.appendBuffer(mediaData);
+
+                  assert_equals(mediaSource.readyState, "open", "MediaSource readyState is 'open'");
+                  assert_true(sourceBuffer.updating, "updating attribute is true");
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, "open", "MediaSource readyState is 'open'");
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test SourceBuffer.appendBuffer() triggering an 'ended' to 'open' transition.");
+
+          mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+          {
+              test.failOnEvent(mediaElement, 'error');
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "abort", "Append aborted.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuffer", "activeSourceBuffers");
+              test.expectEvent(mediaSource.sourceBuffers, "removesourcebuffer", "sourceBuffers");
+              mediaSource.removeSourceBuffer(sourceBuffer);
+
+              assert_false(sourceBuffer.updating, "updating attribute is false");
+
+              assert_throws("InvalidStateError",
+                  function() { sourceBuffer.appendBuffer(mediaData); },
+                  "appendBuffer() throws an exception because it isn't attached to the mediaSource anymore.");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test MediaSource.removeSourceBuffer() call during a pending appendBuffer().");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "update", "Append success.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(new Uint8Array(0));
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test appending an empty ArrayBufferView.");
+
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "update", "Append success.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(new ArrayBuffer(0));
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test appending an empty ArrayBuffer.");
+
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-buffered-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-buffered-expected.txt
new file mode 100644 (file)
index 0000000..059b541
--- /dev/null
@@ -0,0 +1,6 @@
+PASS Demuxed content with different lengths 
+PASS Muxed tracks with different lengths 
+PASS Demuxed content with an empty buffered range on one SourceBuffer 
+PASS Muxed content empty buffered ranges. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-buffered.html b/LayoutTests/http/tests/media/media-source/mediasource-buffered.html
new file mode 100644 (file)
index 0000000..572838a
--- /dev/null
@@ -0,0 +1,162 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            function mediaSourceDemuxedTest(callback, description)
+            {
+                var manifestFilenameA = "webm/test-a-128k-44100Hz-1ch-manifest.json";
+                var manifestFilenameB = "webm/test-v-128k-320x240-30fps-10kfr-manifest.json";
+                mediasource_test(function(test, mediaElement, mediaSource)
+                {
+                    mediaElement.pause();
+                    test.failOnEvent(mediaElement, 'error');
+                    test.endOnEvent(mediaElement, 'ended');
+
+                    MediaSourceUtil.fetchManifestAndData(test, manifestFilenameA, function(typeA, dataA)
+                    {
+                        MediaSourceUtil.fetchManifestAndData(test, manifestFilenameB, function(typeB, dataB)
+                        {
+                            mediaSource.addSourceBuffer(typeA);
+                            mediaSource.addSourceBuffer(typeB);
+                            assert_equals(mediaSource.activeSourceBuffers.length, 2);
+
+                            callback(test, mediaElement, mediaSource, dataA, dataB);
+                        });
+                    });
+                }, description);
+            };
+
+            function appendData(test, mediaSource, dataA, dataB, callback)
+            {
+                var sourceBufferA = mediaSource.activeSourceBuffers[0];
+                var sourceBufferB = mediaSource.activeSourceBuffers[1];
+
+                test.expectEvent(sourceBufferA, "update");
+                test.expectEvent(sourceBufferA, "updateend");
+                sourceBufferA.appendBuffer(dataA);
+
+                test.expectEvent(sourceBufferB, "update");
+                test.expectEvent(sourceBufferB, "updateend");
+                sourceBufferB.appendBuffer(dataB);
+
+                test.waitForExpectedEvents(function()
+                {
+                     callback();
+                });
+            }
+
+            function timeRangesToString(ranges)
+            {
+               var s = "{";
+               for (var i = 0; i < ranges.length; ++i) {
+                   s += " [" + ranges.start(i).toFixed(3) + ", " + ranges.end(i).toFixed(3) + ")";
+               }
+               return s + " }";
+            }
+
+            function assertBufferedEquals(obj, expected, description)
+            {
+                var actual = timeRangesToString(obj.buffered);
+                assert_equals(actual, expected, description);
+            }
+
+            mediaSourceDemuxedTest(function(test, mediaElement, mediaSource, dataA, dataB) {
+                appendData(test, mediaSource, dataA, dataB, function()
+                {
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ [0.000, 2.023) }", "mediaSource.activeSourceBuffers[0]");
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[1], "{ [0.000, 2.001) }", "mediaSource.activeSourceBuffers[1]");
+                    assertBufferedEquals(mediaElement, "{ [0.000, 2.001) }", "mediaElement.buffered");
+
+                    mediaSource.endOfStream();
+
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ [0.000, 2.023) }", "mediaSource.activeSourceBuffers[0]");
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[1], "{ [0.000, 2.001) }", "mediaSource.activeSourceBuffers[1]");
+                    assertBufferedEquals(mediaElement, "{ [0.000, 2.023) }", "mediaElement.buffered");
+
+                    test.done();
+                });
+            }, "Demuxed content with different lengths");
+
+            mediasource_test(function(test, mediaElement, mediaSource)
+            {
+                mediaElement.pause();
+                test.failOnEvent(mediaElement, 'error');
+                test.endOnEvent(mediaElement, 'ended');
+
+                MediaSourceUtil.fetchManifestAndData(test, "webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json", function(type, data)
+                {
+                    var sourceBuffer = mediaSource.addSourceBuffer(type);
+                    test.expectEvent(sourceBuffer, "update");
+                    test.expectEvent(sourceBuffer, "updateend");
+                    sourceBuffer.appendBuffer(data);
+
+                    test.waitForExpectedEvents(function()
+                    {
+                        assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ [0.000, 2.004) }", "mediaSource.activeSourceBuffers[0]");
+                        assertBufferedEquals(mediaElement, "{ [0.000, 2.004) }", "mediaElement.buffered");
+
+                        mediaSource.endOfStream();
+
+                        assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ [0.000, 2.023) }", "mediaSource.activeSourceBuffers[0]");
+                        assertBufferedEquals(mediaElement, "{ [0.000, 2.023) }", "mediaElement.buffered");
+
+                        test.done();
+                    });
+                });
+            }, "Muxed tracks with different lengths");
+
+
+            mediaSourceDemuxedTest(function(test, mediaElement, mediaSource, dataA, dataB) {
+                appendData(test, mediaSource, dataA, dataB.subarray(0, 318), function()
+                {
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ [0.000, 2.023) }", "mediaSource.activeSourceBuffers[0]");
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[1], "{ }", "mediaSource.activeSourceBuffers[1]");
+                    assertBufferedEquals(mediaElement, "{ }", "mediaElement.buffered");
+
+                    mediaSource.endOfStream();
+
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ [0.000, 2.023) }", "mediaSource.activeSourceBuffers[0]");
+                    assertBufferedEquals(mediaSource.activeSourceBuffers[1], "{ }", "mediaSource.activeSourceBuffers[1]");
+                    assertBufferedEquals(mediaElement, "{ }", "mediaElement.buffered");
+
+                    test.done();
+                });
+            }, "Demuxed content with an empty buffered range on one SourceBuffer");
+
+            mediasource_test(function(test, mediaElement, mediaSource)
+            {
+                mediaElement.pause();
+                test.failOnEvent(mediaElement, 'error');
+                test.endOnEvent(mediaElement, 'ended');
+
+                MediaSourceUtil.fetchManifestAndData(test, "webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json", function(type, data)
+                {
+                    var sourceBuffer = mediaSource.addSourceBuffer(type);
+                    test.expectEvent(sourceBuffer, "update");
+                    test.expectEvent(sourceBuffer, "updateend");
+                    sourceBuffer.appendBuffer(data.subarray(0, 4052));
+
+                    test.waitForExpectedEvents(function()
+                    {
+                        assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ }", "mediaSource.activeSourceBuffers[0]");
+                        assertBufferedEquals(mediaElement, "{ }", "mediaElement.buffered");
+
+                        mediaSource.endOfStream();
+
+                        assertBufferedEquals(mediaSource.activeSourceBuffers[0], "{ }", "mediaSource.activeSourceBuffers[0]");
+                        assertBufferedEquals(mediaElement, "{ }", "mediaElement.buffered");
+
+                        test.done();
+                    });
+                });
+            }, "Muxed content empty buffered ranges.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-closed-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-closed-expected.txt
new file mode 100644 (file)
index 0000000..c85ce1b
--- /dev/null
@@ -0,0 +1,7 @@
+PASS Test attribute values on a closed MediaSource object. 
+PASS Test addSourceBuffer() while closed. 
+PASS Test removeSourceBuffer() while closed. 
+PASS Test endOfStream() while closed. 
+PASS Test setting duration while closed. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-closed.html b/LayoutTests/http/tests/media/media-source/mediasource-closed.html
new file mode 100644 (file)
index 0000000..69331df
--- /dev/null
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          test(function ()
+          {
+              var mediaSource = new MediaSource();
+              assert_equals(mediaSource.sourceBuffers.length, 0, "sourceBuffers is empty");
+              assert_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers is empty");
+              assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'");
+              assert_true(Number.isNaN(mediaSource.duration), "duration is NaN");
+          }, "Test attribute values on a closed MediaSource object.");
+
+          test(function ()
+          {
+              var mediaSource = new MediaSource();
+              assert_throws("InvalidStateError",
+                  function() { mediaSource.addSourceBuffer('video/webm;codecs="vp8"'); },
+                  "addSourceBuffer() throws an exception when closed.");
+          }, "Test addSourceBuffer() while closed.");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              var VORBIS_TYPE = 'video/webm;codecs="vorbis"';
+              var AAC_TYPE = 'video/mp4;codecs="mp4a.40.2"';
+              var mediaType = MediaSource.isTypeSupported(VORBIS_TYPE) ? VORBIS_TYPE : AAC_TYPE;
+              var sourceBuffer = mediaSource.addSourceBuffer(mediaType);
+
+              // Setup a handler to run when the MediaSource closes.
+              mediaSource.addEventListener('sourceclose', test.step_func(function (event)
+              {
+                  assert_equals(mediaSource.sourceBuffers.length, 0, "sourceBuffers is empty");
+                  assert_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers is empty");
+                  assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'");
+                  assert_throws("NotFoundError",
+                      function() { mediaSource.removeSourceBuffer(sourceBuffer); },
+                      "removeSourceBuffer() throws an exception when closed.");
+                  test.done();
+              }));
+
+              // Trigger the MediaSource to close.
+              mediaElement.src = "";
+          }, "Test removeSourceBuffer() while closed.");
+
+          test(function ()
+          {
+              var mediaSource = new MediaSource();
+              assert_throws("InvalidStateError",
+                  function() { mediaSource.endOfStream(); },
+                  "endOfStream() throws an exception when closed.");
+          }, "Test endOfStream() while closed.");
+
+
+          test(function ()
+          {
+              var mediaSource = new MediaSource();
+              assert_throws("InvalidStateError",
+                  function() { mediaSource.duration = 10; },
+                  "Setting duration throws an exception when closed.");
+          }, "Test setting duration while closed.");
+
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..a2def03
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 audio-only bitrate changes. assert_true: audio/mp4;codecs="mp4a.40.2" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html
new file mode 100644 (file)
index 0000000..2640a64
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "a-128k-44100Hz-1ch", "a-192k-44100Hz-1ch", "Tests mp4 audio-only bitrate changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..9f7f060
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 audio bitrate changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
new file mode 100644 (file)
index 0000000..8bd2b4d
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "av-384k-44100Hz-1ch-640x480-30fps-10kfr", "av-448k-44100Hz-1ch-640x480-30fps-10kfr", "Tests mp4 audio bitrate changes in multiplexed content.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize-expected.txt
new file mode 100644 (file)
index 0000000..fd7b61e
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 frame size changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html
new file mode 100644 (file)
index 0000000..645e8ae
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "av-384k-44100Hz-1ch-320x240-30fps-10kfr", "av-384k-44100Hz-1ch-640x480-30fps-10kfr", "Tests mp4 frame size changes in multiplexed content.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..6d609be
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 video bitrate changes in multiplexed content. assert_true: video/mp4;codecs="avc1.4D4001,mp4a.40.2" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html
new file mode 100644 (file)
index 0000000..32df9d0
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "av-384k-44100Hz-1ch-640x480-30fps-10kfr", "av-640k-44100Hz-1ch-640x480-30fps-10kfr", "Tests mp4 video bitrate changes in multiplexed content.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..41f714e
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 video-only bitrate changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html
new file mode 100644 (file)
index 0000000..762d769
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "v-128k-320x240-30fps-10kfr", "v-256k-320x240-30fps-10kfr", "Tests mp4 video-only bitrate changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate-expected.txt
new file mode 100644 (file)
index 0000000..010ecb5
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 video-only frame rate changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html
new file mode 100644 (file)
index 0000000..3a2a355
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "v-128k-320x240-24fps-8kfr", "v-128k-320x240-30fps-10kfr", "Tests mp4 video-only frame rate changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize-expected.txt
new file mode 100644 (file)
index 0000000..590d4ea
--- /dev/null
@@ -0,0 +1,3 @@
+FAIL Tests mp4 video-only frame size changes. assert_true: video/mp4;codecs="avc1.4D4001" is supported. expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html
new file mode 100644 (file)
index 0000000..6dbf94c
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("mp4", "v-128k-320x240-30fps-10kfr", "v-128k-640x480-30fps-10kfr", "Tests mp4 video-only frame size changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..8b4beca
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm audio-only bitrate changes. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html
new file mode 100644 (file)
index 0000000..6fe23d4
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "a-128k-44100Hz-1ch", "a-192k-44100Hz-1ch", "Tests webm audio-only bitrate changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..b0e64d7
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm audio bitrate changes in multiplexed content. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html
new file mode 100644 (file)
index 0000000..f198c71
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "av-384k-44100Hz-1ch-640x480-30fps-10kfr", "av-448k-44100Hz-1ch-640x480-30fps-10kfr", "Tests webm audio bitrate changes in multiplexed content.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize-expected.txt
new file mode 100644 (file)
index 0000000..c74e0b1
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm frame size changes in multiplexed content. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html
new file mode 100644 (file)
index 0000000..81c33f1
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "av-384k-44100Hz-1ch-320x240-30fps-10kfr", "av-384k-44100Hz-1ch-640x480-30fps-10kfr", "Tests webm frame size changes in multiplexed content.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..6f78945
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm video bitrate changes in multiplexed content. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html
new file mode 100644 (file)
index 0000000..71178bc
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "av-384k-44100Hz-1ch-640x480-30fps-10kfr", "av-640k-44100Hz-1ch-640x480-30fps-10kfr", "Tests webm video bitrate changes in multiplexed content.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate-expected.txt
new file mode 100644 (file)
index 0000000..82c70bd
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm video-only bitrate changes. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html
new file mode 100644 (file)
index 0000000..b277ab5
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "v-128k-320x240-30fps-10kfr", "v-256k-320x240-30fps-10kfr", "Tests webm video-only bitrate changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate-expected.txt
new file mode 100644 (file)
index 0000000..056af61
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm video-only frame rate changes. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html
new file mode 100644 (file)
index 0000000..48dffd9
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "v-128k-320x240-24fps-8kfr", "v-128k-320x240-30fps-10kfr", "Tests webm video-only frame rate changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize-expected.txt
new file mode 100644 (file)
index 0000000..5a60504
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Tests webm video-only frame size changes. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html b/LayoutTests/http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html
new file mode 100644 (file)
index 0000000..4aee0d1
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("webm", "v-128k-320x240-30fps-10kfr", "v-128k-640x480-30fps-10kfr", "Tests webm video-only frame size changes.");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-changes.js b/LayoutTests/http/tests/media/media-source/mediasource-config-changes.js
new file mode 100644 (file)
index 0000000..f834248
--- /dev/null
@@ -0,0 +1,60 @@
+function appendBuffer(test, sourceBuffer, data)
+{
+    test.expectEvent(sourceBuffer, "update");
+    test.expectEvent(sourceBuffer, "updateend");
+    sourceBuffer.appendBuffer(data);
+}
+
+function mediaSourceConfigChangeTest(directory, idA, idB, description)
+{
+    var manifestFilenameA = directory + "/test-" + idA + "-manifest.json";
+    var manifestFilenameB = directory + "/test-" + idB + "-manifest.json";
+    mediasource_test(function(test, mediaElement, mediaSource)
+    {
+        mediaElement.pause();
+        test.failOnEvent(mediaElement, 'error');
+        test.endOnEvent(mediaElement, 'ended');
+
+        MediaSourceUtil.fetchManifestAndData(test, manifestFilenameA, function(typeA, dataA)
+        {
+            MediaSourceUtil.fetchManifestAndData(test, manifestFilenameB, function(typeB, dataB)
+            {
+                assert_equals(typeA, typeB, "Media format types match");
+
+                var sourceBuffer = mediaSource.addSourceBuffer(typeA);
+
+                appendBuffer(test, sourceBuffer, dataA);
+
+                test.waitForExpectedEvents(function()
+                {
+                    // Add the second buffer starting at 0.5 second.
+                    sourceBuffer.timestampOffset = 0.5;
+                    appendBuffer(test, sourceBuffer, dataB);
+                });
+
+                test.waitForExpectedEvents(function()
+                {
+                    // Add the first buffer starting at 1 second.
+                    sourceBuffer.timestampOffset = 1;
+                    appendBuffer(test, sourceBuffer, dataA);
+                });
+
+                test.waitForExpectedEvents(function()
+                {
+                    // Add the second buffer starting at 1.5 second.
+                    sourceBuffer.timestampOffset = 1.5;
+                    appendBuffer(test, sourceBuffer, dataB);
+                });
+
+                test.waitForExpectedEvents(function()
+                {
+                    // Truncate the presentation to a duration of 2 seconds.
+                    mediaSource.duration = 2;
+                    mediaSource.endOfStream();
+
+                    mediaElement.play();
+                });
+            });
+        });
+    }, description, { timeout: 10000 } );
+};
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported-expected.txt
new file mode 100644 (file)
index 0000000..d5e0c60
--- /dev/null
@@ -0,0 +1,5 @@
+
+PASS Test invalid types 
+PASS Test valid WebM types 
+FAIL Test valid MP4 types assert_true: Type "video/mp4;codecs="avc1.4d001e"" supported expected true got false
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported.html b/LayoutTests/http/tests/media/media-source/mediasource-is-type-supported.html
new file mode 100644 (file)
index 0000000..ac4fca5
--- /dev/null
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          test(function ()
+          {
+              var invalidTypes = [
+                  // Invalid MIME format.
+                  'video',
+                  'video/',
+                  'video/webm',
+                  'video/webm;',
+                  'video/webm;codecs',
+                  'video/webm;codecs=',
+                  'video/webm;codecs="',
+                  'video/webm;codecs=""',
+                  'video/webm;codecs=","',
+
+                  // Mismatch between major type and codec ID
+                  'audio/webm;codecs="vp8"',
+                  'audio/mp4;codecs="avc1.4d001e"',
+
+                  // Mismatch between minor type and codec ID.
+                  'audio/mp4;codecs="vorbis"',
+                  'audio/webm;codecs="mp4a.40.2"',
+                  'video/mp4;codecs="vp8"',
+                  'video/webm;codecs="mp4a.40.2"',
+
+                  // Invalid codec IDs.
+                  'audio/webm;codecs="mp4a"',
+                  'audio/webm;codecs="mp4a.40"',
+                  'audio/webm;codecs="mp4a.40."',
+                  'audio/mp4;codecs="mp4a.67.3"'
+              ];
+
+              for (var i = 0; i < invalidTypes.length; ++i) {
+                assert_false(MediaSource.isTypeSupported(invalidTypes[i]), "Type \"" + invalidTypes[i] + "\" not supported");
+              }
+          }, "Test invalid types");
+
+          test(function ()
+          {
+              var validTypes = [
+                    'video/webm;codecs="vp8"',
+                    'video/webm;codecs="vorbis"',
+                    'video/webm;codecs="vp8,vorbis"',
+                    'video/webm;codecs="vorbis, vp8"',
+                    'audio/webm;codecs="vorbis"',
+              ];
+
+              for (var i = 0; i < validTypes.length; ++i) {
+                assert_true(MediaSource.isTypeSupported(validTypes[i]), "Type \"" + validTypes[i] + "\" supported");
+              }
+          }, "Test valid WebM types");
+
+          test(function ()
+          {
+              var validTypes = [
+                    'video/mp4;codecs="avc1.4d001e"', // H.264 Main Profile level 3.0
+                    'video/mp4;codecs="avc1.42001e"', // H.264 Baseline Profile level 3.0
+                    'audio/mp4;codecs="mp4a.40.2"',   // MPEG4 AAC-LC
+                    'audio/mp4;codecs="mp4a.40.5"',   // MPEG4 HE-AAC
+                    'audio/mp4;codecs="mp4a.67"',     // MPEG2 AAC-LC
+                    'video/mp4;codecs="mp4a.40.2"',
+                    'video/mp4;codecs="avc1.4d001e,mp4a.40.2"',
+                    'video/mp4;codecs="mp4a.40.2 , avc1.4d001e "',
+                    'video/mp4;codecs="avc1.4d001e,mp4a.40.5"',
+                    'video/mp4;codecs="avc1.4d001e,mp4a.40.5"',
+              ];
+
+              for (var i = 0; i < validTypes.length; ++i) {
+                assert_true(MediaSource.isTypeSupported(validTypes[i]), "Type \"" + validTypes[i] + "\" supported");
+              }
+          }, "Test valid MP4 types");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-multiple-attach-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-multiple-attach-expected.txt
new file mode 100644 (file)
index 0000000..e9f7822
--- /dev/null
@@ -0,0 +1,4 @@
+PASS Test exactly one succeeds when two MediaElements attach to same MediaSource 
+PASS Test that MediaSource can reattach if closed first 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-multiple-attach.html b/LayoutTests/http/tests/media/media-source/mediasource-multiple-attach.html
new file mode 100644 (file)
index 0000000..6cc7bdc
--- /dev/null
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          function twoMediaElementTest(testFunction, description)
+          {
+              media_test(function(test)
+              {
+                  var firstMediaTag = document.createElement('video');
+                  var secondMediaTag = document.createElement('video');
+                  document.body.appendChild(firstMediaTag);
+                  document.body.appendChild(secondMediaTag);
+
+                  // Overload done() so that elements added to the document can be
+                  // removed.
+                  var removeMediaElements = true;
+                  var oldTestDone = test.done.bind(test);
+                  test.done = function()
+                  {
+                      if (removeMediaElements) {
+                          document.body.removeChild(secondMediaTag);
+                          document.body.removeChild(firstMediaTag);
+                          removeMediaElements = false;
+                      }
+                      oldTestDone();
+                  };
+
+                  testFunction(test, firstMediaTag, secondMediaTag);
+              }, description);
+          }
+
+          twoMediaElementTest(function(test, firstMediaTag, secondMediaTag)
+          {
+              // When attachment of mediaSource to two MediaElements is done
+              // without an intervening stable state, exactly one of the two
+              // MediaElements should successfully attach, and the other one
+              // should get error event due to mediaSource already in 'open'
+              // readyState.
+              var mediaSource = new MediaSource();
+              var mediaSourceURL = URL.createObjectURL(mediaSource);
+              var gotSourceOpen = false;
+              var gotError = false;
+              var doneIfFinished = test.step_func(function()
+              {
+                  if (gotSourceOpen && gotError)
+                      test.done();
+              });
+              var errorHandler = test.step_func(function(e)
+              {
+                  firstMediaTag.removeEventListener('error', errorHandler);
+                  secondMediaTag.removeEventListener('error', errorHandler);
+
+                  var eventTarget = e.target;
+                  var otherTarget;
+                  if (eventTarget == firstMediaTag) {
+                      otherTarget = secondMediaTag;
+                  } else {
+                      assert_equals(eventTarget, secondMediaTag, 'Error target check');
+                      otherTarget = firstMediaTag;
+                  }
+
+                  assert_true(eventTarget.error != null, 'Error state on one tag');
+                  assert_equals(eventTarget.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, 'Expected error code');
+                  assert_equals(otherTarget.error, null, 'No error on other tag');
+
+                  assert_equals(eventTarget.networkState, HTMLMediaElement.NETWORK_NO_SOURCE,
+                                'Tag with error state networkState');
+                  assert_equals(otherTarget.networkState, HTMLMediaElement.NETWORK_LOADING,
+                                'Tag without error state networkState');
+
+                  gotError = true;
+                  doneIfFinished();
+              });
+
+              test.expectEvent(mediaSource, 'sourceopen', 'An attachment succeeded');
+              firstMediaTag.addEventListener('error', errorHandler);
+              secondMediaTag.addEventListener('error', errorHandler);
+
+              firstMediaTag.src = mediaSourceURL;
+              secondMediaTag.src = mediaSourceURL;
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, 'open', 'Source is opened');
+                  gotSourceOpen = true;
+                  doneIfFinished();
+              });
+          }, 'Test exactly one succeeds when two MediaElements attach to same MediaSource');
+
+          mediasource_test(function(test, mediaElement, mediaSource) {
+              assert_equals(mediaSource.readyState, 'open', 'Source open');
+              // Set the tag's src attribute.  This should close mediaSource,
+              // reattach it to the tag, and initiate source reopening.
+              test.expectEvent(mediaSource, 'sourceopen', 'Source attached again');
+              mediaElement.src = URL.createObjectURL(mediaSource);
+              assert_equals(mediaSource.readyState, 'closed', 'Source closed');
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, 'open', 'Source reopened');
+                  test.done();
+              });
+          }, 'Test that MediaSource can reattach if closed first');
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-play-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-play-expected.txt
new file mode 100644 (file)
index 0000000..f2c26a0
--- /dev/null
@@ -0,0 +1,3 @@
+PASS Test normal playback case with MediaSource API 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-play.html b/LayoutTests/http/tests/media/media-source/mediasource-play.html
new file mode 100644 (file)
index 0000000..078e66a
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              test.failOnEvent(mediaElement, 'error');
+              test.endOnEvent(mediaElement, 'ended');
+
+              var mediaType = 'video/webm;codecs="vp8,vorbis"';
+              var mediaURL = '/media/resources/media-source/webm/test.webm';
+              var sourceBuffer = mediaSource.addSourceBuffer(mediaType);
+
+              MediaSourceUtil.loadBinaryData(test, mediaURL, function(data)
+              {
+                  sourceBuffer.addEventListener('updateend', test.step_func(function()
+                  {
+                      mediaSource.duration = 1;
+                      mediaSource.endOfStream();
+                      mediaElement.play();
+                  }));
+                  sourceBuffer.appendBuffer(data);
+              });
+          }, "Test normal playback case with MediaSource API");
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt b/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-expected.txt
new file mode 100644 (file)
index 0000000..f9bd691
--- /dev/null
@@ -0,0 +1,4 @@
+PASS Test SourceBufferList event dispatching. 
+PASS Test that only 1 removesourcebuffer event fires on each SourceBufferList when the MediaSource closes. 
+
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist.html b/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist.html
new file mode 100644 (file)
index 0000000..1d487a1
--- /dev/null
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+
+        <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+          function verifySourceBufferLists(mediaSource, expected)
+          {
+              assert_equals(mediaSource.sourceBuffers.length, expected.length, "sourceBuffers length");
+              assert_equals(mediaSource.activeSourceBuffers.length, expected.length, "activeSourceBuffers length");
+              for (var i = 0; i < expected.length; ++i) {
+                assert_equals(mediaSource.sourceBuffers[i], expected[i], "Verifying mediaSource.sourceBuffers[" + i + "]");
+                assert_equals(mediaSource.activeSourceBuffers[i], expected[i], "Verifying mediaSource.activeSourceBuffers[" + i + "]");
+              }
+          }
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              test.expectEvent(mediaSource.sourceBuffers, "addsourcebuffer", "sourceBuffers");
+              test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer", "activeSourceBuffers");
+              var sourceBufferA = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
+              var sourceBufferB = null;
+
+              test.waitForExpectedEvents(function()
+              {
+                  test.expectEvent(mediaSource.sourceBuffers, "addsourcebuffer", "sourceBuffers");
+                  test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer", "activeSourceBuffers");
+                  sourceBufferB = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
+
+                  verifySourceBufferLists(mediaSource, [sourceBufferA, sourceBufferB]);
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuffer", "activeSourceBuffers");
+                  test.expectEvent(mediaSource.sourceBuffers, "removesourcebuffer", "sourceBuffers");
+                  mediaSource.removeSourceBuffer(sourceBufferA);
+
+                  verifySourceBufferLists(mediaSource, [sourceBufferB]);
+
+                  test.expectEvent(mediaSource.sourceBuffers, "addsourcebuffer", "sourceBuffers");
+                  test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer", "activeSourceBuffers");
+                  sourceBufferA = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
+
+                  verifySourceBufferLists(mediaSource, [sourceBufferB, sourceBufferA]);
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  test.done();
+              });
+          }, "Test SourceBufferList event dispatching.");
+
+          mediasource_test(function(test, mediaElement, mediaSource)
+          {
+              test.expectEvent(mediaSource.sourceBuffers, "addsourcebuffer", "sourceBuffers");
+              test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer", "activeSourceBuffers");
+              test.expectEvent(mediaSource.sourceBuffers, "addsourcebuffer", "sourceBuffers");
+              test.expectEvent(mediaSource.activeSourceBuffers, "addsourcebuffer", "activeSourceBuffers");
+              var sourceBufferA = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
+              var sourceBufferB = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
+
+              verifySourceBufferLists(mediaSource, [sourceBufferA, sourceBufferB]);
+
+              test.waitForExpectedEvents(function()
+              {
+                  verifySourceBufferLists(mediaSource, [sourceBufferA, sourceBufferB]);
+
+                  // Force the media element to close the MediaSource object.
+                  test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuffer", "activeSourceBuffers");
+                  test.expectEvent(mediaSource.sourceBuffers, "removesourcebuffer", "sourceBuffers");
+                  test.expectEvent(mediaSource, "sourceclose", "mediaSource closing");
+                  mediaElement.src = "";
+              });
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, "closed", "mediaSource is closed.");
+
+                  verifySourceBufferLists(mediaSource, []);
+                  test.done();
+              });
+          }, "Test that only 1 removesourcebuffer event fires on each SourceBufferList when the MediaSource closes.");
+
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-util.js b/LayoutTests/http/tests/media/media-source/mediasource-util.js
new file mode 100644 (file)
index 0000000..456f012
--- /dev/null
@@ -0,0 +1,229 @@
+(function(window) {
+    EventExpectationsManager = function(test)
+    {
+        this.test_ = test;
+        this.eventTargetList_ = [];
+        this.waitCallbacks_ = [];
+    };
+
+    EventExpectationsManager.prototype.expectEvent = function(object, eventName, description)
+    {
+        var eventInfo = { 'target': object, 'type': eventName, 'description': description};
+        var expectations = this.getExpectations_(object);
+        expectations.push(eventInfo);
+
+        var t = this;
+        var waitHandler = this.test_.step_func(function() { t.handleWaitCallback_(); });
+        var eventHandler = this.test_.step_func(function(event)
+        {
+            object.removeEventListener(eventName, eventHandler);
+            var expected = expectations[0];
+            assert_equals(event.target, expected.target, "Event target match.");
+            assert_equals(event.type, expected.type, "Event types match.");
+            assert_equals(eventInfo.description, expected.description, "Descriptions match for '" +  event.type + "'.");
+
+            expectations.shift(1);
+            if (t.waitCallbacks_.length > 0)
+                setTimeout(waitHandler, 0);
+        });
+        object.addEventListener(eventName, eventHandler);
+    };
+
+    EventExpectationsManager.prototype.waitForExpectedEvents = function(callback)
+    {
+        this.waitCallbacks_.push(callback);
+        setTimeout(this.handleWaitCallback_.bind(this), 0);
+    };
+
+    EventExpectationsManager.prototype.expectingEvents = function()
+    {
+        for (var i = 0; i < this.eventTargetList_.length; ++i) {
+            if (this.eventTargetList_[i].expectations.length > 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    EventExpectationsManager.prototype.handleWaitCallback_ = function()
+    {
+        if (this.waitCallbacks_.length == 0 || this.expectingEvents())
+            return;
+        var callback = this.waitCallbacks_.shift(1);
+        callback();
+    };
+
+    EventExpectationsManager.prototype.getExpectations_ = function(target)
+    {
+        for (var i = 0; i < this.eventTargetList_.length; ++i) {
+            var info = this.eventTargetList_[i];
+            if (info.target == target) {
+                return info.expectations;
+            }
+        }
+        var expectations = [];
+        this.eventTargetList_.push({ 'target': target, 'expectations': expectations });
+        return expectations;
+    };
+
+    function loadData_(test, url, callback, isBinary)
+    {
+        var request = new XMLHttpRequest();
+        request.open("GET", url, true);
+        if (isBinary) {
+            request.responseType = 'arraybuffer';
+        }
+        request.onload = test.step_func(function(event)
+        {
+            if (request.status != 200) {
+                assert_unreached("Unexpected status code : " + request.status);
+                return;
+            }
+            var response = request.response;
+            if (isBinary) {
+                response = new Uint8Array(response);
+            }
+            callback(response);
+        });
+        request.onerror = test.step_func(function(event)
+        {
+            assert_unreached("Unexpected error");
+        });
+        request.send();
+    }
+
+    function openMediaSource_(test, mediaTag, callback)
+    {
+        var mediaSource = new MediaSource();
+        var mediaSourceURL = URL.createObjectURL(mediaSource);
+
+        var eventHandler = test.step_func(onSourceOpen);
+        function onSourceOpen(event)
+        {
+            mediaSource.removeEventListener('sourceopen', eventHandler);
+            URL.revokeObjectURL(mediaSourceURL);
+            callback(mediaSource);
+        }
+
+        mediaSource.addEventListener('sourceopen', eventHandler);
+        mediaTag.src = mediaSourceURL;
+    }
+
+    var MediaSourceUtil = {};
+
+    MediaSourceUtil.loadTextData = function(test, url, callback)
+    {
+        loadData_(test, url, callback, false);
+    };
+
+    MediaSourceUtil.loadBinaryData = function(test, url, callback)
+    {
+        loadData_(test, url, callback, true);
+    };
+
+    MediaSourceUtil.fetchManifestAndData = function(test, manifestFilename, callback)
+    {
+        var baseURL = '/media/resources/media-source/';
+        var manifestURL = baseURL + manifestFilename;
+        MediaSourceUtil.loadTextData(test, manifestURL, function(manifestText)
+        {
+            var manifest = JSON.parse(manifestText);
+
+            assert_true(MediaSource.isTypeSupported(manifest.type), manifest.type + " is supported.");
+
+            var mediaURL = baseURL + manifest.url;
+            MediaSourceUtil.loadBinaryData(test, mediaURL, function(mediaData)
+            {
+                callback(manifest.type, mediaData);
+            });
+        });
+    };
+
+    function getFirstSupportedType(typeList)
+    {
+        for (var i = 0; i < typeList.length; ++i) {
+            if (MediaSource.isTypeSupported(typeList[i]))
+                return typeList[i];
+        }
+        return "";
+    }
+
+    var audioOnlyTypes = ['audio/webm;codecs="vorbis"', 'audio/mp4;codecs="mp4a.40.2"'];
+    var videoOnlyTypes = ['video/webm;codecs="vp8"', 'video/mp4;codecs="avc1.4D4001"'];
+    var audioVideoTypes = ['video/webm;codecs="vp8,vorbis"', 'video/mp4;codecs="mp4a.40.2"'];
+    MediaSourceUtil.AUDIO_ONLY_TYPE = getFirstSupportedType(audioOnlyTypes);
+    MediaSourceUtil.VIDEO_ONLY_TYPE = getFirstSupportedType(videoOnlyTypes);
+    MediaSourceUtil.AUDIO_VIDEO_TYPE = getFirstSupportedType(audioVideoTypes);
+
+    function addExtraTestMethods(test)
+    {
+        test.failOnEvent = function(object, eventName)
+        {
+            object.addEventListener(eventName, test.step_func(function(event)
+            {
+                assert_unreached("Unexpected event '" + eventName + "'");
+            }));
+        };
+
+        test.endOnEvent = function(object, eventName)
+        {
+            object.addEventListener(eventName, test.step_func(function(event) { test.done(); }));
+        };
+
+        test.eventExpectations_ = new EventExpectationsManager(test);
+        test.expectEvent = function(object, eventName, description)
+        {
+            test.eventExpectations_.expectEvent(object, eventName, description);
+        };
+
+        test.waitForExpectedEvents = function(callback)
+        {
+            test.eventExpectations_.waitForExpectedEvents(callback);
+        };
+
+        var oldTestDone = test.done.bind(test);
+        test.done = function()
+        {
+            if (test.status == test.PASS)
+                assert_false(test.eventExpectations_.expectingEvents(), "No pending event expectations.");
+            oldTestDone();
+        };
+    };
+
+    window['MediaSourceUtil'] = MediaSourceUtil;
+    window['media_test'] = function(testFunction, description, options)
+    {
+        options = options || {};
+        return async_test(function(test)
+        {
+            addExtraTestMethods(test);
+            testFunction(test);
+        }, description, options);
+    };
+    window['mediasource_test'] = function(testFunction, description, options)
+    {
+        return media_test(function(test)
+        {
+            var mediaTag = document.createElement("video");
+            document.body.appendChild(mediaTag);
+
+            // Overload done() so that element added to the document can be removed.
+            test.removeMediaElement_ = true;
+            var oldTestDone = test.done.bind(test);
+            test.done = function()
+            {
+                if (test.removeMediaElement_) {
+                    document.body.removeChild(mediaTag);
+                    test.removeMediaElement_ = false;
+                }
+                oldTestDone();
+            };
+
+            openMediaSource_(test, mediaTag, function(mediaSource)
+            {
+                testFunction(test, mediaTag, mediaSource);
+            });
+        }, description, options);
+
+    };
+})(window);
index b03dbe4..df6cbb8 100644 (file)
@@ -2,7 +2,7 @@ Tests MediaSource, SourceBuffer, and SourceBufferList objects.
 
 EVENT(webkitsourceopen)
 Test MediaSource object type
-EXPECTED (mediaSource == '[object MediaSource]') OK
+EXPECTED (mediaSource == '[object WebKitMediaSource]') OK
 EXPECTED (mediaSource instanceof window.WebKitMediaSource == 'true') OK
 
 Add a SourceBuffer
@@ -11,7 +11,7 @@ RUN(segmentHelper.addSourceBuffer())
 EXPECTED (mediaSource.sourceBuffers.length == '1') OK
 
 Test SourceBufferList object type:
-EXPECTED (mediaSource.sourceBuffers == '[object SourceBufferList]') OK
+EXPECTED (mediaSource.sourceBuffers == '[object WebKitSourceBufferList]') OK
 EXPECTED (mediaSource.sourceBuffers instanceof window.WebKitSourceBufferList == 'true') OK
 
 Test SourceBuffer object type
@@ -39,7 +39,7 @@ EXPECTED (mediaSource.sourceBuffers[0].buffered.end(1) > '5') OK
 Remove SourceBuffer
 RUN(mediaSource.removeSourceBuffer(segmentHelper.sourceBuffer))
 EXPECTED (mediaSource.sourceBuffers.length == '0') OK
-EXPECTED (mediaSource.sourceBuffers == '[object SourceBufferList]') OK
+EXPECTED (mediaSource.sourceBuffers == '[object WebKitSourceBufferList]') OK
 
 Test that append() throws an error after SourceBuffer has been removed.
 Got expected exception Error: InvalidStateError: DOM Exception 11
diff --git a/LayoutTests/http/tests/media/resources/media-source/generate-config-change-tests.py b/LayoutTests/http/tests/media/resources/media-source/generate-config-change-tests.py
new file mode 100755 (executable)
index 0000000..4edb925
--- /dev/null
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+This is a script that generates the content and HTML files for Media Source
+codec config change LayoutTests.
+"""
+import json
+import os
+
+DURATION = 2
+MEDIA_FORMATS = ['webm', 'mp4']
+ENCODE_SETTINGS = [
+    ## Video-only files
+    # Frame rate changes
+    {'fs': '320x240', 'fr': 24, 'kfr': 8, 'c': '#ff0000', 'vbr': 128, 'abr': 0, 'asr': 0, 'ach': 0, 'afreq': 0},
+    {'fs': '320x240', 'fr': 30, 'kfr': 10, 'c': '#ff0000', 'vbr': 128, 'abr': 0, 'asr': 0, 'ach': 0, 'afreq': 0},
+    # Frame size change
+    {'fs': '640x480', 'fr': 30, 'kfr': 10, 'c': '#00ff00', 'vbr': 128, 'abr': 0, 'asr': 0, 'ach': 0, 'afreq': 0},
+    # Bitrate change
+    {'fs': '320x240', 'fr': 30, 'kfr': 10, 'c': '#ff00ff', 'vbr': 256, 'abr': 0, 'asr': 0, 'ach': 0, 'afreq': 0},
+
+    ## Audio-only files
+    # Bitrate/Codebook changes
+    {'fs': '0x0', 'fr': 0, 'kfr': 0, 'c': '#000000', 'vbr': 0, 'abr': 128, 'asr': 44100, 'ach': 1, 'afreq': 2000},
+    {'fs': '0x0', 'fr': 0, 'kfr': 0, 'c': '#000000', 'vbr': 0, 'abr': 192, 'asr': 44100, 'ach': 1, 'afreq': 4000},
+
+    ## Audio-Video files
+    # Frame size change.
+    {'fs': '320x240', 'fr': 30, 'kfr': 10, 'c': '#ff0000', 'vbr': 256, 'abr': 128, 'asr': 44100, 'ach': 1, 'afreq': 2000},
+    {'fs': '640x480', 'fr': 30, 'kfr': 10, 'c': '#00ff00', 'vbr': 256, 'abr': 128, 'asr': 44100, 'ach': 1, 'afreq': 2000},
+    # Audio bitrate change.
+    {'fs': '640x480', 'fr': 30, 'kfr': 10, 'c': '#00ff00', 'vbr': 256, 'abr': 192, 'asr': 44100, 'ach': 1, 'afreq': 4000},
+    # Video bitrate change.
+    {'fs': '640x480', 'fr': 30, 'kfr': 10, 'c': '#00ffff', 'vbr': 512, 'abr': 128, 'asr': 44100, 'ach': 1, 'afreq': 2000},
+]
+
+CONFIG_CHANGE_TESTS = [
+    ["v-framerate", 0, 1, "Tests %s video-only frame rate changes."],
+    ["v-framesize", 1, 2, "Tests %s video-only frame size changes."],
+    ["v-bitrate", 1, 3, "Tests %s video-only bitrate changes."],
+    ["a-bitrate", 4, 5, "Tests %s audio-only bitrate changes."],
+    ["av-framesize", 6, 7, "Tests %s frame size changes in multiplexed content."],
+    ["av-audio-bitrate", 7, 8, "Tests %s audio bitrate changes in multiplexed content."],
+    ["av-video-bitrate", 7, 9, "Tests %s video bitrate changes in multiplexed content."]
+]
+
+CODEC_INFO = {
+    "mp4": {"audio": "mp4a.40.2", "video": "avc1.4D4001"},
+    "webm": {"audio": "vorbis", "video": "vp8"}
+}
+
+HTML_TEMPLATE = """<!DOCTYPE html>
+<html>
+    <head>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="mediasource-util.js"></script>
+        <script src="mediasource-config-changes.js"></script>
+        <link rel="stylesheet" href="/w3c/resources/testharness.css">
+    </head>
+    <body>
+        <div id="log"></div>
+        <script>
+            mediaSourceConfigChangeTest("%(media_format)s", "%(idA)s", "%(idB)s", "%(description)s");
+        </script>
+    </body>
+</html>
+"""
+
+def run(cmd_line):
+    os.system(" ".join(cmd_line))
+
+def generate_manifest(filename, media_filename, media_format, has_audio, has_video):
+    major_type = "audio"
+    if has_video:
+        major_type = "video"
+
+    codecs = []
+    if has_video:
+        codecs.append(CODEC_INFO[media_format]["video"])
+
+    if has_audio:
+        codecs.append(CODEC_INFO[media_format]["audio"])
+
+    mimetype = "%s/%s;codecs=\"%s\"" % (major_type, media_format, ",".join(codecs))
+
+    manifest = { 'url': media_filename, 'type': mimetype}
+
+    f = open(filename, "wb")
+    f.write(json.dumps(manifest, indent=4, separators=(',', ': ')))
+    f.close()
+
+def generate_test_html(media_format, config_change_tests, encoding_ids):
+    for test_info in config_change_tests:
+        filename = "../../media-source/mediasource-config-change-%s-%s.html" % (media_format, test_info[0])
+        html = HTML_TEMPLATE % {'media_format': media_format,
+                                 'idA': encoding_ids[test_info[1]],
+                                 'idB': encoding_ids[test_info[2]],
+                                 'description':  test_info[3] % (media_format)}
+        f = open(filename, "wb")
+        f.write(html)
+        f.close()
+
+
+def main():
+    encoding_ids = []
+
+    for media_format in MEDIA_FORMATS:
+        run(["mkdir ", media_format])
+
+        for settings in ENCODE_SETTINGS:
+            video_bitrate = settings['vbr']
+            has_video = (video_bitrate > 0)
+
+            audio_bitrate = settings['abr']
+            has_audio = (audio_bitrate > 0)
+            bitrate = video_bitrate + audio_bitrate
+
+            frame_size = settings['fs']
+            frame_rate = settings['fr']
+            keyframe_rate = settings['kfr']
+            color = settings['c']
+
+            sample_rate = settings['asr']
+            channels = settings['ach']
+            frequency = settings['afreq']
+
+            cmdline = ["ffmpeg", "-y"]
+
+            id_prefix = ""
+            id_params = ""
+            if has_audio:
+                id_prefix += "a"
+                id_params += "-%sHz-%sch" % (sample_rate, channels)
+
+                channel_layout = "FC"
+                sin_func = "sin(%s*2*PI*t)" % frequency
+                func = sin_func
+                if channels == 2:
+                    channel_layout += "|BC"
+                    func += "|" + sin_func
+
+                cmdline += ["-f", "lavfi", "-i", "aevalsrc=\"%s:s=%s:c=%s:d=%s\"" % (func, sample_rate, channel_layout, DURATION)]
+
+            if has_video:
+                id_prefix += "v"
+                id_params += "-%s-%sfps-%skfr" % (frame_size, frame_rate, keyframe_rate)
+
+                cmdline += ["-f", "lavfi", "-i", "color=%s:duration=%s:size=%s:rate=%s" % (color, DURATION, frame_size, frame_rate)]
+
+            if has_audio:
+                cmdline += ["-b:a", "%sk" % audio_bitrate]
+
+            if has_video:
+                cmdline += ["-b:v", "%sk" % video_bitrate]
+                cmdline += ["-keyint_min", "%s" % keyframe_rate]
+                cmdline += ["-g", "%s" % keyframe_rate]
+
+
+                textOverlayInfo = "'drawtext=fontfile=Mono:fontsize=32:text=Time\\\\:\\\\ %{pts}"
+                textOverlayInfo += ",drawtext=fontfile=Mono:fontsize=32:y=32:text=Size\\\\:\\\\ %s" % (frame_size)
+                textOverlayInfo += ",drawtext=fontfile=Mono:fontsize=32:y=64:text=Bitrate\\\\:\\\\ %s" % (bitrate)
+                textOverlayInfo += ",drawtext=fontfile=Mono:fontsize=32:y=96:text=FrameRate\\\\:\\\\ %s" % (frame_rate)
+                textOverlayInfo += ",drawtext=fontfile=Mono:fontsize=32:y=128:text=KeyFrameRate\\\\:\\\\ %s" % (keyframe_rate)
+
+                if has_audio:
+                    textOverlayInfo += ",drawtext=fontfile=Mono:fontsize=32:y=160:text=SampleRate\\\\:\\\\ %s" % (sample_rate)
+                    textOverlayInfo += ",drawtext=fontfile=Mono:fontsize=32:y=192:text=Channels\\\\:\\\\ %s" % (channels)
+
+                textOverlayInfo += "'"
+                cmdline += ["-vf", textOverlayInfo]
+
+            encoding_id = "%s-%sk%s" % (id_prefix, bitrate, id_params)
+
+            if len(encoding_ids) < len(ENCODE_SETTINGS):
+                encoding_ids.append(encoding_id)
+
+            filename_base = "%s/test-%s" % (media_format, encoding_id)
+            media_filename = filename_base + "." + media_format
+            manifest_filename = filename_base + "-manifest.json"
+
+            cmdline.append(media_filename)
+            run(cmdline)
+
+            # Remux file so it conforms to MSE bytestream requirements.
+            if media_format == "webm":
+                tmp_filename = media_filename + ".tmp"
+                run(["mse_webm_remuxer", media_filename, tmp_filename])
+                run(["mv", tmp_filename, media_filename])
+            elif media_format == "mp4":
+                run(["MP4Box", "-dash", "250", "-rap", media_filename])
+                run(["mv", filename_base + "_dash.mp4", media_filename])
+                run(["rm", filename_base + "_dash.mpd"])
+
+            generate_manifest(manifest_filename, media_filename, media_format, has_audio, has_video)
+        generate_test_html(media_format, CONFIG_CHANGE_TESTS, encoding_ids)
+
+if '__main__' == __name__:
+    main()
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-a-128k-44100Hz-1ch-manifest.json
new file mode 100644 (file)
index 0000000..f3caa46
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-a-128k-44100Hz-1ch.mp4",
+    "type": "audio/mp4;codecs=\"mp4a.40.2\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-a-192k-44100Hz-1ch-manifest.json
new file mode 100644 (file)
index 0000000..41a6f33
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-a-192k-44100Hz-1ch.mp4",
+    "type": "audio/mp4;codecs=\"mp4a.40.2\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..7731e31
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001,mp4a.40.2\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..78ded61
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001,mp4a.40.2\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..ba46349
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001,mp4a.40.2\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..24da9b4
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001,mp4a.40.2\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-320x240-24fps-8kfr-manifest.json
new file mode 100644 (file)
index 0000000..a31b6d0
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-v-128k-320x240-24fps-8kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-320x240-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..3e02844
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-v-128k-320x240-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-128k-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..10c4f4b
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-v-128k-640x480-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/mp4/test-v-256k-320x240-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..42d3e1e
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "mp4/test-v-256k-320x240-30fps-10kfr.mp4",
+    "type": "video/mp4;codecs=\"avc1.4D4001\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-a-128k-44100Hz-1ch-manifest.json
new file mode 100644 (file)
index 0000000..524da81
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-a-128k-44100Hz-1ch.webm",
+    "type": "audio/webm;codecs=\"vorbis\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-a-192k-44100Hz-1ch-manifest.json
new file mode 100644 (file)
index 0000000..7f2fa1e
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-a-192k-44100Hz-1ch.webm",
+    "type": "audio/webm;codecs=\"vorbis\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..af9f07a
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8,vorbis\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..f7ec86b
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-av-384k-44100Hz-1ch-640x480-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8,vorbis\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..96a59db
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-av-448k-44100Hz-1ch-640x480-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8,vorbis\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..86723b3
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-av-640k-44100Hz-1ch-640x480-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8,vorbis\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-320x240-24fps-8kfr-manifest.json
new file mode 100644 (file)
index 0000000..00e103a
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-v-128k-320x240-24fps-8kfr.webm",
+    "type": "video/webm;codecs=\"vp8\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-320x240-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..fdeeb40
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-v-128k-320x240-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-v-128k-640x480-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..4e30460
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-v-128k-640x480-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8\""
+}
\ No newline at end of file
diff --git a/LayoutTests/http/tests/media/resources/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json b/LayoutTests/http/tests/media/resources/media-source/webm/test-v-256k-320x240-30fps-10kfr-manifest.json
new file mode 100644 (file)
index 0000000..3470674
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "url": "webm/test-v-256k-320x240-30fps-10kfr.webm",
+    "type": "video/webm;codecs=\"vp8\""
+}
\ No newline at end of file
index 4db256e..8ac490f 100644 (file)
@@ -210,6 +210,10 @@ set(WebCore_IDL_FILES
     Modules/mediasource/MediaSource.idl
     Modules/mediasource/SourceBuffer.idl
     Modules/mediasource/SourceBufferList.idl
+    Modules/mediasource/URLMediaSource.idl
+    Modules/mediasource/WebKitMediaSource.idl
+    Modules/mediasource/WebKitSourceBuffer.idl
+    Modules/mediasource/WebKitSourceBufferList.idl
 
     Modules/mediastream/MediaStream.idl
     Modules/mediastream/MediaStreamEvent.idl
@@ -1462,6 +1466,7 @@ set(WebCore_SOURCES
     html/NumberInputType.cpp
     html/PasswordInputType.cpp
     html/PluginDocument.cpp
+    html/PublicURLManager.cpp
     html/RadioInputType.cpp
     html/RadioNodeList.cpp
     html/RangeInputType.cpp
index 3450d3f..21957e8 100644 (file)
@@ -1,3 +1,64 @@
+2013-09-18  Jer Noble  <jer.noble@apple.com>
+
+        Merge blink MediaSource changes since fork.
+        https://bugs.webkit.org/show_bug.cgi?id=118752
+
+        Rubber-stamped by Eric Carlson.
+
+        Tests: http/tests/media/media-source/mediasource-addsourcebuffer.html
+               http/tests/media/media-source/mediasource-append-buffer.html
+               http/tests/media/media-source/mediasource-buffered.html
+               http/tests/media/media-source/mediasource-closed.html
+               http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html
+               http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html
+               http/tests/media/media-source/mediasource-config-change-mp4-v-framesize.html
+               http/tests/media/media-source/mediasource-config-change-webm-a-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-webm-av-framesize.html
+               http/tests/media/media-source/mediasource-config-change-webm-av-video-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-webm-v-bitrate.html
+               http/tests/media/media-source/mediasource-config-change-webm-v-framerate.html
+               http/tests/media/media-source/mediasource-config-change-webm-v-framesize.html
+               http/tests/media/media-source/mediasource-is-type-supported.html
+               http/tests/media/media-source/mediasource-multiple-attach.html
+               http/tests/media/media-source/mediasource-play.html
+               http/tests/media/media-source/mediasource-sourcebufferlist.html
+
+        Add files to project. Fix compile errors exposed by enabling.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * Modules/mediasource/MediaSourceRegistry.cpp:
+        (WebCore::MediaSourceRegistry::lookupMediaSource):
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+        (WebCore::MediaPlayerPrivateAVFoundation::load):
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        (WebCore::MediaPlayerPrivateQTKit::load):
+        * platform/mac/MIMETypeRegistryMac.mm:
+        (WebCore::MIMETypeRegistry::isSupportedMediaSourceMIMEType):
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * DerivedSources.pri:
+        * GNUmakefile.list.am:
+
+        Merge
+        https://chromium.googlesource.com/chromium/blink/+/c38e2955db98a300a535b692869fea0e41501497
+        https://chromium.googlesource.com/chromium/blink/+/8568015e9bee1de7fccee28163f9e4a4b51f9baf
+        https://chromium.googlesource.com/chromium/blink/+/14417e8fa6294f4e7dbc1e0fac549398522b2f97
+        https://chromium.googlesource.com/chromium/blink/+/f43a5496f233102f8861a067a9cf8053c010d401
+        https://chromium.googlesource.com/chromium/blink/+/57771439806f7c6e6a272efb1ea72900f5f6a015
+        https://chromium.googlesource.com/chromium/blink/+/8c77a790a9d225194db0a8832399d0f9e1fa54ec
+        https://chromium.googlesource.com/chromium/blink/+/d33ae3fa7a8592e946503ed17f862a27c6d9dde1
+        https://chromium.googlesource.com/chromium/blink/+/1caaa9c51f06e1b9341d58c994f77fd59fcd236d
+        https://chromium.googlesource.com/chromium/blink/+/e95720393b0ebe67f19de39bb77cdf2926165512
+        https://chromium.googlesource.com/chromium/blink/+/bad2c1b4b70faec731b2ad3cc8a4ccf28de6cc38
+        https://chromium.googlesource.com/chromium/blink/+/a7873430c3d5c9373336c6f3993db3cb4228e9cd
+        https://chromium.googlesource.com/chromium/blink/+/508966d5e32360b3cec058f9fbae0014542fbc52
+        https://chromium.googlesource.com/chromium/blink/+/371dfe72f61ce6f73e6c242324da73c415d38be3
+
 2013-09-18  Andreas Kling  <akling@apple.com>
 
         CTTE: RenderBR always has an HTMLElement.
index 01f7429..880ec64 100644 (file)
 #include "JSMediaQueryList.cpp"
 #include "JSMediaQueryListListener.cpp"
 #if ENABLE(MEDIA_SOURCE)
-#include "JSMediaSource.cpp"
+#include "JSWebKitMediaSource.cpp"
 #endif
 #include "JSMessageChannel.cpp"
 #include "JSMessageEvent.cpp"
 #include "JSSharedWorker.cpp"
 #include "JSSharedWorkerGlobalScope.cpp"
 #if ENABLE(MEDIA_SOURCE)
-#include "JSSourceBuffer.cpp"
-#include "JSSourceBufferList.cpp"
+#include "JSWebKitSourceBuffer.cpp"
+#include "JSWebKitSourceBufferList.cpp"
 #endif
 #include "JSSQLError.cpp"
 #include "JSSQLException.cpp"
index 3214e2c..85a4a66 100644 (file)
@@ -113,7 +113,13 @@ BINDING_IDLS = \
     $(WebCore)/Modules/indexeddb/IDBVersionChangeEvent.idl \
     $(WebCore)/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl \
     $(WebCore)/Modules/indieui/UIRequestEvent.idl \
-    $(WebCore)/Modules/mediasource/MediaSource.idl \
+       $(WebCore)/Modules/mediasource/MediaSource.idl \
+       $(WebCore)/Modules/mediasource/SourceBuffer.idl \
+       $(WebCore)/Modules/mediasource/SourceBufferList.idl \
+       $(WebCore)/Modules/mediasource/URLMediaSource.idl \
+    $(WebCore)/Modules/mediasource/WebKitMediaSource.idl \
+    $(WebCore)/Modules/mediasource/WebKitSourceBuffer.idl \
+    $(WebCore)/Modules/mediasource/WebKitSourceBufferList.idl \
     $(WebCore)/Modules/mediasource/SourceBuffer.idl \
     $(WebCore)/Modules/mediasource/SourceBufferList.idl \
     $(WebCore)/Modules/mediastream/MediaStream.idl \
index 96c7be7..af0ba80 100644 (file)
@@ -662,7 +662,11 @@ enable?(MEDIA_SOURCE) {
   IDL_BINDINGS += \
     $$PWD/Modules/mediasource/MediaSource.idl \
     $$PWD/Modules/mediasource/SourceBuffer.idl \
-    $$PWD/Modules/mediasource/SourceBufferList.idl
+    $$PWD/Modules/mediasource/SourceBufferList.idl \
+    $$PWD/Modules/mediasource/URLMediaSource.idl \
+    $$PWD/Modules/mediasource/WebKitMediaSource.idl \
+    $$PWD/Modules/mediasource/WebKitSourceBuffer.idl \
+    $$PWD/Modules/mediasource/WebKitSourceBufferList.idl
 }
 
 qtPrepareTool(QMAKE_MOC, moc)
index fae79f8..ec26bf9 100644 (file)
@@ -500,6 +500,8 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSMediaList.h \
        DerivedSources/WebCore/JSMediaSource.cpp \
        DerivedSources/WebCore/JSMediaSource.h \
+       DerivedSources/WebCore/JSWebKitMediaSource.cpp \
+       DerivedSources/WebCore/JSWebKitMediaSource.h \
        DerivedSources/WebCore/JSMediaStream.cpp \
        DerivedSources/WebCore/JSMediaStream.h \
        DerivedSources/WebCore/JSMediaStreamAudioSourceNode.cpp \
@@ -670,6 +672,10 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSSourceBufferList.h \
        DerivedSources/WebCore/JSSourceInfo.cpp \
        DerivedSources/WebCore/JSSourceInfo.h \
+       DerivedSources/WebCore/JSWebKitSourceBuffer.cpp \
+       DerivedSources/WebCore/JSWebKitSourceBuffer.h \
+       DerivedSources/WebCore/JSWebKitSourceBufferList.cpp \
+       DerivedSources/WebCore/JSWebKitSourceBufferList.h \
        DerivedSources/WebCore/JSSpeechInputEvent.cpp \
        DerivedSources/WebCore/JSSpeechInputEvent.h \
        DerivedSources/WebCore/JSSpeechInputResult.cpp \
@@ -1242,6 +1248,10 @@ dom_binding_idls += \
        $(WebCore)/Modules/mediasource/MediaSource.idl \
        $(WebCore)/Modules/mediasource/SourceBuffer.idl \
        $(WebCore)/Modules/mediasource/SourceBufferList.idl \
+       $(WebCore)/Modules/mediasource/URLMediaSource.idl \
+       $(WebCore)/Modules/mediasource/WebKitMediaSource.idl \
+       $(WebCore)/Modules/mediasource/WebKitSourceBuffer.idl \
+       $(WebCore)/Modules/mediasource/WebKitSourceBufferList.idl \
        $(WebCore)/Modules/mediastream/MediaStream.idl \
        $(WebCore)/Modules/mediastream/MediaStreamEvent.idl \
        $(WebCore)/Modules/mediastream/MediaStreamTrack.idl \
@@ -1942,12 +1952,22 @@ webcore_modules_sources += \
        Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h \
        Source/WebCore/Modules/mediasource/MediaSource.cpp \
        Source/WebCore/Modules/mediasource/MediaSource.h \
+       Source/WebCore/Modules/mediasource/MediaSourceBase.cpp \
+       Source/WebCore/Modules/mediasource/MediaSourceBase.h \
        Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp \
        Source/WebCore/Modules/mediasource/MediaSourceRegistry.h \
        Source/WebCore/Modules/mediasource/SourceBuffer.cpp \
        Source/WebCore/Modules/mediasource/SourceBuffer.h \
        Source/WebCore/Modules/mediasource/SourceBufferList.cpp \
        Source/WebCore/Modules/mediasource/SourceBufferList.h \
+       Source/WebCore/Modules/mediasource/URLMediaSource.cpp \
+       Source/WebCore/Modules/mediasource/URLMediaSource.h \
+       Source/WebCore/Modules/mediasource/WebKitMediaSource.cpp \
+       Source/WebCore/Modules/mediasource/WebKitMediaSource.h \
+       Source/WebCore/Modules/mediasource/WebKitSourceBuffer.cpp \
+       Source/WebCore/Modules/mediasource/WebKitSourceBuffer.h \
+       Source/WebCore/Modules/mediasource/WebKitSourceBufferList.cpp \
+       Source/WebCore/Modules/mediasource/WebKitSourceBufferList.h \
        Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp \
        Source/WebCore/Modules/mediastream/MediaConstraintsImpl.h \
        Source/WebCore/Modules/mediastream/MediaStream.cpp \
@@ -3707,6 +3727,7 @@ webcore_sources += \
        Source/WebCore/html/PasswordInputType.h \
        Source/WebCore/html/PluginDocument.cpp \
        Source/WebCore/html/PluginDocument.h \
+       Source/WebCore/html/PublicURLManager.cpp \
        Source/WebCore/html/PublicURLManager.h \
        Source/WebCore/html/RadioInputType.cpp \
        Source/WebCore/html/RadioInputType.h \
index 816d075..d5e8390 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 #if ENABLE(MEDIA_SOURCE)
 
 #include "ContentType.h"
-#include "Event.h"
+#include "ExceptionCodePlaceholder.h"
+#include "GenericEventQueue.h"
+#include "Logging.h"
 #include "MIMETypeRegistry.h"
+#include "MediaSourceRegistry.h"
 #include "SourceBufferPrivate.h"
 #include "TimeRanges.h"
 #include <runtime/Uint8Array.h>
+#include <wtf/text/CString.h>
 
 namespace WebCore {
 
@@ -50,64 +54,24 @@ PassRefPtr<MediaSource> MediaSource::create(ScriptExecutionContext* context)
 }
 
 MediaSource::MediaSource(ScriptExecutionContext* context)
-    : ActiveDOMObject(context)
-    , m_readyState(closedKeyword())
-    , m_asyncEventQueue(*this)
-    , m_sourceBuffers(SourceBufferList::create(scriptExecutionContext(), m_asyncEventQueue))
-    , m_activeSourceBuffers(SourceBufferList::create(scriptExecutionContext(), m_asyncEventQueue))
+    : MediaSourceBase(context)
 {
+    LOG(Media, "MediaSource::MediaSource %p", this);
+    m_sourceBuffers = SourceBufferList::create(scriptExecutionContext());
+    m_activeSourceBuffers = SourceBufferList::create(scriptExecutionContext());
 }
 
-const String& MediaSource::openKeyword()
+MediaSource::~MediaSource()
 {
-    DEFINE_STATIC_LOCAL(const String, open, (ASCIILiteral("open")));
-    return open;
-}
-
-const String& MediaSource::closedKeyword()
-{
-    DEFINE_STATIC_LOCAL(const String, closed, (ASCIILiteral("closed")));
-    return closed;
-}
-
-const String& MediaSource::endedKeyword()
-{
-    DEFINE_STATIC_LOCAL(const String, ended, (ASCIILiteral("ended")));
-    return ended;
-}
-
-SourceBufferList* MediaSource::sourceBuffers()
-{
-    return m_sourceBuffers.get();
-}
-
-SourceBufferList* MediaSource::activeSourceBuffers()
-{
-    // FIXME(91649): support track selection
-    return m_activeSourceBuffers.get();
-}
-
-double MediaSource::duration() const
-{
-    return m_readyState == closedKeyword() ? std::numeric_limits<float>::quiet_NaN() : m_private->duration();
-}
-
-void MediaSource::setDuration(double duration, ExceptionCode& ec)
-{
-    if (duration < 0.0 || std::isnan(duration)) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-    if (m_readyState != openKeyword()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
-    m_private->setDuration(duration);
+    LOG(Media, "MediaSource::~MediaSource %p", this);
+    ASSERT(isClosed());
 }
 
 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec)
 {
-    // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-addsourcebuffer
+    LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this);
+
+    // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
     // 1. If type is null or an empty then throw an INVALID_ACCESS_ERR exception and
     // abort these steps.
     if (type.isNull() || type.isEmpty()) {
@@ -124,7 +88,7 @@ SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec
 
     // 4. If the readyState attribute is not in the "open" state then throw an
     // INVALID_STATE_ERR exception and abort these steps.
-    if (!m_private || m_readyState != openKeyword()) {
+    if (!isOpen()) {
         ec = INVALID_STATE_ERR;
         return 0;
     }
@@ -132,38 +96,29 @@ SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec
     // 5. Create a new SourceBuffer object and associated resources.
     ContentType contentType(type);
     Vector<String> codecs = contentType.codecs();
-    OwnPtr<SourceBufferPrivate> sourceBufferPrivate;
-    switch (m_private->addSourceBuffer(contentType.type(), codecs, &sourceBufferPrivate)) {
-    case MediaSourcePrivate::Ok: {
-        ASSERT(sourceBufferPrivate);
-        RefPtr<SourceBuffer> buffer = SourceBuffer::create(sourceBufferPrivate.release(), this);
-
-        // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
-        m_sourceBuffers->add(buffer);
-        m_activeSourceBuffers->add(buffer);
-        // 7. Return the new object to the caller.
-        return buffer.get();
-    }
-    case MediaSourcePrivate::NotSupported:
-        // 2 (cont). If type contains a MIME type ... that is not supported with the types 
-        // specified for the other SourceBuffer objects in sourceBuffers, then throw
-        // a NOT_SUPPORTED_ERR exception and abort these steps.
-        ec = NOT_SUPPORTED_ERR;
-        return 0;
-    case MediaSourcePrivate::ReachedIdLimit:
-        // 3 (cont). If the user agent can't handle any more SourceBuffer objects then throw 
-        // a QUOTA_EXCEEDED_ERR exception and abort these steps.
-        ec = QUOTA_EXCEEDED_ERR;
+    OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate(contentType.type(), codecs, ec);
+
+    if (!sourceBufferPrivate) {
+        ASSERT(ec == NOT_SUPPORTED_ERR || ec == QUOTA_EXCEEDED_ERR);
+        // 2. If type contains a MIME type that is not supported ..., then throw a NOT_SUPPORTED_ERR exception and abort these steps.
+        // 3. If the user agent can't handle any more SourceBuffer objects then throw a QUOTA_EXCEEDED_ERR exception and abort these steps
         return 0;
     }
 
-    ASSERT_NOT_REACHED();
-    return 0;
+    RefPtr<SourceBuffer> buffer = SourceBuffer::create(sourceBufferPrivate.release(), this);
+    // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
+    m_sourceBuffers->add(buffer);
+    m_activeSourceBuffers->add(buffer);
+    // 7. Return the new object to the caller.
+    return buffer.get();
 }
 
 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionCode& ec)
 {
-    // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-removesourcebuffer
+    LOG(Media, "MediaSource::removeSourceBuffer() %p", this);
+    RefPtr<SourceBuffer> protect(buffer);
+
+    // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer
     // 1. If sourceBuffer is null then throw an INVALID_ACCESS_ERR exception and
     // abort these steps.
     if (!buffer) {
@@ -171,98 +126,68 @@ void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionCode& ec)
         return;
     }
 
-    // 2. If sourceBuffers is empty then throw an INVALID_STATE_ERR exception and
-    // abort these steps.
-    if (!m_private || !m_sourceBuffers->length()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
-
-    // 3. If sourceBuffer specifies an object that is not in sourceBuffers then
+    // 2. If sourceBuffer specifies an object that is not in sourceBuffers then
     // throw a NOT_FOUND_ERR exception and abort these steps.
-    // 6. Remove sourceBuffer from sourceBuffers and fire a removesourcebuffer event
-    // on that object.
-    if (!m_sourceBuffers->remove(buffer)) {
+    if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) {
         ec = NOT_FOUND_ERR;
         return;
     }
 
-    // 7. Destroy all resources for sourceBuffer.
-    m_activeSourceBuffers->remove(buffer);
+    // 3. If the sourceBuffer.updating attribute equals true, then run the following steps: ...
+    buffer->abortIfUpdating();
 
-    // 4. Remove track information from audioTracks, videoTracks, and textTracks for all tracks 
-    // associated with sourceBuffer and fire a simple event named change on the modified lists.
+    // Steps 4-9 are related to updating audioTracks, videoTracks, and textTracks which aren't implmented yet.
     // FIXME(91649): support track selection
 
-    // 5. If sourceBuffer is in activeSourceBuffers, then remove it from that list and fire a
-    // removesourcebuffer event on that object.
-    // FIXME(91649): support track selection
-}
+    // 10. If sourceBuffer is in activeSourceBuffers, then remove sourceBuffer from activeSourceBuffers ...
+    m_activeSourceBuffers->remove(buffer);
 
-const String& MediaSource::readyState() const
-{
-    return m_readyState;
+    // 11. Remove sourceBuffer from sourceBuffers and fire a removesourcebuffer event
+    // on that object.
+    m_sourceBuffers->remove(buffer);
+
+    // 12. Destroy all resources for sourceBuffer.
+    buffer->removedFromMediaSource();
 }
 
-void MediaSource::setReadyState(const String& state)
+void MediaSource::onReadyStateChange(const AtomicString& oldState, const AtomicString& newState)
 {
-    ASSERT(state == openKeyword() || state == closedKeyword() || state == endedKeyword());
-    if (m_readyState == state)
-        return;
-
-    String oldState = m_readyState;
-    m_readyState = state;
-
-    if (m_readyState == closedKeyword()) {
-        m_sourceBuffers->clear();
-        m_activeSourceBuffers->clear();
-        m_private.clear();
-        scheduleEvent(eventNames().webkitsourcecloseEvent);
+    if (isOpen()) {
+        scheduleEvent(eventNames().sourceopenEvent);
         return;
     }
 
-    if (oldState == openKeyword() && m_readyState == endedKeyword()) {
-        scheduleEvent(eventNames().webkitsourceendedEvent);
+    if (oldState == openKeyword() && newState == endedKeyword()) {
+        scheduleEvent(eventNames().sourceendedEvent);
         return;
     }
 
-    if (m_readyState == openKeyword()) {
-        scheduleEvent(eventNames().webkitsourceopenEvent);
-        return;
-    }
-}
+    ASSERT(isClosed());
 
-void MediaSource::endOfStream(const String& error, ExceptionCode& ec)
-{
-    // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-endofstream
-    // 1. If the readyState attribute is not in the "open" state then throw an
-    // INVALID_STATE_ERR exception and abort these steps.
-    if (!m_private || m_readyState != openKeyword()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
+    m_activeSourceBuffers->clear();
 
-    MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoError;
+    // Clear SourceBuffer references to this object.
+    for (unsigned long i = 0; i < m_sourceBuffers->length(); ++i)
+        m_sourceBuffers->item(i)->removedFromMediaSource();
+    m_sourceBuffers->clear();
 
-    if (error.isNull() || error.isEmpty())
-        eosStatus = MediaSourcePrivate::EosNoError;
-    else if (error == "network")
-        eosStatus = MediaSourcePrivate::EosNetworkError;
-    else if (error == "decode")
-        eosStatus = MediaSourcePrivate::EosDecodeError;
-    else {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
+    scheduleEvent(eventNames().sourcecloseEvent);
+}
+
+Vector<RefPtr<TimeRanges> > MediaSource::activeRanges() const
+{
+    Vector<RefPtr<TimeRanges> > activeRanges(m_activeSourceBuffers->length());
+    for (size_t i = 0; i < m_activeSourceBuffers->length(); ++i)
+        activeRanges[i] = m_activeSourceBuffers->item(i)->buffered(ASSERT_NO_EXCEPTION);
 
-    // 2. Change the readyState attribute value to "ended".
-    setReadyState(endedKeyword());
-    m_private->endOfStream(eosStatus);
+    return activeRanges;
 }
 
 bool MediaSource::isTypeSupported(const String& type)
 {
-    // Section 2.1 isTypeSupported() method steps.
+    LOG(Media, "MediaSource::isTypeSupported(%s)", type.ascii().data());
+
+    // Section 2.2 isTypeSupported() method steps.
     // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type
     // 1. If type is an empty string, then return false.
     if (type.isNull() || type.isEmpty())
@@ -282,52 +207,11 @@ bool MediaSource::isTypeSupported(const String& type)
     return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs);
 }
 
-void MediaSource::setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate> mediaSourcePrivate)
-{
-    ASSERT(mediaSourcePrivate);
-    ASSERT(!m_private);
-    m_private = mediaSourcePrivate;
-    setReadyState(openKeyword());
-}
-
 const AtomicString& MediaSource::interfaceName() const
 {
     return eventNames().interfaceForMediaSource;
 }
 
-ScriptExecutionContext* MediaSource::scriptExecutionContext() const
-{
-    return ActiveDOMObject::scriptExecutionContext();
-}
-
-bool MediaSource::hasPendingActivity() const
-{
-    return m_private || m_asyncEventQueue.hasPendingEvents() || ActiveDOMObject::hasPendingActivity();
-}
-
-void MediaSource::stop()
-{
-    m_private.clear();
-    m_asyncEventQueue.cancelAllEvents();
-}
-
-EventTargetData* MediaSource::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData& MediaSource::ensureEventTargetData()
-{
-    return m_eventTargetData;
-}
-
-void MediaSource::scheduleEvent(const AtomicString& eventName)
-{
-    RefPtr<Event> event = Event::create(eventName, false, false);
-    event->setTarget(this);
-    m_asyncEventQueue.enqueueEvent(event.release());
-}
-
 } // namespace WebCore
 
 #endif
index ea5bc6d..de58ce8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 
 #if ENABLE(MEDIA_SOURCE)
 
-#include "ActiveDOMObject.h"
-#include "GenericEventQueue.h"
-#include "MediaSourcePrivate.h"
+#include "MediaSourceBase.h"
+#include "ScriptWrappable.h"
 #include "SourceBuffer.h"
 #include "SourceBufferList.h"
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class MediaSource : public RefCounted<MediaSource>, public EventTarget, public ActiveDOMObject {
+class MediaSource : public MediaSourceBase, public ScriptWrappable {
 public:
-    static const String& openKeyword();
-    static const String& closedKeyword();
-    static const String& endedKeyword();
-
     static PassRefPtr<MediaSource> create(ScriptExecutionContext*);
-    virtual ~MediaSource() { }
+    virtual ~MediaSource();
 
     // MediaSource.idl methods
-    SourceBufferList* sourceBuffers();
-    SourceBufferList* activeSourceBuffers();
-    double duration() const;
-    void setDuration(double, ExceptionCode&);
+    SourceBufferList* sourceBuffers() { return m_sourceBuffers.get(); }
+    SourceBufferList* activeSourceBuffers() { return m_activeSourceBuffers.get(); }
     SourceBuffer* addSourceBuffer(const String& type, ExceptionCode&);
     void removeSourceBuffer(SourceBuffer*, ExceptionCode&);
-    const String& readyState() const;
-    void setReadyState(const String&);
-    void endOfStream(const String& error, ExceptionCode&);
     static bool isTypeSupported(const String& type);
 
-    void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>);
-
     // EventTarget interface
     virtual const AtomicString& interfaceName() const OVERRIDE;
-    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
-
-    // ActiveDOMObject interface
-    virtual bool hasPendingActivity() const OVERRIDE;
 
-    using RefCounted<MediaSource>::ref;
-    using RefCounted<MediaSource>::deref;
+    using RefCounted<MediaSourceBase>::ref;
+    using RefCounted<MediaSourceBase>::deref;
 
 private:
     explicit MediaSource(ScriptExecutionContext*);
 
-    // ActiveDOMObject interface
-    virtual void stop() OVERRIDE;
-
-    virtual EventTargetData* eventTargetData() OVERRIDE;
-    virtual EventTargetData& ensureEventTargetData() OVERRIDE;
-
-    virtual void refEventTarget() OVERRIDE { ref(); }
-    virtual void derefEventTarget() OVERRIDE { deref(); }
+    // MediaSourceBase interface
+    virtual void onReadyStateChange(const AtomicString&, const AtomicString&) OVERRIDE;
+    virtual Vector<RefPtr<TimeRanges> > activeRanges() const OVERRIDE;
 
-    void scheduleEvent(const AtomicString& eventName);
-
-    EventTargetData m_eventTargetData;
-
-    String m_readyState;
-    OwnPtr<MediaSourcePrivate> m_private;
-
-    GenericEventQueue m_asyncEventQueue;
     RefPtr<SourceBufferList> m_sourceBuffers;
     RefPtr<SourceBufferList> m_activeSourceBuffers;
 };
@@ -102,4 +73,5 @@ private:
 } // namespace WebCore
 
 #endif
+
 #endif
index 7b04347..d0d4dd4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
     Conditional=MEDIA_SOURCE,
     ActiveDOMObject,
     EventTarget,
+    JSGenerateToNativeObject,
     Constructor,
-    ConstructorCallWith=ScriptExecutionContext,
-    InterfaceName=WebKitMediaSource
-] interface MediaSource {
+    ConstructorCallWith=ScriptExecutionContext
+] interface MediaSource : EventTarget {
     // All the source buffers created by this object.
     readonly attribute SourceBufferList sourceBuffers;
 
     [RaisesException] void endOfStream([Default=NullString] optional DOMString error);
 
     static boolean isTypeSupported (DOMString type);
-
-    // EventTarget interface
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event event);
 };
-
diff --git a/Source/WebCore/Modules/mediasource/MediaSourceBase.cpp b/Source/WebCore/Modules/mediasource/MediaSourceBase.cpp
new file mode 100644 (file)
index 0000000..ca6b58e
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MediaSourceBase.h"
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "Event.h"
+#include "ExceptionCode.h"
+#include "ExceptionCodePlaceholder.h"
+#include "GenericEventQueue.h"
+#include "Logging.h"
+#include "MediaSourceRegistry.h"
+#include "SourceBufferPrivate.h"
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+MediaSourceBase::MediaSourceBase(ScriptExecutionContext* context)
+    : ActiveDOMObject(context)
+    , m_readyState(closedKeyword())
+    , m_asyncEventQueue(*this)
+    , m_attached(false)
+{
+}
+
+MediaSourceBase::~MediaSourceBase()
+{
+}
+
+const AtomicString& MediaSourceBase::openKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, open, ("open", AtomicString::ConstructFromLiteral));
+    return open;
+}
+
+const AtomicString& MediaSourceBase::closedKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, closed, ("closed", AtomicString::ConstructFromLiteral));
+    return closed;
+}
+
+const AtomicString& MediaSourceBase::endedKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, ended, ("ended", AtomicString::ConstructFromLiteral));
+    return ended;
+}
+
+void MediaSourceBase::setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate> mediaSourcePrivate)
+{
+    ASSERT(mediaSourcePrivate);
+    ASSERT(!m_private);
+    ASSERT(m_attached);
+    m_private = mediaSourcePrivate;
+    setReadyState(openKeyword());
+}
+
+void MediaSourceBase::addedToRegistry()
+{
+    setPendingActivity(this);
+}
+
+void MediaSourceBase::removedFromRegistry()
+{
+    unsetPendingActivity(this);
+}
+
+double MediaSourceBase::duration() const
+{
+    return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_private->duration();
+}
+
+PassRefPtr<TimeRanges> MediaSourceBase::buffered() const
+{
+    // Implements MediaSource algorithm for HTMLMediaElement.buffered.
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#htmlmediaelement-extensions
+    Vector<RefPtr<TimeRanges> > ranges = activeRanges();
+
+    // 1. If activeSourceBuffers.length equals 0 then return an empty TimeRanges object and abort these steps.
+    if (ranges.isEmpty())
+        return TimeRanges::create();
+
+    // 2. Let active ranges be the ranges returned by buffered for each SourceBuffer object in activeSourceBuffers.
+    // 3. Let highest end time be the largest range end time in the active ranges.
+    double highestEndTime = -1;
+    for (size_t i = 0; i < ranges.size(); ++i) {
+        unsigned length = ranges[i]->length();
+        if (length)
+            highestEndTime = std::max(highestEndTime, ranges[i]->end(length - 1, ASSERT_NO_EXCEPTION));
+    }
+
+    // Return an empty range if all ranges are empty.
+    if (highestEndTime < 0)
+        return TimeRanges::create();
+
+    // 4. Let intersection ranges equal a TimeRange object containing a single range from 0 to highest end time.
+    RefPtr<TimeRanges> intersectionRanges = TimeRanges::create(0, highestEndTime);
+
+    // 5. For each SourceBuffer object in activeSourceBuffers run the following steps:
+    bool ended = readyState() == endedKeyword();
+    for (size_t i = 0; i < ranges.size(); ++i) {
+        // 5.1 Let source ranges equal the ranges returned by the buffered attribute on the current SourceBuffer.
+        TimeRanges* sourceRanges = ranges[i].get();
+
+        // 5.2 If readyState is "ended", then set the end time on the last range in source ranges to highest end time.
+        if (ended && sourceRanges->length())
+            sourceRanges->add(sourceRanges->start(sourceRanges->length() - 1, ASSERT_NO_EXCEPTION), highestEndTime);
+
+        // 5.3 Let new intersection ranges equal the the intersection between the intersection ranges and the source ranges.
+        // 5.4 Replace the ranges in intersection ranges with the new intersection ranges.
+        intersectionRanges->intersectWith(sourceRanges);
+    }
+
+    return intersectionRanges.release();
+}
+
+void MediaSourceBase::setDuration(double duration, ExceptionCode& ec)
+{
+    if (duration < 0.0 || std::isnan(duration)) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+    if (!isOpen()) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+    m_private->setDuration(duration);
+}
+
+
+void MediaSourceBase::setReadyState(const AtomicString& state)
+{
+    ASSERT(state == openKeyword() || state == closedKeyword() || state == endedKeyword());
+
+    AtomicString oldState = readyState();
+    LOG(Media, "MediaSourceBase::setReadyState() %p : %s -> %s", this, oldState.string().ascii().data(), state.string().ascii().data());
+
+    if (state == closedKeyword()) {
+        m_private.clear();
+        m_attached = false;
+    }
+
+    if (oldState == state)
+        return;
+
+    m_readyState = state;
+
+    onReadyStateChange(oldState, state);
+}
+
+void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionCode& ec)
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::ConstructFromLiteral));
+
+    // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-endofstream
+    // 1. If the readyState attribute is not in the "open" state then throw an
+    // INVALID_STATE_ERR exception and abort these steps.
+    if (!isOpen()) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoError;
+
+    if (error.isNull() || error.isEmpty())
+        eosStatus = MediaSourcePrivate::EosNoError;
+    else if (error == network)
+        eosStatus = MediaSourcePrivate::EosNetworkError;
+    else if (error == decode)
+        eosStatus = MediaSourcePrivate::EosDecodeError;
+    else {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    // 2. Change the readyState attribute value to "ended".
+    setReadyState(endedKeyword());
+    m_private->markEndOfStream(eosStatus);
+}
+
+bool MediaSourceBase::isOpen() const
+{
+    return readyState() == openKeyword();
+}
+
+bool MediaSourceBase::isClosed() const
+{
+    return readyState() == closedKeyword();
+}
+
+void MediaSourceBase::close()
+{
+    setReadyState(closedKeyword());
+}
+
+bool MediaSourceBase::attachToElement()
+{
+    if (m_attached)
+        return false;
+
+    ASSERT(isClosed());
+
+    m_attached = true;
+    return true;
+}
+
+void MediaSourceBase::openIfInEndedState()
+{
+    if (m_readyState != endedKeyword())
+        return;
+
+    setReadyState(openKeyword());
+    m_private->unmarkEndOfStream();
+}
+
+bool MediaSourceBase::hasPendingActivity() const
+{
+    return m_private || m_asyncEventQueue.hasPendingEvents()
+        || ActiveDOMObject::hasPendingActivity();
+}
+
+void MediaSourceBase::stop()
+{
+    m_asyncEventQueue.close();
+    if (!isClosed())
+        setReadyState(closedKeyword());
+    m_private.clear();
+}
+
+PassOwnPtr<SourceBufferPrivate> MediaSourceBase::createSourceBufferPrivate(const String& type, const MediaSourcePrivate::CodecsArray& codecs, ExceptionCode& ec)
+{
+    OwnPtr<SourceBufferPrivate> sourceBufferPrivate;
+    switch (m_private->addSourceBuffer(type, codecs, &sourceBufferPrivate)) {
+    case MediaSourcePrivate::Ok: {
+        return sourceBufferPrivate.release();
+    }
+    case MediaSourcePrivate::NotSupported:
+        // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
+        // Step 2: If type contains a MIME type ... that is not supported with the types
+        // specified for the other SourceBuffer objects in sourceBuffers, then throw
+        // a NOT_SUPPORTED_ERR exception and abort these steps.
+        ec = NOT_SUPPORTED_ERR;
+        return nullptr;
+    case MediaSourcePrivate::ReachedIdLimit:
+        // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
+        // Step 3: If the user agent can't handle any more SourceBuffer objects then throw
+        // a QUOTA_EXCEEDED_ERR exception and abort these steps.
+        ec = QUOTA_EXCEEDED_ERR;
+        return nullptr;
+    }
+
+    ASSERT_NOT_REACHED();
+    return nullptr;
+}
+
+void MediaSourceBase::scheduleEvent(const AtomicString& eventName)
+{
+    RefPtr<Event> event = Event::create(eventName, false, false);
+    event->setTarget(this);
+
+    m_asyncEventQueue.enqueueEvent(event.release());
+}
+
+ScriptExecutionContext* MediaSourceBase::scriptExecutionContext() const
+{
+    return ActiveDOMObject::scriptExecutionContext();
+}
+
+EventTargetData* MediaSourceBase::eventTargetData()
+{
+    return &m_eventTargetData;
+}
+
+EventTargetData& MediaSourceBase::ensureEventTargetData()
+{
+    return m_eventTargetData;
+}
+
+URLRegistry& MediaSourceBase::registry() const
+{
+    return MediaSourceRegistry::registry();
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/Modules/mediasource/MediaSourceBase.h b/Source/WebCore/Modules/mediasource/MediaSourceBase.h
new file mode 100644 (file)
index 0000000..1b98a13
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaSourceBase_h
+#define MediaSourceBase_h
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "ActiveDOMObject.h"
+#include "EventTarget.h"
+#include "GenericEventQueue.h"
+#include "HTMLMediaSource.h"
+#include "MediaSourcePrivate.h"
+#include "URLRegistry.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class GenericEventQueue;
+
+class MediaSourceBase : public RefCounted<MediaSourceBase>, public HTMLMediaSource, public ActiveDOMObject, public EventTarget {
+public:
+    static const AtomicString& openKeyword();
+    static const AtomicString& closedKeyword();
+    static const AtomicString& endedKeyword();
+
+    virtual ~MediaSourceBase();
+
+    void addedToRegistry();
+    void removedFromRegistry();
+    void openIfInEndedState();
+    bool isOpen() const;
+
+    // HTMLMediaSource
+    virtual bool attachToElement() OVERRIDE;
+    virtual void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>) OVERRIDE;
+    virtual void close() OVERRIDE;
+    virtual bool isClosed() const OVERRIDE;
+    virtual double duration() const OVERRIDE;
+    virtual PassRefPtr<TimeRanges> buffered() const OVERRIDE;
+    virtual void refHTMLMediaSource() OVERRIDE { ref(); }
+    virtual void derefHTMLMediaSource() OVERRIDE { deref(); }
+
+    void setDuration(double, ExceptionCode&);
+    const AtomicString& readyState() const { return m_readyState; }
+    void setReadyState(const AtomicString&);
+    void endOfStream(const AtomicString& error, ExceptionCode&);
+
+
+    // ActiveDOMObject interface
+    virtual bool hasPendingActivity() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
+    // EventTarget interface
+    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+    virtual EventTargetData* eventTargetData() OVERRIDE;
+    virtual EventTargetData& ensureEventTargetData() OVERRIDE;
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
+
+    // URLRegistrable interface
+    virtual URLRegistry& registry() const OVERRIDE;
+
+    using RefCounted<MediaSourceBase>::ref;
+    using RefCounted<MediaSourceBase>::deref;
+
+protected:
+    explicit MediaSourceBase(ScriptExecutionContext*);
+
+    virtual void onReadyStateChange(const AtomicString& oldState, const AtomicString& newState) = 0;
+    virtual Vector<RefPtr<TimeRanges> > activeRanges() const = 0;
+
+    PassOwnPtr<SourceBufferPrivate> createSourceBufferPrivate(const String& type, const MediaSourcePrivate::CodecsArray&, ExceptionCode&);
+    void scheduleEvent(const AtomicString& eventName);
+    GenericEventQueue& asyncEventQueue() { return m_asyncEventQueue; }
+
+private:
+    OwnPtr<MediaSourcePrivate> m_private;
+    EventTargetData m_eventTargetData;
+    AtomicString m_readyState;
+    GenericEventQueue m_asyncEventQueue;
+    bool m_attached;
+};
+
+}
+
+#endif
+
+#endif
index 1c62674..db4751e 100644 (file)
@@ -34,7 +34,7 @@
 #if ENABLE(MEDIA_SOURCE)
 
 #include "KURL.h"
-#include "MediaSource.h"
+#include "MediaSourceBase.h"
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -46,33 +46,37 @@ MediaSourceRegistry& MediaSourceRegistry::registry()
     return instance;
 }
 
-void MediaSourceRegistry::registerMediaSourceURL(const KURL& url, PassRefPtr<MediaSource> source)
+void MediaSourceRegistry::registerURL(SecurityOrigin*, const KURL& url, URLRegistrable* registrable)
 {
+    ASSERT(&registrable->registry() == this);
     ASSERT(isMainThread());
 
-    source->setPendingActivity(source.get());
-
+    MediaSourceBase* source = static_cast<MediaSourceBase*>(registrable);
+    source->addedToRegistry();
     m_mediaSources.set(url.string(), source);
 }
 
-void MediaSourceRegistry::unregisterMediaSourceURL(const KURL& url)
+void MediaSourceRegistry::unregisterURL(const KURL& url)
 {
     ASSERT(isMainThread());
-    HashMap<String, RefPtr<MediaSource> >::iterator iter = m_mediaSources.find(url.string());
+    HashMap<String, RefPtr<MediaSourceBase> >::iterator iter = m_mediaSources.find(url.string());
     if (iter == m_mediaSources.end())
         return;
 
-    RefPtr<MediaSource> source = iter->value;
+    RefPtr<MediaSourceBase> source = iter->value;
     m_mediaSources.remove(iter);
-
-    // Remove the pending activity added in registerMediaSourceURL().
-    source->unsetPendingActivity(source.get());
+    source->removedFromRegistry();
 }
 
-MediaSource* MediaSourceRegistry::lookupMediaSource(const String& url)
+URLRegistrable* MediaSourceRegistry::lookup(const String& url)
 {
     ASSERT(isMainThread());
-    return m_mediaSources.get(url).get();
+    return m_mediaSources.get(url);
+}
+
+MediaSourceRegistry::MediaSourceRegistry()
+{
+    HTMLMediaSource::setRegistry(this);
 }
 
 } // namespace WebCore
index 96da6b3..46c24d4 100644 (file)
@@ -33,6 +33,7 @@
 
 #if ENABLE(MEDIA_SOURCE)
 
+#include "URLRegistry.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/StringHash.h>
 namespace WebCore {
 
 class KURL;
-class MediaSource;
+class MediaSourceBase;
 
-class MediaSourceRegistry {
+class MediaSourceRegistry : public URLRegistry {
 public:
     // Returns a single instance of MediaSourceRegistry.
     static MediaSourceRegistry& registry();
 
     // Registers a blob URL referring to the specified media source.
-    void registerMediaSourceURL(const KURL&, PassRefPtr<MediaSource>);
-    void unregisterMediaSourceURL(const KURL&);
-
-    MediaSource* lookupMediaSource(const String& url);
+    virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVERRIDE;
+    virtual void unregisterURL(const KURL&) OVERRIDE;
+    virtual URLRegistrable* lookup(const String&) OVERRIDE;
 
 private:
-    HashMap<String, RefPtr<MediaSource> > m_mediaSources;
+    MediaSourceRegistry();
+    HashMap<String, RefPtr<MediaSourceBase> > m_mediaSources;
 };
 
 } // namespace WebCore
index 22eb6ad..a35f711 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 
 #if ENABLE(MEDIA_SOURCE)
 
+#include "Event.h"
+#include "GenericEventQueue.h"
+#include "Logging.h"
 #include "MediaSource.h"
 #include "SourceBufferPrivate.h"
 #include "TimeRanges.h"
-#include <runtime/Uint8Array.h>
 
 namespace WebCore {
 
-PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, PassRefPtr<MediaSource> source)
+PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, MediaSource* source)
 {
-    return adoptRef(new SourceBuffer(sourceBufferPrivate, source));
+    RefPtr<SourceBuffer> sourceBuffer(adoptRef(new SourceBuffer(sourceBufferPrivate, source)));
+    sourceBuffer->suspendIfNeeded();
+    return sourceBuffer.release();
 }
 
-SourceBuffer::SourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, PassRefPtr<MediaSource> source)
-    : m_private(sourceBufferPrivate)
+SourceBuffer::SourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, MediaSource* source)
+    : ActiveDOMObject(source->scriptExecutionContext())
+    , m_private(sourceBufferPrivate)
     , m_source(source)
+    , m_asyncEventQueue(*this)
+    , m_updating(false)
     , m_timestampOffset(0)
+    , m_appendBufferTimer(this, &SourceBuffer::appendBufferTimerFired)
 {
     ASSERT(m_private);
     ASSERT(m_source);
@@ -56,6 +64,7 @@ SourceBuffer::SourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate,
 
 SourceBuffer::~SourceBuffer()
 {
+    ASSERT(isRemoved());
 }
 
 PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionCode& ec) const
@@ -88,11 +97,9 @@ void SourceBuffer::setTimestampOffset(double offset, ExceptionCode& ec)
     }
 
     // 4. If the readyState attribute of the parent media source is in the "ended" state then run the following steps:
-    if (isEnded()) {
-        // 4.1 Set the readyState attribute of the parent media source to "open"
-        // 4.2 Queue a task to fire a simple event named sourceopen at the parent media source.
-        m_source->setReadyState(MediaSource::openKeyword());
-    }
+    // 4.1 Set the readyState attribute of the parent media source to "open"
+    // 4.2 Queue a task to fire a simple event named sourceopen at the parent media source.
+    m_source->openIfInEndedState();
 
     // 5. If this object is waiting for the end of a media segment to be appended, then throw an INVALID_STATE_ERR
     // and abort these steps.
@@ -105,49 +112,75 @@ void SourceBuffer::setTimestampOffset(double offset, ExceptionCode& ec)
     m_timestampOffset = offset;
 }
 
-void SourceBuffer::append(PassRefPtr<Uint8Array> data, ExceptionCode& ec)
+void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionCode& ec)
 {
-    // SourceBuffer.append() steps from October 1st version of the Media Source Extensions spec.
-    // https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/media-source.html#dom-append
-
-    // 2. If data is null then throw an INVALID_ACCESS_ERR exception and abort these steps.
+    // Section 3.2 appendBuffer()
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data
+    // 1. If data is null then throw an INVALID_ACCESS_ERR exception and abort these steps.
     if (!data) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
 
-    // 3. If this object has been removed from the sourceBuffers attribute of media source then throw
-    //    an INVALID_STATE_ERR exception and abort these steps.
-    if (isRemoved()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
+    appendBufferInternal(static_cast<unsigned char*>(data->data()), data->byteLength(), ec);
+}
 
-    // 5. If the readyState attribute of media source is in the "ended" state then run the following steps:
-    if (isEnded()) {
-        // 5.1. Set the readyState attribute of media source to "open"
-        // 5.2. Queue a task to fire a simple event named sourceopen at media source.
-        m_source->setReadyState(MediaSource::openKeyword());
+void SourceBuffer::appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionCode& ec)
+{
+    // Section 3.2 appendBuffer()
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data
+    // 1. If data is null then throw an INVALID_ACCESS_ERR exception and abort these steps.
+    if (!data) {
+        ec = INVALID_ACCESS_ERR;
+        return;
     }
 
-    // Steps 6 & beyond are handled by the private implementation.
-    m_private->append(data->data(), data->length());
+    appendBufferInternal(static_cast<unsigned char*>(data->baseAddress()), data->byteLength(), ec);
 }
 
 void SourceBuffer::abort(ExceptionCode& ec)
 {
     // Section 3.2 abort() method steps.
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-abort-void
     // 1. If this object has been removed from the sourceBuffers attribute of the parent media source
     //    then throw an INVALID_STATE_ERR exception and abort these steps.
     // 2. If the readyState attribute of the parent media source is not in the "open" state
     //    then throw an INVALID_STATE_ERR exception and abort these steps.
-    if (isRemoved() || !isOpen()) {
+    if (isRemoved() || !m_source->isOpen()) {
         ec = INVALID_STATE_ERR;
         return;
     }
 
+    // 3. If the sourceBuffer.updating attribute equals true, then run the following steps: ...
+    abortIfUpdating();
+
     // 4. Run the reset parser state algorithm.
     m_private->abort();
+
+    // FIXME(229408) Add steps 5-6 update appendWindowStart & appendWindowEnd.
+}
+
+
+void SourceBuffer::abortIfUpdating()
+{
+    // Section 3.2 abort() method step 3 substeps.
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-abort-void
+
+    if (!m_updating)
+        return;
+
+    // 3.1. Abort the buffer append and stream append loop algorithms if they are running.
+    m_appendBufferTimer.stop();
+    m_pendingAppendData.clear();
+
+    // 3.2. Set the updating attribute to false.
+    m_updating = false;
+
+    // 3.3. Queue a task to fire a simple event named abort at this SourceBuffer object.
+    scheduleEvent(eventNames().abortEvent);
+
+    // 3.4. Queue a task to fire a simple event named updateend at this SourceBuffer object.
+    scheduleEvent(eventNames().updateendEvent);
 }
 
 void SourceBuffer::removedFromMediaSource()
@@ -156,7 +189,38 @@ void SourceBuffer::removedFromMediaSource()
         return;
 
     m_private->removedFromMediaSource();
-    m_source.clear();
+    m_source = 0;
+    m_asyncEventQueue.close();
+}
+
+bool SourceBuffer::hasPendingActivity() const
+{
+    return m_source;
+}
+
+void SourceBuffer::stop()
+{
+    m_appendBufferTimer.stop();
+}
+
+ScriptExecutionContext* SourceBuffer::scriptExecutionContext() const
+{
+    return ActiveDOMObject::scriptExecutionContext();
+}
+
+const AtomicString& SourceBuffer::interfaceName() const
+{
+    return eventNames().interfaceForSourceBuffer;
+}
+
+EventTargetData* SourceBuffer::eventTargetData()
+{
+    return &m_eventTargetData;
+}
+
+EventTargetData& SourceBuffer::ensureEventTargetData()
+{
+    return m_eventTargetData;
 }
 
 bool SourceBuffer::isRemoved() const
@@ -164,16 +228,72 @@ bool SourceBuffer::isRemoved() const
     return !m_source;
 }
 
-bool SourceBuffer::isOpen() const
+void SourceBuffer::scheduleEvent(const AtomicString& eventName)
 {
-    ASSERT(m_source);
-    return m_source->readyState() == MediaSource::openKeyword();
+    RefPtr<Event> event = Event::create(eventName, false, false);
+    event->setTarget(this);
+
+    m_asyncEventQueue.enqueueEvent(event.release());
 }
 
-bool SourceBuffer::isEnded() const
+void SourceBuffer::appendBufferInternal(unsigned char* data, unsigned size, ExceptionCode& ec)
 {
-    ASSERT(m_source);
-    return m_source->readyState() == MediaSource::endedKeyword();
+    // Section 3.2 appendBuffer()
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data
+
+    // Step 1 is enforced by the caller.
+    // 2. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an INVALID_STATE_ERR exception and abort these steps.
+    // 3. If the updating attribute equals true, then throw an INVALID_STATE_ERR exception and abort these steps.
+    if (isRemoved() || m_updating) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    // 4. If the readyState attribute of the parent media source is in the "ended" state then run the following steps: ...
+    m_source->openIfInEndedState();
+
+    // Steps 5-6
+
+    // 7. Add data to the end of the input buffer.
+    m_pendingAppendData.append(data, size);
+
+    // 8. Set the updating attribute to true.
+    m_updating = true;
+
+    // 9. Queue a task to fire a simple event named updatestart at this SourceBuffer object.
+    scheduleEvent(eventNames().updatestartEvent);
+
+    // 10. Asynchronously run the buffer append algorithm.
+    m_appendBufferTimer.startOneShot(0);
+}
+
+void SourceBuffer::appendBufferTimerFired(Timer<SourceBuffer>*)
+{
+    ASSERT(m_updating);
+
+    // Section 3.5.4 Buffer Append Algorithm
+    // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-buffer-append
+
+    // 1. Run the segment parser loop algorithm.
+    // Step 2 doesn't apply since we run Step 1 synchronously here.
+    size_t appendSize = m_pendingAppendData.size();
+    if (!appendSize) {
+        // Resize buffer for 0 byte appends so we always have a valid pointer.
+        // We need to convey all appends, even 0 byte ones to |m_private| so
+        // that it can clear its end of stream state if necessary.
+        m_pendingAppendData.resize(1);
+    }
+    m_private->append(m_pendingAppendData.data(), appendSize);
+
+    // 3. Set the updating attribute to false.
+    m_updating = false;
+    m_pendingAppendData.clear();
+
+    // 4. Queue a task to fire a simple event named update at this SourceBuffer object.
+    scheduleEvent(eventNames().updateEvent);
+
+    // 5. Queue a task to fire a simple event named updateend at this SourceBuffer object.
+    scheduleEvent(eventNames().updateendEvent);
 }
 
 } // namespace WebCore
index a35e325..0a4ea54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 
 #if ENABLE(MEDIA_SOURCE)
 
+#include "ActiveDOMObject.h"
+#include "EventTarget.h"
 #include "ExceptionCode.h"
+#include "GenericEventQueue.h"
+#include "ScriptWrappable.h"
+#include "Timer.h"
+#include <runtime/ArrayBufferView.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -43,35 +49,65 @@ class MediaSource;
 class SourceBufferPrivate;
 class TimeRanges;
 
-class SourceBuffer : public RefCounted<SourceBuffer> {
+class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, public EventTarget, public ScriptWrappable {
 public:
-    static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, PassRefPtr<MediaSource>);
+    static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, MediaSource*);
 
     virtual ~SourceBuffer();
 
     // SourceBuffer.idl methods
+    bool updating() const { return m_updating; }
     PassRefPtr<TimeRanges> buffered(ExceptionCode&) const;
     double timestampOffset() const;
     void setTimestampOffset(double, ExceptionCode&);
-    void append(PassRefPtr<Uint8Array> data, ExceptionCode&);
+    void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionCode&);
+    void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionCode&);
     void abort(ExceptionCode&);
 
+    void abortIfUpdating();
     void removedFromMediaSource();
 
+    // ActiveDOMObject interface
+    virtual bool hasPendingActivity() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
+    // EventTarget interface
+    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+
+    using RefCounted<SourceBuffer>::ref;
+    using RefCounted<SourceBuffer>::deref;
+
+protected:
+    // EventTarget interface
+    virtual EventTargetData* eventTargetData() OVERRIDE;
+    virtual EventTargetData& ensureEventTargetData() OVERRIDE;
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
+
 private:
-    SourceBuffer(PassOwnPtr<SourceBufferPrivate>, PassRefPtr<MediaSource>);
+    SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*);
 
     bool isRemoved() const;
-    bool isOpen() const;
-    bool isEnded() const;
+    void scheduleEvent(const AtomicString& eventName);
+
+    void appendBufferInternal(unsigned char*, unsigned, ExceptionCode&);
+    void appendBufferTimerFired(Timer<SourceBuffer>*);
 
     OwnPtr<SourceBufferPrivate> m_private;
-    RefPtr<MediaSource> m_source;
+    MediaSource* m_source;
+    GenericEventQueue m_asyncEventQueue;
+    EventTargetData m_eventTargetData;
 
+    bool m_updating;
     double m_timestampOffset;
+
+    Vector<unsigned char> m_pendingAppendData;
+    Timer<SourceBuffer> m_appendBufferTimer;
 };
 
 } // namespace WebCore
 
 #endif
+
 #endif
index 71f2b6b..c190b1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
  
 [
     Conditional=MEDIA_SOURCE,
-    InterfaceName=WebKitSourceBuffer
-] interface SourceBuffer {
+    NoInterfaceObject,
+    ActiveDOMObject,
+    EventTarget,
+    JSGenerateToNativeObject
+] interface SourceBuffer : EventTarget {
 
+    readonly attribute boolean updating;
+  
     // Returns the time ranges buffered.
     [GetterRaisesException] readonly attribute TimeRanges buffered;
 
@@ -40,7 +45,8 @@
     [SetterRaisesException] attribute double timestampOffset;
 
     // Append segment data.
-    [RaisesException] void append(Uint8Array data);
+    [RaisesException] void appendBuffer(ArrayBuffer data);
+    [RaisesException] void appendBuffer(ArrayBufferView data);
 
     // Abort the current segment append sequence.
     [RaisesException] void abort();
index ea58006..bef6bd4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 #if ENABLE(MEDIA_SOURCE)
 
 #include "Event.h"
-#include "GenericEventQueue.h"
 #include "SourceBuffer.h"
 
 namespace WebCore {
 
-SourceBufferList::SourceBufferList(ScriptExecutionContext& context, GenericEventQueue& asyncEventQueue)
+SourceBufferList::SourceBufferList(ScriptExecutionContext* context)
     : m_scriptExecutionContext(context)
-    , m_asyncEventQueue(asyncEventQueue)
+    , m_asyncEventQueue(*this)
 {
 }
 
-unsigned SourceBufferList::length() const
+SourceBufferList::~SourceBufferList()
 {
-    return m_list.size();
-}
-
-SourceBuffer* SourceBufferList::item(unsigned index) const
-{
-    if (index >= m_list.size())
-        return 0;
-    return m_list[index].get();
+    ASSERT(m_list.isEmpty());
 }
 
 void SourceBufferList::add(PassRefPtr<SourceBuffer> buffer)
 {
     m_list.append(buffer);
-    createAndFireEvent(eventNames().webkitaddsourcebufferEvent);
+    scheduleEvent(eventNames().addsourcebufferEvent);
 }
 
-bool SourceBufferList::remove(SourceBuffer* buffer)
+void SourceBufferList::remove(SourceBuffer* buffer)
 {
     size_t index = m_list.find(buffer);
     if (index == notFound)
-        return false;
-
-    buffer->removedFromMediaSource();
+        return;
     m_list.remove(index);
-    createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
-    return true;
+    scheduleEvent(eventNames().removesourcebufferEvent);
 }
 
 void SourceBufferList::clear()
 {
-    for (size_t i = 0; i < m_list.size(); ++i)
-        m_list[i]->removedFromMediaSource();
     m_list.clear();
-    createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
+    scheduleEvent(eventNames().removesourcebufferEvent);
 }
 
-void SourceBufferList::createAndFireEvent(const AtomicString& eventName)
+void SourceBufferList::scheduleEvent(const AtomicString& eventName)
 {
     RefPtr<Event> event = Event::create(eventName, false, false);
     event->setTarget(this);
+
     m_asyncEventQueue.enqueueEvent(event.release());
 }
 
@@ -97,7 +85,7 @@ const AtomicString& SourceBufferList::interfaceName() const
 
 ScriptExecutionContext* SourceBufferList::scriptExecutionContext() const
 {
-    return &m_scriptExecutionContext;
+    return m_scriptExecutionContext;
 }
 
 EventTargetData* SourceBufferList::eventTargetData()
index 0df29c3..5a5996f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 #if ENABLE(MEDIA_SOURCE)
 
 #include "EventTarget.h"
+#include "GenericEventQueue.h"
+#include "ScriptWrappable.h"
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
 class SourceBuffer;
-class GenericEventQueue;
 
-class SourceBufferList : public RefCounted<SourceBufferList>, public EventTarget {
+class SourceBufferList : public RefCounted<SourceBufferList>, public ScriptWrappable, public EventTarget {
 public:
-    static PassRefPtr<SourceBufferList> create(ScriptExecutionContext& context, GenericEventQueue& asyncEventQueue)
+    static PassRefPtr<SourceBufferList> create(ScriptExecutionContext* context)
     {
-        return adoptRef(new SourceBufferList(context, asyncEventQueue));
+        return adoptRef(new SourceBufferList(context));
     }
-    virtual ~SourceBufferList() { }
+    virtual ~SourceBufferList();
 
-    unsigned length() const;
-    SourceBuffer* item(unsigned index) const;
+    unsigned long length() const { return m_list.size(); }
+    SourceBuffer* item(unsigned long index) const { return (index < m_list.size()) ? m_list[index].get() : 0; }
 
     void add(PassRefPtr<SourceBuffer>);
-    bool remove(SourceBuffer*);
+    void remove(SourceBuffer*);
+    bool contains(SourceBuffer* buffer) { return m_list.find(buffer) != notFound; }
     void clear();
 
     // EventTarget interface
@@ -69,16 +71,16 @@ protected:
     virtual EventTargetData& ensureEventTargetData() OVERRIDE;
 
 private:
-    SourceBufferList(ScriptExecutionContext*, GenericEventQueue*);
+    SourceBufferList(ScriptExecutionContext*);
 
-    void createAndFireEvent(const AtomicString&);
+    void scheduleEvent(const AtomicString&);
 
     virtual void refEventTarget() OVERRIDE { ref(); }
     virtual void derefEventTarget() OVERRIDE { deref(); }
 
     EventTargetData m_eventTargetData;
-    ScriptExecutionContext& m_scriptExecutionContext;
-    GenericEventQueue& m_asyncEventQueue;
+    ScriptExecutionContext* m_scriptExecutionContext;
+    GenericEventQueue m_asyncEventQueue;
 
     Vector<RefPtr<SourceBuffer> > m_list;
 };
@@ -86,4 +88,5 @@ private:
 } // namespace WebCore
 
 #endif
+
 #endif
index 5b14ad8..b86f6aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
  
 [
     Conditional=MEDIA_SOURCE,
+    NoInterfaceObject,
     EventTarget,
-    InterfaceName=WebKitSourceBufferList
-] interface SourceBufferList {
+    JSGenerateToNativeObject,
+    CallWith=ScriptExecutionContext
+] interface SourceBufferList : EventTarget {
     readonly attribute unsigned long length;
     getter SourceBuffer item(unsigned long index);
-
-    // EventTarget interface
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event event);
 };
 
diff --git a/Source/WebCore/Modules/mediasource/URLMediaSource.cpp b/Source/WebCore/Modules/mediasource/URLMediaSource.cpp
new file mode 100644 (file)
index 0000000..b8101df
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "URLMediaSource.h"
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "DOMURL.h"
+#include "MediaSourceBase.h"
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+String URLMediaSource::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaSourceBase* source)
+{
+    // Since WebWorkers cannot obtain MediaSource objects, we should be on the main thread.
+    ASSERT(isMainThread());
+
+    if (!scriptExecutionContext || !source)
+        return String();
+    return DOMURL::createPublicURL(scriptExecutionContext, source);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediasource/URLMediaSource.h b/Source/WebCore/Modules/mediasource/URLMediaSource.h
new file mode 100644 (file)
index 0000000..9655efb
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URLMediaSource_h
+#define URLMediaSource_h
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class MediaSourceBase;
+class ScriptExecutionContext;
+
+class URLMediaSource {
+public:
+    static String createObjectURL(ScriptExecutionContext*, MediaSourceBase*);
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif
diff --git a/Source/WebCore/Modules/mediasource/URLMediaSource.idl b/Source/WebCore/Modules/mediasource/URLMediaSource.idl
new file mode 100644 (file)
index 0000000..9e5fe83
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    Conditional=MEDIA_SOURCE
+]
+partial interface URL {
+    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaSource? source);
+    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(WebKitMediaSource? source);
+};
diff --git a/Source/WebCore/Modules/mediasource/WebKitMediaSource.cpp b/Source/WebCore/Modules/mediasource/WebKitMediaSource.cpp
new file mode 100644 (file)
index 0000000..187b060
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitMediaSource.h"
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "ContentType.h"
+#include "ExceptionCodePlaceholder.h"
+#include "MIMETypeRegistry.h"
+#include "MediaSourceRegistry.h"
+#include "SourceBufferPrivate.h"
+#include "TimeRanges.h"
+#include <runtime/Uint8Array.h>
+
+namespace WebCore {
+
+PassRefPtr<WebKitMediaSource> WebKitMediaSource::create(ScriptExecutionContext* context)
+{
+    RefPtr<WebKitMediaSource> mediaSource(adoptRef(new WebKitMediaSource(context)));
+    mediaSource->suspendIfNeeded();
+    return mediaSource.release();
+}
+
+WebKitMediaSource::WebKitMediaSource(ScriptExecutionContext* context)
+    : MediaSourceBase(context)
+    , m_asyncEventQueue(*this)
+    , m_sourceBuffers(WebKitSourceBufferList::create(scriptExecutionContext()))
+    , m_activeSourceBuffers(WebKitSourceBufferList::create(scriptExecutionContext()))
+{
+}
+
+WebKitSourceBufferList* WebKitMediaSource::sourceBuffers()
+{
+    return m_sourceBuffers.get();
+}
+
+WebKitSourceBufferList* WebKitMediaSource::activeSourceBuffers()
+{
+    // FIXME(91649): support track selection
+    return m_activeSourceBuffers.get();
+}
+
+WebKitSourceBuffer* WebKitMediaSource::addSourceBuffer(const String& type, ExceptionCode& ec)
+{
+    // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-addsourcebuffer
+    // 1. If type is null or an empty then throw an INVALID_ACCESS_ERR exception and
+    // abort these steps.
+    if (type.isNull() || type.isEmpty()) {
+        ec = INVALID_ACCESS_ERR;
+        return 0;
+    }
+
+    // 2. If type contains a MIME type that is not supported ..., then throw a
+    // NOT_SUPPORTED_ERR exception and abort these steps.
+    if (!isTypeSupported(type)) {
+        ec = NOT_SUPPORTED_ERR;
+        return 0;
+    }
+
+    // 4. If the readyState attribute is not in the "open" state then throw an
+    // INVALID_STATE_ERR exception and abort these steps.
+    if (!isOpen()) {
+        ec = INVALID_STATE_ERR;
+        return 0;
+    }
+
+    // 5. Create a new SourceBuffer object and associated resources.
+    ContentType contentType(type);
+    Vector<String> codecs = contentType.codecs();
+    OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate(contentType.type(), codecs, ec);
+    if (!sourceBufferPrivate)
+        return 0;
+
+    RefPtr<WebKitSourceBuffer> buffer = WebKitSourceBuffer::create(sourceBufferPrivate.release(), this);
+    // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
+    m_sourceBuffers->add(buffer);
+    m_activeSourceBuffers->add(buffer);
+    // 7. Return the new object to the caller.
+    return buffer.get();
+}
+
+void WebKitMediaSource::removeSourceBuffer(WebKitSourceBuffer* buffer, ExceptionCode& ec)
+{
+    // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-removesourcebuffer
+    // 1. If sourceBuffer is null then throw an INVALID_ACCESS_ERR exception and
+    // abort these steps.
+    if (!buffer) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    // 2. If sourceBuffers is empty then throw an INVALID_STATE_ERR exception and
+    // abort these steps.
+    if (isClosed() || !m_sourceBuffers->length()) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    // 3. If sourceBuffer specifies an object that is not in sourceBuffers then
+    // throw a NOT_FOUND_ERR exception and abort these steps.
+    // 6. Remove sourceBuffer from sourceBuffers and fire a removesourcebuffer event
+    // on that object.
+    if (!m_sourceBuffers->remove(buffer)) {
+        ec = NOT_FOUND_ERR;
+        return;
+    }
+
+    // 7. Destroy all resources for sourceBuffer.
+    m_activeSourceBuffers->remove(buffer);
+
+    // 4. Remove track information from audioTracks, videoTracks, and textTracks for all tracks
+    // associated with sourceBuffer and fire a simple event named change on the modified lists.
+    // FIXME(91649): support track selection
+
+    // 5. If sourceBuffer is in activeSourceBuffers, then remove it from that list and fire a
+    // removesourcebuffer event on that object.
+    // FIXME(91649): support track selection
+}
+
+void WebKitMediaSource::onReadyStateChange(const AtomicString& oldState, const AtomicString& newState)
+{
+    if (isClosed()) {
+        m_sourceBuffers->clear();
+        m_activeSourceBuffers->clear();
+        scheduleEvent(eventNames().webkitsourcecloseEvent);
+        return;
+    }
+
+    if (oldState == openKeyword() && newState == endedKeyword()) {
+        scheduleEvent(eventNames().webkitsourceendedEvent);
+        return;
+    }
+
+    if (isOpen()) {
+        scheduleEvent(eventNames().webkitsourceopenEvent);
+        return;
+    }
+}
+
+Vector<RefPtr<TimeRanges> > WebKitMediaSource::activeRanges() const
+{
+    Vector<RefPtr<TimeRanges> > activeRanges(m_activeSourceBuffers->length());
+    for (size_t i = 0; i < m_activeSourceBuffers->length(); ++i)
+        activeRanges[i] = m_activeSourceBuffers->item(i)->buffered(ASSERT_NO_EXCEPTION);
+
+    return activeRanges;
+}
+
+bool WebKitMediaSource::isTypeSupported(const String& type)
+{
+    // Section 2.1 isTypeSupported() method steps.
+    // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type
+    // 1. If type is an empty string, then return false.
+    if (type.isNull() || type.isEmpty())
+        return false;
+
+    ContentType contentType(type);
+    String codecs = contentType.parameter("codecs");
+
+    // 2. If type does not contain a valid MIME type string, then return false.
+    if (contentType.type().isEmpty() || codecs.isEmpty())
+        return false;
+
+    // 3. If type contains a media type or media subtype that the MediaSource does not support, then return false.
+    // 4. If type contains at a codec that the MediaSource does not support, then return false.
+    // 5. If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false.
+    // 6. Return true.
+    return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs);
+}
+
+const AtomicString& WebKitMediaSource::interfaceName() const
+{
+    return eventNames().interfaceForWebKitMediaSource;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediasource/WebKitMediaSource.h b/Source/WebCore/Modules/mediasource/WebKitMediaSource.h
new file mode 100644 (file)
index 0000000..e7dae79
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitMediaSource_h
+#define WebKitMediaSource_h
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "MediaSourceBase.h"
+#include "ScriptWrappable.h"
+#include "WebKitSourceBuffer.h"
+#include "WebKitSourceBufferList.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class WebKitMediaSource : public MediaSourceBase, public ScriptWrappable {
+public:
+    static PassRefPtr<WebKitMediaSource> create(ScriptExecutionContext*);
+    virtual ~WebKitMediaSource() { }
+
+    // WebKitMediaSource.idl methods
+    WebKitSourceBufferList* sourceBuffers();
+    WebKitSourceBufferList* activeSourceBuffers();
+    WebKitSourceBuffer* addSourceBuffer(const String& type, ExceptionCode&);
+    void removeSourceBuffer(WebKitSourceBuffer*, ExceptionCode&);
+    static bool isTypeSupported(const String& type);
+
+    // EventTarget interface
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+
+    using RefCounted<MediaSourceBase>::ref;
+    using RefCounted<MediaSourceBase>::deref;
+
+private:
+    explicit WebKitMediaSource(ScriptExecutionContext*);
+
+    // MediaSourceBase interface
+    virtual void onReadyStateChange(const AtomicString&, const AtomicString&) OVERRIDE;
+    virtual Vector<RefPtr<TimeRanges> > activeRanges() const OVERRIDE;
+
+    GenericEventQueue m_asyncEventQueue;
+    RefPtr<WebKitSourceBufferList> m_sourceBuffers;
+    RefPtr<WebKitSourceBufferList> m_activeSourceBuffers;
+};
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/Modules/mediasource/WebKitMediaSource.idl b/Source/WebCore/Modules/mediasource/WebKitMediaSource.idl
new file mode 100644 (file)
index 0000000..bd3ebf7
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    Conditional=MEDIA_SOURCE,
+    ActiveDOMObject,
+    EventTarget,
+    JSGenerateToNativeObject,
+    Constructor,
+    ConstructorCallWith=ScriptExecutionContext
+] interface WebKitMediaSource : EventTarget {
+    // All the source buffers created by this object.
+    readonly attribute WebKitSourceBufferList sourceBuffers;
+
+    // Subset of sourceBuffers that provide data for the selected/enabled tracks.
+    readonly attribute WebKitSourceBufferList activeSourceBuffers;
+
+    [SetterRaisesException] attribute double duration;
+
+    [RaisesException] WebKitSourceBuffer addSourceBuffer(DOMString type);
+    [RaisesException] void removeSourceBuffer(WebKitSourceBuffer buffer);
+
+    readonly attribute DOMString readyState;
+    
+    [RaisesException] void endOfStream([Default=NullString] optional DOMString error);
+
+    static boolean isTypeSupported (DOMString type);
+};
+
diff --git a/Source/WebCore/Modules/mediasource/WebKitSourceBuffer.cpp b/Source/WebCore/Modules/mediasource/WebKitSourceBuffer.cpp
new file mode 100644 (file)
index 0000000..0970847
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitSourceBuffer.h"
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "SourceBufferPrivate.h"
+#include "TimeRanges.h"
+#include "WebKitMediaSource.h"
+#include <runtime/Uint8Array.h>
+
+namespace WebCore {
+
+PassRefPtr<WebKitSourceBuffer> WebKitSourceBuffer::create(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, PassRefPtr<WebKitMediaSource> source)
+{
+    return adoptRef(new WebKitSourceBuffer(sourceBufferPrivate, source));
+}
+
+WebKitSourceBuffer::WebKitSourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, PassRefPtr<WebKitMediaSource> source)
+    : m_private(sourceBufferPrivate)
+    , m_source(source)
+    , m_timestampOffset(0)
+{
+    ASSERT(m_private);
+    ASSERT(m_source);
+}
+
+WebKitSourceBuffer::~WebKitSourceBuffer()
+{
+}
+
+PassRefPtr<TimeRanges> WebKitSourceBuffer::buffered(ExceptionCode& ec) const
+{
+    // Section 3.1 buffered attribute steps.
+    // 1. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an
+    //    INVALID_STATE_ERR exception and abort these steps.
+    if (isRemoved()) {
+        ec = INVALID_STATE_ERR;
+        return 0;
+    }
+
+    // 2. Return a new static normalized TimeRanges object for the media segments buffered.
+    return m_private->buffered();
+}
+
+double WebKitSourceBuffer::timestampOffset() const
+{
+    return m_timestampOffset;
+}
+
+void WebKitSourceBuffer::setTimestampOffset(double offset, ExceptionCode& ec)
+{
+    // Section 3.1 timestampOffset attribute setter steps.
+    // 1. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an
+    //    INVALID_STATE_ERR exception and abort these steps.
+    if (isRemoved()) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    // 4. If the readyState attribute of the parent media source is in the "ended" state then run the following steps:
+    // 4.1 Set the readyState attribute of the parent media source to "open"
+    // 4.2 Queue a task to fire a simple event named sourceopen at the parent media source.
+    m_source->openIfInEndedState();
+
+    // 5. If this object is waiting for the end of a media segment to be appended, then throw an INVALID_STATE_ERR
+    // and abort these steps.
+    if (!m_private->setTimestampOffset(offset)) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    // 6. Update the attribute to the new value.
+    m_timestampOffset = offset;
+}
+
+void WebKitSourceBuffer::append(PassRefPtr<Uint8Array> data, ExceptionCode& ec)
+{
+    // SourceBuffer.append() steps from October 1st version of the Media Source Extensions spec.
+    // https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/media-source.html#dom-append
+
+    // 2. If data is null then throw an INVALID_ACCESS_ERR exception and abort these steps.
+    if (!data) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    // 3. If this object has been removed from the sourceBuffers attribute of media source then throw
+    //    an INVALID_STATE_ERR exception and abort these steps.
+    if (isRemoved()) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    // 5. If the readyState attribute of media source is in the "ended" state then run the following steps:
+    // 5.1. Set the readyState attribute of media source to "open"
+    // 5.2. Queue a task to fire a simple event named sourceopen at media source.
+    m_source->openIfInEndedState();
+
+    // Steps 6 & beyond are handled by the private implementation.
+    m_private->append(data->data(), data->length());
+}
+
+void WebKitSourceBuffer::abort(ExceptionCode& ec)
+{
+    // Section 3.2 abort() method steps.
+    // 1. If this object has been removed from the sourceBuffers attribute of the parent media source
+    //    then throw an INVALID_STATE_ERR exception and abort these steps.
+    // 2. If the readyState attribute of the parent media source is not in the "open" state
+    //    then throw an INVALID_STATE_ERR exception and abort these steps.
+    if (isRemoved() || !m_source->isOpen()) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    // 4. Run the reset parser state algorithm.
+    m_private->abort();
+}
+
+void WebKitSourceBuffer::removedFromMediaSource()
+{
+    if (isRemoved())
+        return;
+
+    m_private->removedFromMediaSource();
+    m_source.clear();
+}
+
+bool WebKitSourceBuffer::isRemoved() const
+{
+    return !m_source;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediasource/WebKitSourceBuffer.h b/Source/WebCore/Modules/mediasource/WebKitSourceBuffer.h
new file mode 100644 (file)
index 0000000..fc8455a
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitSourceBuffer_h
+#define WebKitSourceBuffer_h
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "ExceptionCode.h"
+#include "ScriptWrappable.h"
+#include <runtime/Uint8Array.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+class SourceBufferPrivate;
+class TimeRanges;
+class WebKitMediaSource;
+
+class WebKitSourceBuffer : public RefCounted<WebKitSourceBuffer>, public ScriptWrappable {
+public:
+    static PassRefPtr<WebKitSourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, PassRefPtr<WebKitMediaSource>);
+
+    virtual ~WebKitSourceBuffer();
+
+    // WebKitSourceBuffer.idl methods
+    PassRefPtr<TimeRanges> buffered(ExceptionCode&) const;
+    double timestampOffset() const;
+    void setTimestampOffset(double, ExceptionCode&);
+    void append(PassRefPtr<JSC::Uint8Array> data, ExceptionCode&);
+    void abort(ExceptionCode&);
+
+    void removedFromMediaSource();
+
+private:
+    WebKitSourceBuffer(PassOwnPtr<SourceBufferPrivate>, PassRefPtr<WebKitMediaSource>);
+
+    bool isRemoved() const;
+
+    OwnPtr<SourceBufferPrivate> m_private;
+    RefPtr<WebKitMediaSource> m_source;
+
+    double m_timestampOffset;
+};
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/Modules/mediasource/WebKitSourceBuffer.idl b/Source/WebCore/Modules/mediasource/WebKitSourceBuffer.idl
new file mode 100644 (file)
index 0000000..62923b3
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    Conditional=MEDIA_SOURCE
+] interface WebKitSourceBuffer {
+
+    // Returns the time ranges buffered.
+    [GetterRaisesException] readonly attribute TimeRanges buffered;
+
+    // Applies an offset to media segment timestamps.
+    [SetterRaisesException] attribute double timestampOffset;
+
+    // Append segment data.
+    [RaisesException] void append(Uint8Array data);
+
+    // Abort the current segment append sequence.
+    [RaisesException] void abort();
+};
+
diff --git a/Source/WebCore/Modules/mediasource/WebKitSourceBufferList.cpp b/Source/WebCore/Modules/mediasource/WebKitSourceBufferList.cpp
new file mode 100644 (file)
index 0000000..cef66e4
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitSourceBufferList.h"
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "Event.h"
+#include "WebKitSourceBuffer.h"
+
+namespace WebCore {
+
+WebKitSourceBufferList::WebKitSourceBufferList(ScriptExecutionContext* context)
+    : m_scriptExecutionContext(context)
+    , m_asyncEventQueue(*this)
+{
+}
+
+WebKitSourceBufferList::~WebKitSourceBufferList()
+{
+}
+
+unsigned WebKitSourceBufferList::length() const
+{
+    return m_list.size();
+}
+
+WebKitSourceBuffer* WebKitSourceBufferList::item(unsigned index) const
+{
+    if (index >= m_list.size())
+        return 0;
+    return m_list[index].get();
+}
+
+void WebKitSourceBufferList::add(PassRefPtr<WebKitSourceBuffer> buffer)
+{
+    m_list.append(buffer);
+    createAndFireEvent(eventNames().webkitaddsourcebufferEvent);
+}
+
+bool WebKitSourceBufferList::remove(WebKitSourceBuffer* buffer)
+{
+    size_t index = m_list.find(buffer);
+    if (index == notFound)
+        return false;
+
+    buffer->removedFromMediaSource();
+    m_list.remove(index);
+    createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
+    return true;
+}
+
+void WebKitSourceBufferList::clear()
+{
+    for (size_t i = 0; i < m_list.size(); ++i)
+        m_list[i]->removedFromMediaSource();
+    m_list.clear();
+    createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
+}
+
+void WebKitSourceBufferList::createAndFireEvent(const AtomicString& eventName)
+{
+    RefPtr<Event> event = Event::create(eventName, false, false);
+    event->setTarget(this);
+    m_asyncEventQueue.enqueueEvent(event.release());
+}
+
+const AtomicString& WebKitSourceBufferList::interfaceName() const
+{
+    return eventNames().interfaceForWebKitSourceBufferList;
+}
+
+ScriptExecutionContext* WebKitSourceBufferList::scriptExecutionContext() const
+{
+    return m_scriptExecutionContext;
+}
+
+EventTargetData* WebKitSourceBufferList::eventTargetData()
+{
+    return &m_eventTargetData;
+}
+
+EventTargetData& WebKitSourceBufferList::ensureEventTargetData()
+{
+    return m_eventTargetData;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediasource/WebKitSourceBufferList.h b/Source/WebCore/Modules/mediasource/WebKitSourceBufferList.h
new file mode 100644 (file)
index 0000000..d8e2b4b
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitSourceBufferList_h
+#define WebKitSourceBufferList_h
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include "EventTarget.h"
+#include "GenericEventQueue.h"
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class WebKitSourceBuffer;
+class GenericEventQueue;
+
+class WebKitSourceBufferList : public RefCounted<WebKitSourceBufferList>, public ScriptWrappable, public EventTarget {
+public:
+    static PassRefPtr<WebKitSourceBufferList> create(ScriptExecutionContext* context)
+    {
+        return adoptRef(new WebKitSourceBufferList(context));
+    }
+    virtual ~WebKitSourceBufferList();
+
+    unsigned length() const;
+    WebKitSourceBuffer* item(unsigned index) const;
+
+    void add(PassRefPtr<WebKitSourceBuffer>);
+    bool remove(WebKitSourceBuffer*);
+    void clear();
+
+    // EventTarget interface
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+
+    using RefCounted<WebKitSourceBufferList>::ref;
+    using RefCounted<WebKitSourceBufferList>::deref;
+
+protected:
+    virtual EventTargetData* eventTargetData() OVERRIDE;
+    virtual EventTargetData& ensureEventTargetData() OVERRIDE;
+
+private:
+    WebKitSourceBufferList(ScriptExecutionContext*);
+
+    void createAndFireEvent(const AtomicString&);
+
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
+
+    EventTargetData m_eventTargetData;
+    ScriptExecutionContext* m_scriptExecutionContext;
+    GenericEventQueue m_asyncEventQueue;
+
+    Vector<RefPtr<WebKitSourceBuffer> > m_list;
+};
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/Modules/mediasource/WebKitSourceBufferList.idl b/Source/WebCore/Modules/mediasource/WebKitSourceBufferList.idl
new file mode 100644 (file)
index 0000000..661b9a1
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    Conditional=MEDIA_SOURCE,
+    EventTarget,
+    JSGenerateToNativeObject
+] interface WebKitSourceBufferList : EventTarget {
+    readonly attribute unsigned long length;
+    getter WebKitSourceBuffer item(unsigned long index);
+};
+
index b810fa8..e316631 100644 (file)
@@ -31,6 +31,7 @@
 #include "Event.h"
 #include "ExceptionCode.h"
 #include "MediaStreamCenter.h"
+#include "MediaStreamRegistry.h"
 #include "MediaStreamSource.h"
 #include "MediaStreamTrackEvent.h"
 
@@ -353,6 +354,11 @@ void MediaStream::scheduledEventTimerFired(Timer<MediaStream>*)
     events.clear();
 }
 
+URLRegistry& MediaStream::registry() const
+{
+    return MediaStreamRegistry::registry();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index 6ae4d99..6338055 100644 (file)
 #include "MediaStreamTrack.h"
 #include "ScriptWrappable.h"
 #include "Timer.h"
+#include "URLRegistry.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
-class MediaStream : public RefCounted<MediaStream>, public ScriptWrappable, public MediaStreamDescriptorClient, public EventTarget, public ContextDestructionObserver {
+class MediaStream : public RefCounted<MediaStream>, public URLRegistrable, public ScriptWrappable, public MediaStreamDescriptorClient, public EventTarget, public ContextDestructionObserver {
 public:
     static PassRefPtr<MediaStream> create(ScriptExecutionContext*);
     static PassRefPtr<MediaStream> create(ScriptExecutionContext*, PassRefPtr<MediaStream>);
@@ -77,6 +78,9 @@ public:
     using RefCounted<MediaStream>::ref;
     using RefCounted<MediaStream>::deref;
 
+    // URLRegistrable
+    virtual URLRegistry& registry() const OVERRIDE;
+
 protected:
     MediaStream(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>);
 
index ce57696..36d27e6 100644 (file)
@@ -41,13 +41,14 @@ MediaStreamRegistry& MediaStreamRegistry::registry()
     return instance;
 }
 
-void MediaStreamRegistry::registerMediaStreamURL(const KURL& url, PassRefPtr<MediaStream> stream)
+void MediaStreamRegistry::registerURL(SecurityOrigin*, const KURL& url, URLRegistrable* stream)
 {
+    ASSERT(&stream->registry() == this);
     ASSERT(isMainThread());
-    m_streamDescriptors.set(url.string(), stream->descriptor());
+    m_streamDescriptors.set(url.string(), static_cast<MediaStream*>(stream)->descriptor());
 }
 
-void MediaStreamRegistry::unregisterMediaStreamURL(const KURL& url)
+void MediaStreamRegistry::unregisterURL(const KURL& url)
 {
     ASSERT(isMainThread());
     m_streamDescriptors.remove(url.string());
index 1f92745..e8be4c1 100644 (file)
@@ -27,6 +27,7 @@
 
 #if ENABLE(MEDIA_STREAM)
 
+#include "URLRegistry.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/StringHash.h>
@@ -37,14 +38,14 @@ class KURL;
 class MediaStream;
 class MediaStreamDescriptor;
 
-class MediaStreamRegistry {
+class MediaStreamRegistry : public URLRegistry {
 public:
     // Returns a single instance of MediaStreamRegistry.
     static MediaStreamRegistry& registry();
 
     // Registers a blob URL referring to the specified stream data.
-    void registerMediaStreamURL(const KURL&, PassRefPtr<MediaStream>);
-    void unregisterMediaStreamURL(const KURL&);
+    virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVERRIDE;
+    virtual void unregisterURL(const KURL&) OVERRIDE;
 
     MediaStreamDescriptor* lookupMediaStreamDescriptor(const String& url);
 
diff --git a/Source/WebCore/Modules/mediastream/URLMediaStream.cpp b/Source/WebCore/Modules/mediastream/URLMediaStream.cpp
new file mode 100644 (file)
index 0000000..c959af7
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "URLMediaStream.h"
+
+#include "DOMURL.h"
+#include "MediaStream.h"
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+String URLMediaStream::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaStream* stream)
+{
+    // Since WebWorkers cannot obtain Stream objects, we should be on the main thread.
+    ASSERT(isMainThread());
+
+    if (!scriptExecutionContext || !stream)
+        return String();
+    return DOMURL::createPublicURL(scriptExecutionContext, stream);
+}
+
+
+} // namespace WebCore
diff --git a/Source/WebCore/Modules/mediastream/URLMediaStream.h b/Source/WebCore/Modules/mediastream/URLMediaStream.h
new file mode 100644 (file)
index 0000000..6fbac0b
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URLMediaStream_h
+#define URLMediaStream_h
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class MediaStream;
+class ScriptExecutionContext;
+
+class URLMediaStream {
+public:
+    static String createObjectURL(ScriptExecutionContext*, MediaStream*);
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/URLMediaStream.idl b/Source/WebCore/Modules/mediastream/URLMediaStream.idl
new file mode 100644 (file)
index 0000000..3b8edb5
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+partial interface URL {
+    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaStream? stream);
+};
index 2a19a62..a43496a 100644 (file)
@@ -693,6 +693,7 @@ SOURCES += \
     html/NumberInputType.cpp \
     html/PasswordInputType.cpp \
     html/PluginDocument.cpp \
+    html/PublicURLManager.cpp \
     html/RadioInputType.cpp \
     html/RadioNodeList.cpp \
     html/RangeInputType.cpp \
index ee18ffe..754bdd0 100644 (file)
                0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642956 /* GestureEvent.cpp */; };
                0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642955 /* GenericEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0720B0A114D3323500642957 /* GestureEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642957 /* GestureEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               07277E4A17D018CC0015534D /* JSMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E3E17D018CC0015534D /* JSMediaSource.cpp */; };
-               07277E4B17D018CC0015534D /* JSMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E3F17D018CC0015534D /* JSMediaSource.h */; };
                07277E4C17D018CC0015534D /* JSMediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4017D018CC0015534D /* JSMediaStream.cpp */; };
                07277E4D17D018CC0015534D /* JSMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4117D018CC0015534D /* JSMediaStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07277E4E17D018CC0015534D /* JSMediaStreamAudioDestinationNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4217D018CC0015534D /* JSMediaStreamAudioDestinationNode.cpp */; };
                CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E2145767580078207D /* JSMediaController.cpp */; };
                CD27F6E7145770D30078207D /* MediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E6145770D30078207D /* MediaController.cpp */; };
                CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */; };
+               CD3A495217A9C8C600274E42 /* MediaSourceBase.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495117A9C8B600274E42 /* MediaSourceBase.h */; };
+               CD3A495417A9CC9000274E42 /* MediaSourceBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3A495017A9C8B600274E42 /* MediaSourceBase.cpp */; };
+               CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3A495517A9D01B00274E42 /* MediaSource.cpp */; };
+               CD3A495F17A9D01B00274E42 /* MediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495617A9D01B00274E42 /* MediaSource.h */; };
+               CD3A496117A9D01B00274E42 /* SourceBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3A495817A9D01B00274E42 /* SourceBuffer.cpp */; };
+               CD3A496217A9D01B00274E42 /* SourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495917A9D01B00274E42 /* SourceBuffer.h */; };
+               CD3A496417A9D01B00274E42 /* SourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3A495B17A9D01B00274E42 /* SourceBufferList.cpp */; };
+               CD3A496517A9D01B00274E42 /* SourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495C17A9D01B00274E42 /* SourceBufferList.h */; };
                CD47B3FC16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */; };
                CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; };
                CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */; };
                CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5393D2175E018600C07123 /* JSMemoryInfo.h */; };
                CD54DE4717468B6F005E5B36 /* AudioSessionManagerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD54DE4517468B6F005E5B36 /* AudioSessionManagerMac.cpp */; };
                CD54DE4B17469C6D005E5B36 /* AudioSessionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD54DE4917469C6D005E5B36 /* AudioSessionMac.cpp */; };
+               CD61FE631794AADB004101EB /* WebKitMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1A942DE15B5CE2200D525D1 /* WebKitMediaSource.cpp */; };
+               CD61FE641794AADB004101EB /* WebKitMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B1A942DF15B5CE2200D525D1 /* WebKitMediaSource.h */; };
+               CD61FE671794AADB004101EB /* MediaSourceRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1A942E115B5CE2200D525D1 /* MediaSourceRegistry.cpp */; };
+               CD61FE681794AADB004101EB /* MediaSourceRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = B1A942E215B5CE2200D525D1 /* MediaSourceRegistry.h */; };
+               CD61FE691794AADB004101EB /* WebKitSourceBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1A942E315B5CE2200D525D1 /* WebKitSourceBuffer.cpp */; };
+               CD61FE6A1794AADB004101EB /* WebKitSourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B1A942E415B5CE2200D525D1 /* WebKitSourceBuffer.h */; };
+               CD61FE6B1794AADB004101EB /* WebKitSourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1A942E615B5CE2200D525D1 /* WebKitSourceBufferList.cpp */; };
+               CD61FE6C1794AADB004101EB /* WebKitSourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = B1A942E715B5CE2200D525D1 /* WebKitSourceBufferList.h */; };
+               CD61FE7E1794CB26004101EB /* JSWebKitMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD61FE7C1794CB26004101EB /* JSWebKitMediaSource.cpp */; };
+               CD61FE7F1794CB26004101EB /* JSWebKitMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD61FE7D1794CB26004101EB /* JSWebKitMediaSource.h */; };
+               CD61FE841794CC59004101EB /* JSWebKitSourceBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD61FE801794CC59004101EB /* JSWebKitSourceBuffer.cpp */; };
+               CD61FE851794CC59004101EB /* JSWebKitSourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD61FE811794CC59004101EB /* JSWebKitSourceBuffer.h */; };
+               CD61FE861794CC59004101EB /* JSWebKitSourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD61FE821794CC59004101EB /* JSWebKitSourceBufferList.cpp */; };
+               CD61FE871794CC59004101EB /* JSWebKitSourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = CD61FE831794CC59004101EB /* JSWebKitSourceBufferList.h */; };
                CD7E05221651C28200C1201F /* WebCoreAVFResourceLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */; };
                CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; settings = {COMPILER_FLAGS = "-Wno-undef -Wno-deprecated-declarations"; }; };
                CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */; };
                CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */; };
+               CD9DE17417AAC74C00EA386D /* JSMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD9DE17217AAC74C00EA386D /* JSMediaSource.cpp */; };
+               CD9DE17517AAC74C00EA386D /* JSMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD9DE17317AAC74C00EA386D /* JSMediaSource.h */; };
+               CD9DE17A17AAC75B00EA386D /* JSSourceBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD9DE17617AAC75B00EA386D /* JSSourceBuffer.cpp */; };
+               CD9DE17B17AAC75B00EA386D /* JSSourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD9DE17717AAC75B00EA386D /* JSSourceBuffer.h */; };
+               CD9DE17C17AAC75B00EA386D /* JSSourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD9DE17817AAC75B00EA386D /* JSSourceBufferList.cpp */; };
+               CD9DE17D17AAC75B00EA386D /* JSSourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = CD9DE17917AAC75B00EA386D /* JSSourceBufferList.h */; };
+               CD9DE18117AAD6A400EA386D /* URLMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD9DE17E17AAD64E00EA386D /* URLMediaSource.cpp */; };
+               CD9DE18217AAD6A400EA386D /* URLMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD9DE17F17AAD64E00EA386D /* URLMediaSource.h */; };
+               CD9DE18517AB0CF300EA386D /* HTMLMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD9DE18317AB0CF300EA386D /* HTMLMediaSource.cpp */; };
+               CD9DE18617AB0CF300EA386D /* HTMLMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD9DE18417AB0CF300EA386D /* HTMLMediaSource.h */; };
                CDA79824170A258300D45C55 /* AudioSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDA79823170A258300D45C55 /* AudioSession.cpp */; };
                CDA79827170A279100D45C55 /* AudioSessionIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDA79825170A279000D45C55 /* AudioSessionIOS.mm */; };
                CDA7982A170A3D0000D45C55 /* AudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA79821170A22DC00D45C55 /* AudioSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CDEA76351460B71A008B31F1 /* Clock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA76331460B462008B31F1 /* Clock.cpp */; };
                CDEA7C841276230400B846DD /* RenderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEA7C821276230400B846DD /* RenderFullScreen.h */; };
                CDEA7C851276230400B846DD /* RenderFullScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA7C831276230400B846DD /* RenderFullScreen.cpp */; };
+               CDEE393717974259001D7580 /* PublicURLManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEE393617974259001D7580 /* PublicURLManager.cpp */; };
                CDF65CC8145B1E7500C4C7AA /* MediaController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD27F6E4145767870078207D /* MediaController.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CDF65CCA145B448800C4C7AA /* MediaControllerInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE02F0C411E83ADD00C6684A /* ScriptControllerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07221BAE17CF0AD400848E51 /* RTCStatsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCStatsRequest.h; sourceTree = "<group>"; };
                07221BAF17CF0AD400848E51 /* RTCStatsResponseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCStatsResponseBase.h; sourceTree = "<group>"; };
                07221BB017CF0AD400848E51 /* RTCVoidRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCVoidRequest.h; sourceTree = "<group>"; };
-               07277E3E17D018CC0015534D /* JSMediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSource.cpp; sourceTree = "<group>"; };
-               07277E3F17D018CC0015534D /* JSMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSource.h; sourceTree = "<group>"; };
                07277E4017D018CC0015534D /* JSMediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStream.cpp; sourceTree = "<group>"; };
                07277E4117D018CC0015534D /* JSMediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaStream.h; sourceTree = "<group>"; };
                07277E4217D018CC0015534D /* JSMediaStreamAudioDestinationNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamAudioDestinationNode.cpp; sourceTree = "<group>"; };
                B10B697E140C174000BC1C26 /* WebVTTTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTTokenizer.cpp; sourceTree = "<group>"; };
                B10B697F140C174000BC1C26 /* WebVTTTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTTokenizer.h; sourceTree = "<group>"; };
                B1827492134CA4C100B98C2D /* CallbackFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallbackFunction.cpp; sourceTree = "<group>"; };
-               B1A942DE15B5CE2200D525D1 /* MediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSource.cpp; sourceTree = "<group>"; };
-               B1A942DF15B5CE2200D525D1 /* MediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSource.h; sourceTree = "<group>"; };
-               B1A942E015B5CE2200D525D1 /* MediaSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaSource.idl; sourceTree = "<group>"; };
+               B1A942DE15B5CE2200D525D1 /* WebKitMediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitMediaSource.cpp; sourceTree = "<group>"; };
+               B1A942DF15B5CE2200D525D1 /* WebKitMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitMediaSource.h; sourceTree = "<group>"; };
+               B1A942E015B5CE2200D525D1 /* WebKitMediaSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitMediaSource.idl; sourceTree = "<group>"; };
                B1A942E115B5CE2200D525D1 /* MediaSourceRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSourceRegistry.cpp; sourceTree = "<group>"; };
                B1A942E215B5CE2200D525D1 /* MediaSourceRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourceRegistry.h; sourceTree = "<group>"; };
-               B1A942E315B5CE2200D525D1 /* SourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBuffer.cpp; sourceTree = "<group>"; };
-               B1A942E415B5CE2200D525D1 /* SourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBuffer.h; sourceTree = "<group>"; };
-               B1A942E515B5CE2200D525D1 /* SourceBuffer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBuffer.idl; sourceTree = "<group>"; };
-               B1A942E615B5CE2200D525D1 /* SourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBufferList.cpp; sourceTree = "<group>"; };
-               B1A942E715B5CE2200D525D1 /* SourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferList.h; sourceTree = "<group>"; };
-               B1A942E815B5CE2200D525D1 /* SourceBufferList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBufferList.idl; sourceTree = "<group>"; };
+               B1A942E315B5CE2200D525D1 /* WebKitSourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitSourceBuffer.cpp; sourceTree = "<group>"; };
+               B1A942E415B5CE2200D525D1 /* WebKitSourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitSourceBuffer.h; sourceTree = "<group>"; };
+               B1A942E515B5CE2200D525D1 /* WebKitSourceBuffer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitSourceBuffer.idl; sourceTree = "<group>"; };
+               B1A942E615B5CE2200D525D1 /* WebKitSourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitSourceBufferList.cpp; sourceTree = "<group>"; };
+               B1A942E715B5CE2200D525D1 /* WebKitSourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitSourceBufferList.h; sourceTree = "<group>"; };
+               B1A942E815B5CE2200D525D1 /* WebKitSourceBufferList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitSourceBufferList.idl; sourceTree = "<group>"; };
                B1AD4E7113A12A4600846B27 /* TextTrackLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextTrackLoader.cpp; path = loader/TextTrackLoader.cpp; sourceTree = SOURCE_ROOT; };
                B1AD4E7213A12A4600846B27 /* TextTrackLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextTrackLoader.h; path = loader/TextTrackLoader.h; sourceTree = SOURCE_ROOT; };
                B1D5ECB4134B58DA0087C78F /* CallbackFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackFunction.h; sourceTree = "<group>"; };
                CD27F6E6145770D30078207D /* MediaController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaController.cpp; sourceTree = "<group>"; };
                CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiagnosticLoggingKeys.cpp; sourceTree = "<group>"; };
                CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingKeys.h; sourceTree = "<group>"; };
+               CD3A495017A9C8B600274E42 /* MediaSourceBase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSourceBase.cpp; sourceTree = "<group>"; };
+               CD3A495117A9C8B600274E42 /* MediaSourceBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSourceBase.h; sourceTree = "<group>"; };
+               CD3A495517A9D01B00274E42 /* MediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSource.cpp; sourceTree = "<group>"; };
+               CD3A495617A9D01B00274E42 /* MediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSource.h; sourceTree = "<group>"; };
+               CD3A495717A9D01B00274E42 /* MediaSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaSource.idl; sourceTree = "<group>"; };
+               CD3A495817A9D01B00274E42 /* SourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBuffer.cpp; sourceTree = "<group>"; };
+               CD3A495917A9D01B00274E42 /* SourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBuffer.h; sourceTree = "<group>"; };
+               CD3A495A17A9D01B00274E42 /* SourceBuffer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBuffer.idl; sourceTree = "<group>"; };
+               CD3A495B17A9D01B00274E42 /* SourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBufferList.cpp; sourceTree = "<group>"; };
+               CD3A495C17A9D01B00274E42 /* SourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferList.h; sourceTree = "<group>"; };
+               CD3A495D17A9D01B00274E42 /* SourceBufferList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBufferList.idl; sourceTree = "<group>"; };
                CD47B3F916CC34F800A21EC8 /* CDMPrivateAVFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDMPrivateAVFoundation.h; path = Modules/encryptedmedia/CDMPrivateAVFoundation.h; sourceTree = "<group>"; };
                CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CDMPrivateAVFoundation.mm; path = Modules/encryptedmedia/CDMPrivateAVFoundation.mm; sourceTree = "<group>"; };
                CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; };
                CD5393D2175E018600C07123 /* JSMemoryInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMemoryInfo.h; sourceTree = "<group>"; };
                CD54DE4517468B6F005E5B36 /* AudioSessionManagerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSessionManagerMac.cpp; sourceTree = "<group>"; };
                CD54DE4917469C6D005E5B36 /* AudioSessionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSessionMac.cpp; sourceTree = "<group>"; };
+               CD61FE7C1794CB26004101EB /* JSWebKitMediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitMediaSource.cpp; sourceTree = "<group>"; };
+               CD61FE7D1794CB26004101EB /* JSWebKitMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitMediaSource.h; sourceTree = "<group>"; };
+               CD61FE801794CC59004101EB /* JSWebKitSourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitSourceBuffer.cpp; sourceTree = "<group>"; };
+               CD61FE811794CC59004101EB /* JSWebKitSourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitSourceBuffer.h; sourceTree = "<group>"; };
+               CD61FE821794CC59004101EB /* JSWebKitSourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitSourceBufferList.cpp; sourceTree = "<group>"; };
+               CD61FE831794CC59004101EB /* JSWebKitSourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitSourceBufferList.h; sourceTree = "<group>"; };
                CD7E05201651A84100C1201F /* WebCoreAVFResourceLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebCoreAVFResourceLoader.h; path = objc/WebCoreAVFResourceLoader.h; sourceTree = "<group>"; };
                CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WebCoreAVFResourceLoader.mm; path = objc/WebCoreAVFResourceLoader.mm; sourceTree = "<group>"; };
                CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; };
                CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; };
                CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindowAnimation.h; sourceTree = "<group>"; };
                CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebWindowAnimation.mm; sourceTree = "<group>"; };
+               CD9DE17217AAC74C00EA386D /* JSMediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSource.cpp; sourceTree = "<group>"; };
+               CD9DE17317AAC74C00EA386D /* JSMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSource.h; sourceTree = "<group>"; };
+               CD9DE17617AAC75B00EA386D /* JSSourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSourceBuffer.cpp; sourceTree = "<group>"; };
+               CD9DE17717AAC75B00EA386D /* JSSourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSourceBuffer.h; sourceTree = "<group>"; };
+               CD9DE17817AAC75B00EA386D /* JSSourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSourceBufferList.cpp; sourceTree = "<group>"; };
+               CD9DE17917AAC75B00EA386D /* JSSourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSourceBufferList.h; sourceTree = "<group>"; };
+               CD9DE17E17AAD64E00EA386D /* URLMediaSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = URLMediaSource.cpp; sourceTree = "<group>"; };
+               CD9DE17F17AAD64E00EA386D /* URLMediaSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLMediaSource.h; sourceTree = "<group>"; };
+               CD9DE18017AAD64E00EA386D /* URLMediaSource.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = URLMediaSource.idl; sourceTree = "<group>"; };
+               CD9DE18317AB0CF300EA386D /* HTMLMediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaSource.cpp; sourceTree = "<group>"; };
+               CD9DE18417AB0CF300EA386D /* HTMLMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMediaSource.h; sourceTree = "<group>"; };
                CDA79821170A22DC00D45C55 /* AudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioSession.h; sourceTree = "<group>"; };
                CDA79822170A24F400D45C55 /* AudioSessionListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioSessionListener.h; sourceTree = "<group>"; };
                CDA79823170A258300D45C55 /* AudioSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSession.cpp; sourceTree = "<group>"; };
                CDEA76331460B462008B31F1 /* Clock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Clock.cpp; sourceTree = "<group>"; };
                CDEA7C821276230400B846DD /* RenderFullScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFullScreen.h; sourceTree = "<group>"; };
                CDEA7C831276230400B846DD /* RenderFullScreen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFullScreen.cpp; sourceTree = "<group>"; };
+               CDEE393617974259001D7580 /* PublicURLManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PublicURLManager.cpp; sourceTree = "<group>"; };
+               CDEE393817974274001D7580 /* URLRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLRegistry.h; sourceTree = "<group>"; };
                CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControllerInterface.h; sourceTree = "<group>"; };
                CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMediaElementCustom.cpp; sourceTree = "<group>"; };
                CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptControllerBase.h; sourceTree = "<group>"; };
                07CFD99317D01405001C4FFC /* MediaStream */ = {
                        isa = PBXGroup;
                        children = (
-                               07277E3E17D018CC0015534D /* JSMediaSource.cpp */,
-                               07277E3F17D018CC0015534D /* JSMediaSource.h */,
                                07277E4017D018CC0015534D /* JSMediaStream.cpp */,
                                07277E4117D018CC0015534D /* JSMediaStream.h */,
                                07277E4217D018CC0015534D /* JSMediaStreamAudioDestinationNode.cpp */,
                                A83B79080CCAFF2B000B0825 /* HTML */,
                                AA93C850175D5B2000FD3CE3 /* IndieUI */,
                                1C5FAECA0DCFD8C900D58F78 /* Inspector */,
+                               CD61FE7B1794CA02004101EB /* MediaSource */,
                                07CFD99317D01405001C4FFC /* MediaStream */,
                                33503C9C10179A9A003B47E1 /* Notifications */,
                                1AC226020DB69EA70089B669 /* Offline */,
                                E44613920CD6331000FADA75 /* HTMLMediaElement.cpp */,
                                E44613930CD6331000FADA75 /* HTMLMediaElement.h */,
                                E44613940CD6331000FADA75 /* HTMLMediaElement.idl */,
+                               CD9DE18317AB0CF300EA386D /* HTMLMediaSource.cpp */,
+                               CD9DE18417AB0CF300EA386D /* HTMLMediaSource.h */,
                                A8EA79EC0A1916DF00A8EF5F /* HTMLMenuElement.cpp */,
                                A8EA79E80A1916DF00A8EF5F /* HTMLMenuElement.h */,
                                1AE2AE430A1D269E00B42B25 /* HTMLMenuElement.idl */,
                                F55B3D961251F12D003EF269 /* PasswordInputType.h */,
                                97205AB91239292700B17380 /* PluginDocument.cpp */,
                                97205ABA1239292700B17380 /* PluginDocument.h */,
+                               CDEE393617974259001D7580 /* PublicURLManager.cpp */,
                                10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */,
                                F55B3D971251F12D003EF269 /* RadioInputType.cpp */,
                                F55B3D981251F12D003EF269 /* RadioInputType.h */,
                                C375D7FC16639519006184AB /* TypeAhead.h */,
                                F55B3DA91251F12D003EF269 /* URLInputType.cpp */,
                                F55B3DAA1251F12D003EF269 /* URLInputType.h */,
+                               CDEE393817974274001D7580 /* URLRegistry.h */,
                                F5A154251279534D00D0B0C0 /* ValidationMessage.cpp */,
                                F5A154261279534D00D0B0C0 /* ValidationMessage.h */,
                                15C7708B100D3C6A005BA267 /* ValidityState.cpp */,
                B1A942DD15B5CE2200D525D1 /* mediasource */ = {
                        isa = PBXGroup;
                        children = (
-                               B1A942DE15B5CE2200D525D1 /* MediaSource.cpp */,
-                               B1A942DF15B5CE2200D525D1 /* MediaSource.h */,
-                               B1A942E015B5CE2200D525D1 /* MediaSource.idl */,
+                               CD3A495517A9D01B00274E42 /* MediaSource.cpp */,
+                               CD3A495617A9D01B00274E42 /* MediaSource.h */,
+                               CD3A495717A9D01B00274E42 /* MediaSource.idl */,
+                               CD3A495017A9C8B600274E42 /* MediaSourceBase.cpp */,
+                               CD3A495117A9C8B600274E42 /* MediaSourceBase.h */,
                                B1A942E115B5CE2200D525D1 /* MediaSourceRegistry.cpp */,
                                B1A942E215B5CE2200D525D1 /* MediaSourceRegistry.h */,
-                               B1A942E315B5CE2200D525D1 /* SourceBuffer.cpp */,
-                               B1A942E415B5CE2200D525D1 /* SourceBuffer.h */,
-                               B1A942E515B5CE2200D525D1 /* SourceBuffer.idl */,
-                               B1A942E615B5CE2200D525D1 /* SourceBufferList.cpp */,
-                               B1A942E715B5CE2200D525D1 /* SourceBufferList.h */,
-                               B1A942E815B5CE2200D525D1 /* SourceBufferList.idl */,
+                               CD3A495817A9D01B00274E42 /* SourceBuffer.cpp */,
+                               CD3A495917A9D01B00274E42 /* SourceBuffer.h */,
+                               CD3A495A17A9D01B00274E42 /* SourceBuffer.idl */,
+                               CD3A495B17A9D01B00274E42 /* SourceBufferList.cpp */,
+                               CD3A495C17A9D01B00274E42 /* SourceBufferList.h */,
+                               CD3A495D17A9D01B00274E42 /* SourceBufferList.idl */,
+                               CD9DE17E17AAD64E00EA386D /* URLMediaSource.cpp */,
+                               CD9DE17F17AAD64E00EA386D /* URLMediaSource.h */,
+                               CD9DE18017AAD64E00EA386D /* URLMediaSource.idl */,
+                               B1A942DE15B5CE2200D525D1 /* WebKitMediaSource.cpp */,
+                               B1A942DF15B5CE2200D525D1 /* WebKitMediaSource.h */,
+                               B1A942E015B5CE2200D525D1 /* WebKitMediaSource.idl */,
+                               B1A942E315B5CE2200D525D1 /* WebKitSourceBuffer.cpp */,
+                               B1A942E415B5CE2200D525D1 /* WebKitSourceBuffer.h */,
+                               B1A942E515B5CE2200D525D1 /* WebKitSourceBuffer.idl */,
+                               B1A942E615B5CE2200D525D1 /* WebKitSourceBufferList.cpp */,
+                               B1A942E715B5CE2200D525D1 /* WebKitSourceBufferList.h */,
+                               B1A942E815B5CE2200D525D1 /* WebKitSourceBufferList.idl */,
                        );
                        name = mediasource;
                        path = Modules/mediasource;
                        name = ios;
                        sourceTree = "<group>";
                };
+               CD61FE7B1794CA02004101EB /* MediaSource */ = {
+                       isa = PBXGroup;
+                       children = (
+                               CD9DE17217AAC74C00EA386D /* JSMediaSource.cpp */,
+                               CD9DE17317AAC74C00EA386D /* JSMediaSource.h */,
+                               CD9DE17617AAC75B00EA386D /* JSSourceBuffer.cpp */,
+                               CD9DE17717AAC75B00EA386D /* JSSourceBuffer.h */,
+                               CD9DE17817AAC75B00EA386D /* JSSourceBufferList.cpp */,
+                               CD9DE17917AAC75B00EA386D /* JSSourceBufferList.h */,
+                               CD61FE801794CC59004101EB /* JSWebKitSourceBuffer.cpp */,
+                               CD61FE811794CC59004101EB /* JSWebKitSourceBuffer.h */,
+                               CD61FE821794CC59004101EB /* JSWebKitSourceBufferList.cpp */,
+                               CD61FE831794CC59004101EB /* JSWebKitSourceBufferList.h */,
+                               CD61FE7C1794CB26004101EB /* JSWebKitMediaSource.cpp */,
+                               CD61FE7D1794CB26004101EB /* JSWebKitMediaSource.h */,
+                       );
+                       name = MediaSource;
+                       sourceTree = "<group>";
+               };
                CDA98DBD16014E0800FEA3B1 /* encryptedmedia */ = {
                        isa = PBXGroup;
                        children = (
                                FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
                                E100EE761546EAC100BA11D1 /* DeprecatedStyleBuilder.h in Headers */,
                                A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */,
+                               CD61FE681794AADB004101EB /* MediaSourceRegistry.h in Headers */,
                                CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */,
                                CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */,
                                31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */,
                                85D389B20A991A7F00282145 /* DOMAttr.h in Headers */,
                                85E7118D0AC5D5350053270F /* DOMAttrInternal.h in Headers */,
                                BC946EEF107FDBAC00857193 /* DOMBeforeLoadEvent.h in Headers */,
+                               CD61FE851794CC59004101EB /* JSWebKitSourceBuffer.h in Headers */,
                                2E2D99E710E2BC1C00496337 /* DOMBlob.h in Headers */,
                                2E2D99EA10E2BC3800496337 /* DOMBlobInternal.h in Headers */,
                                85089CD70A98C42800A275AA /* DOMCDATASection.h in Headers */,
                                85992EBE0AA5069500AC0785 /* DOMHTMLLinkElement.h in Headers */,
                                85E711B80AC5D5350053270F /* DOMHTMLLinkElementInternal.h in Headers */,
                                85ECBEF30AA7626900544F0B /* DOMHTMLMapElement.h in Headers */,
+                               CD9DE17D17AAC75B00EA386D /* JSSourceBufferList.h in Headers */,
                                85E711B90AC5D5350053270F /* DOMHTMLMapElementInternal.h in Headers */,
                                BC51579F0C03BBD3008BB0EE /* DOMHTMLMarqueeElement.h in Headers */,
                                BC5156EA0C03B741008BB0EE /* DOMHTMLMarqueeElementInternal.h in Headers */,
                                85BA4D150AA688680088052D /* DOMHTMLOListElement.h in Headers */,
                                85E711BE0AC5D5350053270F /* DOMHTMLOListElementInternal.h in Headers */,
                                85F32AEE0AA63B8700FF3184 /* DOMHTMLOptGroupElement.h in Headers */,
+                               CD9DE18217AAD6A400EA386D /* URLMediaSource.h in Headers */,
                                85E711BF0AC5D5350053270F /* DOMHTMLOptGroupElementInternal.h in Headers */,
                                8540756B0AD6CBF900620C57 /* DOMHTMLOptionElement.h in Headers */,
                                8540756D0AD6CBF900620C57 /* DOMHTMLOptionElementInternal.h in Headers */,
                                85E711C10AC5D5350053270F /* DOMHTMLParagraphElementInternal.h in Headers */,
                                85ECBEF70AA7626900544F0B /* DOMHTMLParamElement.h in Headers */,
                                85E711C20AC5D5350053270F /* DOMHTMLParamElementInternal.h in Headers */,
+                               CD61FE6A1794AADB004101EB /* WebKitSourceBuffer.h in Headers */,
                                85183B480AA6926100F19FA3 /* DOMHTMLPreElement.h in Headers */,
                                85E711C30AC5D5350053270F /* DOMHTMLPreElementInternal.h in Headers */,
                                A4226E951163D73A008B8397 /* DOMHTMLProgressElement.h in Headers */,
                                F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */,
                                F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */,
                                7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */,
-                               07277E4B17D018CC0015534D /* JSMediaSource.h in Headers */,
                                511293603D60B4B52FAF973F /* InspectorHeapProfilerAgent.h in Headers */,
                                7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */,
                                7ACD88D414C08BD60084EDD2 /* InspectorIndexedDBAgent.h in Headers */,
                                4358E87D1360A2EE00E4748C /* JSSVGFEDropShadowElement.h in Headers */,
                                B2FA3D790AB75A6F000E5AC4 /* JSSVGFEFloodElement.h in Headers */,
                                B2FA3D7B0AB75A6F000E5AC4 /* JSSVGFEFuncAElement.h in Headers */,
+                               CD61FE7F1794CB26004101EB /* JSWebKitMediaSource.h in Headers */,
                                B2FA3D7D0AB75A6F000E5AC4 /* JSSVGFEFuncBElement.h in Headers */,
                                B2FA3D7F0AB75A6F000E5AC4 /* JSSVGFEFuncGElement.h in Headers */,
                                B2FA3D810AB75A6F000E5AC4 /* JSSVGFEFuncRElement.h in Headers */,
                                BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */,
                                6E3FAD3914733F4011E42307 /* JSWebGLDebugRendererInfo.h in Headers */,
                                6E3FAD3914733F4022E42307 /* JSWebGLDebugShaders.h in Headers */,
+                               CD3A495217A9C8C600274E42 /* MediaSourceBase.h in Headers */,
                                6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */,
                                49C7B9981042D2D30009D447 /* JSWebGLFramebuffer.h in Headers */,
                                93F1D5C112D5335600832BEC /* JSWebGLLoseContext.h in Headers */,
                                F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */,
                                0014628B103CD1DE000B20DB /* OriginAccessEntry.h in Headers */,
                                FE9E89FC16E2DC0500A908F8 /* OriginLock.h in Headers */,
+                               CD9DE18617AB0CF300EA386D /* HTMLMediaSource.h in Headers */,
                                FD581FAF1520F91F003A7A75 /* OscillatorNode.h in Headers */,
                                078E091B17D14D1C00420AA1 /* NavigatorUserMediaError.h in Headers */,
                                BC5EB5DD0E81B8DD00B25965 /* OutlineValue.h in Headers */,
                                436708C912D9CA4B00044234 /* RenderSVGImage.h in Headers */,
                                0854B0151255E4E600B9CDD0 /* RenderSVGInline.h in Headers */,
                                0854B0171255E4E600B9CDD0 /* RenderSVGInlineText.h in Headers */,
+                               CD3A496217A9D01B00274E42 /* SourceBuffer.h in Headers */,
                                436708CB12D9CA4B00044234 /* RenderSVGModelObject.h in Headers */,
                                ADDF1AD71257CD9A0003A759 /* RenderSVGPath.h in Headers */,
                                A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */,
                                514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
                                514C767A0CE923A1007EF3CD /* ResourceHandleClient.h in Headers */,
                                514C767B0CE923A1007EF3CD /* ResourceHandleInternal.h in Headers */,
+                               CD61FE641794AADB004101EB /* WebKitMediaSource.h in Headers */,
                                51E4143416A6596300C633C7 /* ResourceHandleTypes.h in Headers */,
                                656D373F0ADBA5DE00A4554D /* ResourceLoader.h in Headers */,
                                D0A3A7311405A39800FB8ED3 /* ResourceLoaderOptions.h in Headers */,
                                41E1B1D40FF5986900576B3B /* SharedWorker.h in Headers */,
                                41D168E810226E89009BC827 /* SharedWorkerGlobalScope.h in Headers */,
                                41D168EA10226E89009BC827 /* SharedWorkerRepository.h in Headers */,
+                               CD61FE6C1794AADB004101EB /* WebKitSourceBufferList.h in Headers */,
                                E1B7839C163740A70007B692 /* SharedWorkerStrategy.h in Headers */,
                                41D168EE10226E89009BC827 /* SharedWorkerThread.h in Headers */,
                                B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,
                                08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */,
                                71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */,
                                0823D159127AD6AC000EBC95 /* SVGAnimatedInteger.h in Headers */,
+                               CD61FE871794CC59004101EB /* JSWebKitSourceBufferList.h in Headers */,
                                71E623D1151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h in Headers */,
+                               CD9DE17B17AAC75B00EA386D /* JSSourceBuffer.h in Headers */,
                                089021A9126EF5DE0092D5EA /* SVGAnimatedLength.h in Headers */,
                                089021AD126EF5E90092D5EA /* SVGAnimatedLengthList.h in Headers */,
                                088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */,
                                BCEF45E90E687767001C1287 /* TextMetrics.h in Headers */,
                                930FC68A1072B9280045293E /* TextRenderingMode.h in Headers */,
                                93F198F608245E59001E9ABC /* TextResourceDecoder.h in Headers */,
+                               CD3A496517A9D01B00274E42 /* SourceBufferList.h in Headers */,
                                A824B4650E2EF2EA0081A7B7 /* TextRun.h in Headers */,
                                448B1B7A0F3A2F9B0047A9E2 /* TextSizeAdjustment.h in Headers */,
                                B2C3DA4B0D006C1D00EF6F26 /* TextStream.h in Headers */,
                                49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */,
                                070334D71459FFD5008D8D45 /* TrackBase.h in Headers */,
                                BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */,
+                               CD3A495F17A9D01B00274E42 /* MediaSource.h in Headers */,
                                49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */,
                                FB484F4D171F821E00040755 /* TransformFunctions.h in Headers */,
                                49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */,
                                F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */,
                                85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
                                9380F47409A11AB4001FDB34 /* Widget.h in Headers */,
+                               CD9DE17517AAC74C00EA386D /* JSMediaSource.h in Headers */,
                                1411DCB1164C39A800D49BC1 /* WidthCache.h in Headers */,
                                939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */,
                                4123E569127B3041000FEEA7 /* WindowEventContext.h in Headers */,
                                A81872250977D3C0005826D9 /* ChildNodeList.cpp in Sources */,
                                14D8238B0AF92DF60004F057 /* Chrome.cpp in Sources */,
                                ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */,
+                               CD9DE17417AAC74C00EA386D /* JSMediaSource.cpp in Sources */,
                                4ACBC0BE12713CBD0094F9B2 /* ClassList.cpp in Sources */,
                                BC904B760D10998F00680D32 /* ClassNodeList.cpp in Sources */,
                                BCC0657D0F3CE1B700CD2D87 /* ClientRect.cpp in Sources */,
                                85032DDC0AA8C9BE007D3B7D /* DOMCSSImportRule.mm in Sources */,
                                85032DDE0AA8C9BE007D3B7D /* DOMCSSMediaRule.mm in Sources */,
                                85032DE00AA8C9BE007D3B7D /* DOMCSSPageRule.mm in Sources */,
+                               CD9DE17A17AAC75B00EA386D /* JSSourceBuffer.cpp in Sources */,
                                858C382D0AA8E40500B187A4 /* DOMCSSPrimitiveValue.mm in Sources */,
                                85032DE20AA8C9BE007D3B7D /* DOMCSSRule.mm in Sources */,
                                85032DE40AA8C9BE007D3B7D /* DOMCSSRuleList.mm in Sources */,
                                85DF81980AA77E4B00486AD7 /* DOMHTMLFrameSetElement.mm in Sources */,
                                7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */,
                                85992EBB0AA5069500AC0785 /* DOMHTMLHeadElement.mm in Sources */,
+                               CD3A496417A9D01B00274E42 /* SourceBufferList.cpp in Sources */,
                                85183B450AA6926100F19FA3 /* DOMHTMLHeadingElement.mm in Sources */,
                                85ECBEF20AA7626900544F0B /* DOMHTMLHRElement.mm in Sources */,
                                85992EBD0AA5069500AC0785 /* DOMHTMLHtmlElement.mm in Sources */,
                                89878564122CA064003AABDA /* FileSystemCallbacks.cpp in Sources */,
                                5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */,
                                26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */,
+                               CD3A495417A9CC9000274E42 /* MediaSourceBase.cpp in Sources */,
                                514B3F760C722055000530DF /* FileSystemMac.mm in Sources */,
                                5160300B0CC4251200C8AC25 /* FileSystemPOSIX.cpp in Sources */,
                                976D6C8D122B8A3D001FD1F7 /* FileThread.cpp in Sources */,
                                C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */,
                                B275356F0B053814002CE64F /* Image.cpp in Sources */,
                                43D2597713C816F400608559 /* ImageBuffer.cpp in Sources */,
+                               CD9DE17C17AAC75B00EA386D /* JSSourceBufferList.cpp in Sources */,
                                B2A10B940B3818D700099AA4 /* ImageBufferCG.cpp in Sources */,
                                2292B27C1356669400CF11EF /* ImageBufferDataCG.cpp in Sources */,
                                B275355E0B053814002CE64F /* ImageCG.cpp in Sources */,
                                52CCA9E215E3F62C0053C77F /* JSDOMNamedFlowCollection.cpp in Sources */,
                                1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */,
                                FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */,
+                               CD61FE6B1794AADB004101EB /* WebKitSourceBufferList.cpp in Sources */,
                                A9D247FE0D757E6900FDF959 /* JSDOMPlugin.cpp in Sources */,
                                A9D248000D757E6900FDF959 /* JSDOMPluginArray.cpp in Sources */,
                                A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
                                FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */,
                                FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */,
                                FE80DA650E9C4703000D6F75 /* JSGeoposition.cpp in Sources */,
+                               CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */,
                                8482B7511198CB6B00BFB005 /* JSHashChangeEvent.cpp in Sources */,
                                BC94D14E0C275C68006BC617 /* JSHistory.cpp in Sources */,
                                BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */,
                                9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */,
                                BCCBAD400C18C14200CE890F /* JSHTMLCollection.cpp in Sources */,
                                BCCBAD3B0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp in Sources */,
+                               CD61FE841794CC59004101EB /* JSWebKitSourceBuffer.cpp in Sources */,
                                4A1E719014E101E400626F9D /* JSHTMLContentElement.cpp in Sources */,
                                F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */,
                                D359D8BE129CA55C0006E5D2 /* JSHTMLDetailsElement.cpp in Sources */,
                                B2FA3DCA0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp in Sources */,
                                B2FA3DCC0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothRel.cpp in Sources */,
                                B2C96D8D0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp in Sources */,
+                               CD3A496117A9D01B00274E42 /* SourceBuffer.cpp in Sources */,
                                B2FA3DCE0AB75A6F000E5AC4 /* JSSVGPathSegLinetoAbs.cpp in Sources */,
                                B2FA3DD00AB75A6F000E5AC4 /* JSSVGPathSegLinetoHorizontalAbs.cpp in Sources */,
                                B2FA3DD20AB75A6F000E5AC4 /* JSSVGPathSegLinetoHorizontalRel.cpp in Sources */,
                                9703E1BF15DC4E37001F24C8 /* JSVoidCallback.cpp in Sources */,
                                FD82D7F713D4C8BD004E4372 /* JSWaveShaperNode.cpp in Sources */,
                                A7D20F62107F406900A80392 /* JSWebGLActiveInfo.cpp in Sources */,
-                               07277E4A17D018CC0015534D /* JSMediaSource.cpp in Sources */,
                                49C7B9931042D2D30009D447 /* JSWebGLBuffer.cpp in Sources */,
                                7EA30F6916DFFE7500257D0B /* JSWebGLCompressedTextureATC.cpp in Sources */,
                                7EA30F6917EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.cpp in Sources */,
                                4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */,
                                D3A94A38122DABAC00A37BBC /* MediaQueryList.cpp in Sources */,
                                D3AA10F3123A98AA0092152B /* MediaQueryMatcher.cpp in Sources */,
+                               CD61FE671794AADB004101EB /* MediaSourceRegistry.cpp in Sources */,
                                FD671A77159BB07000197559 /* MediaStreamAudioSourceNode.cpp in Sources */,
                                0711589017DF6F6200EDFE2B /* MediaStreamComponent.cpp in Sources */,
                                0711589117DF6F6600EDFE2B /* MediaStreamDescriptor.cpp in Sources */,
                                439046DB12DA25E800AF80A2 /* RenderMathMLFraction.cpp in Sources */,
                                439046DD12DA25E800AF80A2 /* RenderMathMLMath.cpp in Sources */,
                                439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */,
+                               CD61FE631794AADB004101EB /* WebKitMediaSource.cpp in Sources */,
                                439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */,
                                439046E312DA25E800AF80A2 /* RenderMathMLRow.cpp in Sources */,
                                5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */,
                                93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.cpp in Sources */,
                                BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */,
                                A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */,
+                               CD9DE18517AB0CF300EA386D /* HTMLMediaSource.cpp in Sources */,
                                51E3F9C70DA059DC00250911 /* Storage.cpp in Sources */,
                                C5160EEA1004543A00A7CEE2 /* StorageAreaImpl.cpp in Sources */,
                                C5102ED00FD9EF8C00FAFF04 /* StorageAreaSync.cpp in Sources */,
                                B22279DC0D00BF220071B782 /* SVGFEFloodElement.cpp in Sources */,
                                B22279DF0D00BF220071B782 /* SVGFEFuncAElement.cpp in Sources */,
                                B22279E20D00BF220071B782 /* SVGFEFuncBElement.cpp in Sources */,
+                               CD61FE7E1794CB26004101EB /* JSWebKitMediaSource.cpp in Sources */,
                                B22279E50D00BF220071B782 /* SVGFEFuncGElement.cpp in Sources */,
                                B22279E80D00BF220071B782 /* SVGFEFuncRElement.cpp in Sources */,
                                B22279EB0D00BF220071B782 /* SVGFEGaussianBlurElement.cpp in Sources */,
                                8476C9EA11DF6A2900555B02 /* SVGPathBuilder.cpp in Sources */,
                                8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */,
                                8419D2AC120D92FC00141F8F /* SVGPathByteStreamSource.cpp in Sources */,
+                               CD61FE861794CC59004101EB /* JSWebKitSourceBufferList.cpp in Sources */,
                                B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */,
                                8476C9EF11DF6A5800555B02 /* SVGPathParser.cpp in Sources */,
                                B2227A800D00BF220071B782 /* SVGPathSegList.cpp in Sources */,
                                93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */,
                                376DCCE113B4F966002EBEFC /* TextRun.cpp in Sources */,
                                B2C3DA4A0D006C1D00EF6F26 /* TextStream.cpp in Sources */,
+                               CD9DE18117AAD6A400EA386D /* URLMediaSource.cpp in Sources */,
                                9759E93F14EF1CF80026A2DD /* TextTrack.cpp in Sources */,
                                9759E94214EF1CF80026A2DD /* TextTrackCue.cpp in Sources */,
                                071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */,
                                0FCF332C0F2B9A25004B6795 /* WebTiledLayer.mm in Sources */,
                                1AA7161E149BF2FA0016EC19 /* WebTileLayer.mm in Sources */,
                                CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */,
+                               CD61FE691794AADB004101EB /* WebKitSourceBuffer.cpp in Sources */,
                                CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */,
                                F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */,
                                5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */,
                                F3820896147D35F90010BC06 /* WorkerConsoleAgent.cpp in Sources */,
                                F34742E01343631F00531BC2 /* WorkerDebuggerAgent.cpp in Sources */,
                                A3E2643014748991005A8588 /* WorkerEventQueue.cpp in Sources */,
+                               CDEE393717974259001D7580 /* PublicURLManager.cpp in Sources */,
                                2E4346480F546A8200B0F1BA /* WorkerGlobalScope.cpp in Sources */,
                                9712A611150090CE0048AF10 /* WorkerGlobalScopeIndexedDatabase.cpp in Sources */,
                                97F8E665151D4A4B00D2D181 /* WorkerGlobalScopeNotifications.cpp in Sources */,
index 31d74f4..a3e10df 100644 (file)
@@ -167,6 +167,14 @@ namespace WebCore {
     macro(webkitbeginfullscreen) \
     macro(webkitendfullscreen) \
     \
+    macro(addsourcebuffer) \
+    macro(removesourcebuffer) \
+    macro(sourceopen) \
+    macro(sourceended) \
+    macro(sourceclose) \
+    macro(update) \
+    macro(updateend) \
+    macro(updatestart) \
     macro(webkitaddsourcebuffer) \
     macro(webkitremovesourcebuffer) \
     macro(webkitsourceopen) \
index 67b715b..47c352e 100644 (file)
@@ -56,7 +56,6 @@ namespace WebCore {
     class IDBTransaction;
     class ScriptProcessorNode;
     class MediaController;
-    class MediaSource;
     class MediaStream;
     class MessagePort;
     class Node;
@@ -65,7 +64,6 @@ namespace WebCore {
     class ScriptExecutionContext;
     class SharedWorker;
     class SharedWorkerGlobalScope;
-    class SourceBufferList;
     class TextTrack;
     class TextTrackCue;
     class VideoTrackList;
index 2f5be8d..42735d5 100644 (file)
@@ -30,6 +30,7 @@ RTCDTMFSender conditional=MEDIA_STREAM
 RTCPeerConnection conditional=MEDIA_STREAM
 SharedWorker conditional=SHARED_WORKERS
 SharedWorkerGlobalScope conditional=SHARED_WORKERS
+SourceBuffer conditional=MEDIA_SOURCE
 SourceBufferList conditional=MEDIA_SOURCE
 SpeechRecognition conditional=SCRIPTED_SPEECH
 SpeechSynthesisUtterance conditional=SPEECH_SYNTHESIS
@@ -38,7 +39,9 @@ TextTrack conditional=VIDEO_TRACK
 TextTrackCue conditional=VIDEO_TRACK
 TextTrackList conditional=VIDEO_TRACK
 VideoTrackList conditional=VIDEO_TRACK
+WebKitMediaSource conditional=MEDIA_SOURCE
 WebKitNamedFlow
+WebKitSourceBufferList conditional=MEDIA_SOURCE
 WebSocket conditional=WEB_SOCKETS
 Worker conditional=WORKERS
 XMLHttpRequest