Permalink
Browse files

[MSE][GStreamer] refactored backend

Samples are now appended/parsed in a separate pipeline.
Playback is handled in a separate MediaPlayerPrivate

Patch by Enrique Ocaña <eocanha@igalia.com> and Philippe Normand <pnormand@igalia.com>
  • Loading branch information...
1 parent 4c4fc38 commit 69f968cf2cb8d1ac449575617f4de996a8378cfc @eocanha eocanha committed Jul 28, 2015
@@ -188,6 +188,7 @@ void MediaSource::seekToTime(const MediaTime& time)
m_pendingSeekTime = time;
+ LOG(MediaSource, "MediaSource::seekToTime(%p, %f): %lu active source buffers", this, time.toDouble(), m_activeSourceBuffers->length());
// Run the following steps as part of the "Wait until the user agent has established whether or not the
// media data for the new playback position is available, and, if it is, until it has decoded enough data
// to play back that position" step of the seek algorithm:
@@ -206,7 +207,8 @@ void MediaSource::seekToTime(const MediaTime& time)
LOG(MediaSource, "MediaSource::seekToTime(%p) - waitForSeekCompleted()", this);
m_private->waitForSeekCompleted();
return;
- }
+ } else
+ LOG(MediaSource, "MediaSource::seekToTime(%p) - seek time buffered already.", this);
// ↳ Otherwise
// Continue
}
@@ -117,6 +117,7 @@ list(APPEND WebCore_SOURCES
platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
+ platform/graphics/gstreamer/MediaPlayerPrivateGStreamerMSE.cpp
platform/graphics/gstreamer/MediaSourceGStreamer.cpp
platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp
platform/graphics/gstreamer/TextCombinerGStreamer.cpp
@@ -154,11 +154,11 @@ void InbandGenericTextTrack::addGenericCue(InbandTextTrackPrivate* trackPrivate,
RefPtr<TextTrackCueGeneric> cue = TextTrackCueGeneric::create(*scriptExecutionContext(), cueData->startTime(), cueData->endTime(), cueData->content());
updateCueFromCueData(cue.get(), cueData.get());
if (hasCue(cue.get(), TextTrackCue::IgnoreDuration)) {
- LOG(Media, "InbandGenericTextTrack::addGenericCue ignoring already added cue: start=%s, end=%s, content=\"%s\"\n", toString(cueData->startTime()).utf8().data(), toString(cueData->endTime()).utf8().data(), cueData->content().utf8().data());
+ LOG(Media, "InbandGenericTextTrack::addGenericCue ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"", cueData->startTime().toDouble(), cueData->endTime().toDouble(), cueData->content().utf8().data());
return;
}
- LOG(Media, "InbandGenericTextTrack::addGenericCue added cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime().toDouble(), cueData->endTime().toDouble(), cueData->content().utf8().data());
+ LOG(Media, "InbandGenericTextTrack::addGenericCue added cue: start=%.2f, end=%.2f, content=\"%s\"", cueData->startTime().toDouble(), cueData->endTime().toDouble(), cueData->content().utf8().data());
if (cueData->status() != GenericCueData::Complete)
m_cueMap.add(cueData.get(), cue.get());
@@ -182,10 +182,10 @@ void InbandGenericTextTrack::removeGenericCue(InbandTextTrackPrivate*, GenericCu
{
RefPtr<TextTrackCueGeneric> cue = m_cueMap.find(cueData);
if (cue) {
- LOG(Media, "InbandGenericTextTrack::removeGenericCue removing cue: start=%s, end=%s, content=\"%s\"\n", toString(cueData->startTime()).utf8().data(), toString(cueData->endTime()).utf8().data(), cueData->content().utf8().data());
+ LOG(Media, "InbandGenericTextTrack::removeGenericCue removing cue: start=%.2f, end=%.2f, content=\"%s\"", cueData->startTime().toDouble(), cueData->endTime().toDouble(), cueData->content().utf8().data());
removeCue(cue.get(), IGNORE_EXCEPTION);
} else {
- LOG(Media, "InbandGenericTextTrack::removeGenericCue UNABLE to find cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime().toDouble(), cueData->endTime().toDouble(), cueData->content().utf8().data());
+ LOG(Media, "InbandGenericTextTrack::removeGenericCue UNABLE to find cue: start=%.2f, end=%.2f, content=\"%s\"", cueData->startTime().toDouble(), cueData->endTime().toDouble(), cueData->content().utf8().data());
m_cueMap.remove(cueData);
}
}
@@ -224,7 +224,7 @@ void InbandGenericTextTrack::newCuesParsed()
RefPtr<VTTCue> vttCue = VTTCue::create(*scriptExecutionContext(), *cueData);
if (hasCue(vttCue.get(), TextTrackCue::IgnoreDuration)) {
- LOG(Media, "InbandGenericTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n", vttCue->startTime(), vttCue->endTime(), vttCue->text().utf8().data());
+ LOG(Media, "InbandGenericTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"", vttCue->startTime(), vttCue->endTime(), vttCue->text().utf8().data());
return;
}
addCue(vttCue.release(), ASSERT_NO_EXCEPTION);
@@ -54,7 +54,10 @@
#if USE(GSTREAMER)
#include "MediaPlayerPrivateGStreamer.h"
#define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer
+#if ENABLE(VIDEO) && ENABLE(MEDIA_SOURCE) && ENABLE(VIDEO_TRACK)
+#include "MediaPlayerPrivateGStreamerMSE.h"
#endif
+#endif // USE(GSTREAMER)
#if USE(MEDIA_FOUNDATION)
#include "MediaPlayerPrivateMediaFoundation.h"
@@ -205,6 +208,10 @@ static void buildMediaEnginesVector()
PlatformMediaEngineClassName::registerMediaEngine(addMediaEngine);
#endif
+#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE) && ENABLE(VIDEO_TRACK)
+ MediaPlayerPrivateGStreamerMSE::registerMediaEngine(addMediaEngine);
+#endif
+
haveMediaEnginesVector = true;
}
@@ -245,15 +252,17 @@ static const AtomicString& codecs()
static const MediaPlayerFactory* bestMediaEngineForSupportParameters(const MediaEngineSupportParameters& parameters, const MediaPlayerFactory* current = nullptr)
{
- if (parameters.type.isEmpty() && !parameters.isMediaSource && !parameters.isMediaStream)
- return nullptr;
-
- // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream"
- // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows
- // it cannot render.
- if (parameters.type == applicationOctetStream()) {
- if (!parameters.codecs.isEmpty())
+ if (!parameters.isMediaSource && !parameters.isMediaStream) {
+ if (parameters.type.isEmpty())
return nullptr;
+
+ // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream"
+ // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows
+ // it cannot render.
+ if (parameters.type == applicationOctetStream()) {
+ if (!parameters.codecs.isEmpty())
+ return nullptr;
+ }
}
const MediaPlayerFactory* foundEngine = nullptr;
@@ -421,6 +430,11 @@ void MediaPlayer::loadWithNextMediaEngine(const MediaPlayerFactory* current)
if (!m_contentMIMEType.isEmpty() || MEDIASTREAM || MEDIASOURCE)
engine = nextBestMediaEngine(current);
+#if ENABLE(MEDIA_SOURCE)
+ if (m_mediaSource)
+ engine = nextBestMediaEngine(current);
+#endif
+
// If no MIME type is specified or the type was inferred from the file extension, just use the next engine.
if (!engine && (m_contentMIMEType.isEmpty() || m_contentMIMETypeWasInferredFromExtension))
engine = nextMediaEngine(current);
@@ -34,6 +34,7 @@
#if ENABLE(MEDIA_SOURCE)
#include "MediaPlayer.h"
+#include "SourceBufferPrivateClient.h"
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -49,6 +50,7 @@ class SourceBufferPrivate : public RefCounted<SourceBufferPrivate> {
virtual void setClient(SourceBufferPrivateClient*) = 0;
virtual void append(const unsigned char* data, unsigned length) = 0;
+ virtual void appendComplete(SourceBufferPrivateClient::AppendResult) { };
virtual void abort() = 0;
virtual void removedFromMediaSource() = 0;
Oops, something went wrong.

0 comments on commit 69f968c

Please sign in to comment.