summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp')
-rw-r--r--Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp
index 811173dfa..eb2ff784c 100644
--- a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp
+++ b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. 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
@@ -29,25 +29,26 @@
#if ENABLE(MEDIA_SOURCE)
#include "ContentType.h"
-#include "ExceptionCodePlaceholder.h"
+#include "MediaSourcePrivateClient.h"
#include "MockMediaPlayerMediaSource.h"
#include "MockSourceBufferPrivate.h"
namespace WebCore {
-RefPtr<MockMediaSourcePrivate> MockMediaSourcePrivate::create(MockMediaPlayerMediaSource* parent)
+RefPtr<MockMediaSourcePrivate> MockMediaSourcePrivate::create(MockMediaPlayerMediaSource* parent, MediaSourcePrivateClient* client)
{
- return adoptRef(new MockMediaSourcePrivate(parent));
+ RefPtr<MockMediaSourcePrivate> mediaSourcePrivate = adoptRef(new MockMediaSourcePrivate(parent, client));
+ client->setPrivateAndOpen(*mediaSourcePrivate);
+ return mediaSourcePrivate;
}
-MockMediaSourcePrivate::MockMediaSourcePrivate(MockMediaPlayerMediaSource* parent)
+MockMediaSourcePrivate::MockMediaSourcePrivate(MockMediaPlayerMediaSource* parent, MediaSourcePrivateClient* client)
: m_player(parent)
- , m_duration(std::numeric_limits<float>::quiet_NaN())
+ , m_client(client)
, m_isEnded(false)
, m_totalVideoFrames(0)
, m_droppedVideoFrames(0)
, m_corruptedVideoFrames(0)
- , m_totalFrameDelay(0)
{
}
@@ -84,18 +85,19 @@ void MockMediaSourcePrivate::removeSourceBuffer(SourceBufferPrivate* buffer)
m_sourceBuffers.remove(pos);
}
-double MockMediaSourcePrivate::duration()
+MediaTime MockMediaSourcePrivate::duration()
{
- return m_duration;
+ return m_client->duration();
}
-void MockMediaSourcePrivate::setDuration(double duration)
+std::unique_ptr<PlatformTimeRanges> MockMediaSourcePrivate::buffered()
{
- if (duration == m_duration)
- return;
+ return m_client->buffered();
+}
- m_duration = duration;
- m_player->updateDuration(duration);
+void MockMediaSourcePrivate::durationChanged()
+{
+ m_player->updateDuration(duration());
}
void MockMediaSourcePrivate::markEndOfStream(EndOfStreamStatus status)
@@ -120,6 +122,16 @@ void MockMediaSourcePrivate::setReadyState(MediaPlayer::ReadyState readyState)
m_player->setReadyState(readyState);
}
+void MockMediaSourcePrivate::waitForSeekCompleted()
+{
+ m_player->waitForSeekCompleted();
+}
+
+void MockMediaSourcePrivate::seekCompleted()
+{
+ m_player->seekCompleted();
+}
+
void MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState(MockSourceBufferPrivate* buffer, bool active)
{
if (active && !m_activeSourceBuffers.contains(buffer))
@@ -154,8 +166,7 @@ bool MockMediaSourcePrivate::hasVideo() const
void MockMediaSourcePrivate::seekToTime(const MediaTime& time)
{
- for (auto it = m_activeSourceBuffers.begin(), end = m_activeSourceBuffers.end(); it != end; ++it)
- (*it)->seekToTime(time);
+ m_client->seekToTime(time);
}
MediaTime MockMediaSourcePrivate::seekToTime(const MediaTime& targetTime, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold)