[MediaStream] new load method for MediaStreamPrivate objects
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2015 14:10:11 +0000 (14:10 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2015 14:10:11 +0000 (14:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142346

Reviewed by Eric Carlson.

No new tests, existing mediastream tests cover this use-case.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource): Use new load method for MediaStreams.
* platform/graphics/MediaPlayer.cpp:
(WebCore::NullMediaPlayerPrivate::load): New stub.
(WebCore::MediaPlayer::load): New load method for
MediaStreamPrivate.
(WebCore::MediaPlayer::nextBestMediaEngine): Set a new boolean on
the MediaEngineSupportParameters to differenciate with MSE and
normal video resources.
(WebCore::MediaPlayer::loadWithNextMediaEngine): Defer loading of
the MediaStream to the MediaPlayerPrivate backend.
* platform/graphics/MediaPlayer.h:
(WebCore::MediaEngineSupportParameters::MediaEngineSupportParameters):
* platform/graphics/MediaPlayerPrivate.h:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(WebCore::MediaPlayerPrivateAVFoundation::load): New empty load
method for MediaStreamPrivate objects.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
(WebCore::MediaPlayerPrivateQTKit::load): Ditto.
* platform/mock/mediasource/MockMediaPlayerMediaSource.h:

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h

index 570fd7f..4006286 100644 (file)
@@ -1,5 +1,40 @@
 2015-03-05  Philippe Normand  <pnormand@igalia.com>
 
+        [MediaStream] new load method for MediaStreamPrivate objects
+        https://bugs.webkit.org/show_bug.cgi?id=142346
+
+        Reviewed by Eric Carlson.
+
+        No new tests, existing mediastream tests cover this use-case.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::loadResource): Use new load method for MediaStreams.
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::NullMediaPlayerPrivate::load): New stub.
+        (WebCore::MediaPlayer::load): New load method for
+        MediaStreamPrivate.
+        (WebCore::MediaPlayer::nextBestMediaEngine): Set a new boolean on
+        the MediaEngineSupportParameters to differenciate with MSE and
+        normal video resources.
+        (WebCore::MediaPlayer::loadWithNextMediaEngine): Defer loading of
+        the MediaStream to the MediaPlayerPrivate backend.
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaEngineSupportParameters::MediaEngineSupportParameters):
+        * platform/graphics/MediaPlayerPrivate.h:
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+        (WebCore::MediaPlayerPrivateAVFoundation::load): New empty load
+        method for MediaStreamPrivate objects.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Ditto.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        (WebCore::MediaPlayerPrivateQTKit::load): Ditto.
+        * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
+
+2015-03-05  Philippe Normand  <pnormand@igalia.com>
+
         Rename MediaStreamSource to RealtimeMediaSource
         https://bugs.webkit.org/show_bug.cgi?id=142330
 
index 5112cf2..bccd178 100644 (file)
@@ -1221,6 +1221,11 @@ void HTMLMediaElement::loadResource(const URL& initialURL, ContentType& contentT
         }
     } else
 #endif
+#if ENABLE(MEDIA_STREAM)
+        if (m_mediaStreamSrcObject)
+            m_player->load(m_mediaStreamSrcObject->privateStream());
+        else
+#endif
     if (!m_player->load(url, contentType, keySystem))
         mediaLoadingFailed(MediaPlayer::FormatError);
 
index 5aa69dc..7a7684c 100644 (file)
 #include "MediaSourcePrivateClient.h"
 #endif
 
+#if ENABLE(MEDIA_STREAM)
+#include "MediaStreamPrivate.h"
+#endif
+
 #if USE(GSTREAMER)
 #include "MediaPlayerPrivateGStreamer.h"
 #define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer
@@ -85,6 +89,9 @@ public:
 #if ENABLE(MEDIA_SOURCE)
     virtual void load(const String&, MediaSourcePrivateClient*) { }
 #endif
+#if ENABLE(MEDIA_STREAM)
+    virtual void load(MediaStreamPrivate*) { }
+#endif
     virtual void cancelLoad() { }
 
     virtual void prepareToPlay() { }
@@ -309,6 +316,9 @@ bool MediaPlayer::load(const URL& url, const ContentType& contentType, const Str
 #if ENABLE(MEDIA_SOURCE)
     m_mediaSource = 0;
 #endif
+#if ENABLE(MEDIA_STREAM)
+    m_mediaStream = 0;
+#endif
 
     // If the MIME type is missing or is not meaningful, try to figure it out from the URL.
     if (m_contentMIMEType.isEmpty() || m_contentMIMEType == applicationOctetStream() || m_contentMIMEType == textPlain()) {
@@ -347,6 +357,18 @@ bool MediaPlayer::load(const URL& url, const ContentType& contentType, MediaSour
 }
 #endif
 
+#if ENABLE(MEDIA_STREAM)
+bool MediaPlayer::load(MediaStreamPrivate* mediaStream)
+{
+    ASSERT(mediaStream);
+    m_mediaStream = mediaStream;
+    m_keySystem = "";
+    m_contentMIMETypeWasInferredFromExtension = false;
+    loadWithNextMediaEngine(0);
+    return m_currentMediaEngine;
+}
+#endif
+
 const MediaPlayerFactory* MediaPlayer::nextBestMediaEngine(const MediaPlayerFactory* current) const
 {
     MediaEngineSupportParameters parameters;
@@ -359,6 +381,9 @@ const MediaPlayerFactory* MediaPlayer::nextBestMediaEngine(const MediaPlayerFact
 #if ENABLE(MEDIA_SOURCE)
     parameters.isMediaSource = !!m_mediaSource;
 #endif
+#if ENABLE(MEDIA_STREAM)
+    parameters.isMediaStream = !!m_mediaStream;
+#endif
 
     return bestMediaEngineForSupportParameters(parameters, current);
 }
@@ -396,6 +421,11 @@ void MediaPlayer::loadWithNextMediaEngine(const MediaPlayerFactory* current)
             m_private->load(m_url.string(), m_mediaSource.get());
         else
 #endif
+#if ENABLE(MEDIA_STREAM)
+        if (m_mediaStream)
+            m_private->load(m_mediaStream.get());
+        else
+#endif
         m_private->load(m_url.string());
     } else {
         m_private = std::make_unique<NullMediaPlayerPrivate>(this);
index eefbfc2..bc54a59 100644 (file)
@@ -74,6 +74,9 @@ class AuthenticationChallenge;
 #if ENABLE(MEDIA_SOURCE)
 class MediaSourcePrivateClient;
 #endif
+#if ENABLE(MEDIA_STREAM)
+class MediaStreamPrivate;
+#endif
 class MediaPlayerPrivateInterface;
 class TextTrackRepresentation;
 struct Cookie;
@@ -113,12 +116,18 @@ struct MediaEngineSupportParameters {
 #if ENABLE(MEDIA_SOURCE)
     bool isMediaSource;
 #endif
+#if ENABLE(MEDIA_STREAM)
+    bool isMediaStream;
+#endif
 
     MediaEngineSupportParameters()
 #if ENABLE(MEDIA_SOURCE)
         : isMediaSource(false)
 #endif
     {
+#if ENABLE(MEDIA_STREAM)
+        isMediaStream = false;
+#endif
     }
 };
 
@@ -324,6 +333,9 @@ public:
 #if ENABLE(MEDIA_SOURCE)
     bool load(const URL&, const ContentType&, MediaSourcePrivateClient*);
 #endif
+#if ENABLE(MEDIA_STREAM)
+    bool load(MediaStreamPrivate*);
+#endif
     void cancelLoad();
 
     bool visible() const;
@@ -604,6 +616,9 @@ private:
 #if ENABLE(MEDIA_SOURCE)
     RefPtr<MediaSourcePrivateClient> m_mediaSource;
 #endif
+#if ENABLE(MEDIA_STREAM)
+    RefPtr<MediaStreamPrivate> m_mediaStream;
+#endif
 };
 
 typedef std::function<std::unique_ptr<MediaPlayerPrivateInterface> (MediaPlayer*)> CreateMediaEnginePlayer;
index 4f2390a..12f6fd8 100644 (file)
@@ -48,6 +48,9 @@ public:
 #if ENABLE(MEDIA_SOURCE)
     virtual void load(const String& url, MediaSourcePrivateClient*) = 0;
 #endif
+#if ENABLE(MEDIA_STREAM)
+    virtual void load(MediaStreamPrivate*) = 0;
+#endif
     virtual void cancelLoad() = 0;
     
     virtual void prepareToPlay() { }
index c0dd47e..b2bbbc5 100644 (file)
@@ -153,6 +153,9 @@ protected:
 #if ENABLE(MEDIA_SOURCE)
     virtual void load(const String&, MediaSourcePrivateClient*);
 #endif
+#if ENABLE(MEDIA_STREAM)
+    virtual void load(MediaStreamPrivate*) { }
+#endif
     virtual void cancelLoad() = 0;
 
     virtual void prepareToPlay() override;
index 3a5045d..4b3a190 100644 (file)
@@ -95,6 +95,9 @@ private:
     // MediaPlayerPrivateInterface
     virtual void load(const String& url) override;
     virtual void load(const String& url, MediaSourcePrivateClient*) override;
+#if ENABLE(MEDIA_STREAM)
+    virtual void load(MediaStreamPrivate*) { }
+#endif
     virtual void cancelLoad() override;
 
     virtual void prepareToPlay() override;
index 0d60e11..8c2d01a 100644 (file)
@@ -320,6 +320,13 @@ void MediaPlayerPrivateGStreamer::load(const String& url, MediaSourcePrivateClie
 }
 #endif
 
+#if ENABLE(MEDIA_STREAM)
+void MediaPlayerPrivateGStreamer::load(MediaStreamPrivate* mediaStream)
+{
+    notImplemented();
+}
+#endif
+
 void MediaPlayerPrivateGStreamer::commitLoad()
 {
     ASSERT(!m_delayingLoad);
index b472e96..3905154 100644 (file)
@@ -76,6 +76,9 @@ public:
 #if ENABLE(MEDIA_SOURCE)
     void load(const String& url, MediaSourcePrivateClient*);
 #endif
+#if ENABLE(MEDIA_STREAM)
+    void load(MediaStreamPrivate*);
+#endif
     void commitLoad();
     void cancelLoad();
 
index 6982c99..f98f024 100644 (file)
@@ -86,6 +86,9 @@ private:
 #if ENABLE(MEDIA_SOURCE)
     virtual void load(const String&, MediaSourcePrivateClient*);
 #endif
+#if ENABLE(MEDIA_STREAM)
+    virtual void load(MediaStreamPrivate*) { }
+#endif
     void cancelLoad();
     void loadInternal(const String& url);
     void resumeLoad();
index 2ac42e8..4ebdcab 100644 (file)
@@ -60,6 +60,9 @@ private:
     // MediaPlayerPrivate Overrides
     virtual void load(const String& url) override;
     virtual void load(const String& url, MediaSourcePrivateClient*) override;
+#if ENABLE(MEDIA_STREAM)
+    virtual void load(MediaStreamPrivate*) override { };
+#endif
     virtual void cancelLoad() override;
     virtual void play() override;
     virtual void pause() override;