Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(WebKit)

add_definitions(-DMETROLOGICAL=1)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")

set(ENABLE_WEBCORE ON)
Expand Down
9 changes: 4 additions & 5 deletions Source/WTF/wtf/Platform.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,8 +25,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef WTF_Platform_h
#define WTF_Platform_h
#pragma once

/* Include compiler specific macros */
#include <wtf/Compiler.h>
Expand DownExpand Up@@ -288,7 +287,9 @@
|| defined(__ARM_ARCH_7K__) \
|| defined(__ARM_ARCH_7M__) \
|| defined(__ARM_ARCH_7R__) \
|| defined(__ARM_ARCH_7S__)
|| defined(__ARM_ARCH_7S__) \
|| defined(__ARM_ARCH_8__) \
|| defined(__ARM_ARCH_8A__)
#define WTF_THUMB_ARCH_VERSION 4

/* RVCT sets __TARGET_ARCH_THUMB */
Expand DownExpand Up@@ -1295,5 +1296,3 @@
#if !OS(WINDOWS)
#define HAVE_STACK_BOUNDS_FOR_NEW_THREAD 1
#endif

#endif /* WTF_Platform_h */
31 changes: 27 additions & 4 deletions Source/WebCore/Modules/mediasource/MediaSource.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -337,7 +337,7 @@ const MediaTime& MediaSource::currentTimeFudgeFactor()
const MediaTime* fudgeFactor = &MediaTime::zeroTime();
for (auto& sourceBuffer : *m_sourceBuffers) {
const MediaTime* sourceBufferFudgeFactor = &sourceBuffer->currentTimeFudgeFactor();
if (sourceBufferFudgeFactor > fudgeFactor)
if (*sourceBufferFudgeFactor > *fudgeFactor)
fudgeFactor = sourceBufferFudgeFactor;
}
return *fudgeFactor;
Expand DownExpand Up@@ -500,15 +500,18 @@ ExceptionOr<void> MediaSource::setDurationInternal(const MediaTime& duration)
if (newDuration == m_duration)
return { };

#if 1
#if defined(METROLOGICAL)
// Implementation to pass the YouTube MSE Conformance Tests 2016, conforming to the old MSE spec:
// https://www.w3.org/TR/2016/CR-media-source-20160503/#duration-change-algorithm

// 4. If the new duration is less than old duration, then call remove(new duration, old duration)
// on all objects in sourceBuffers.
if (m_duration.isValid() && newDuration < m_duration) {
for (auto& sourceBuffer : *m_sourceBuffers)
sourceBuffer->rangeRemoval(newDuration, m_duration);
for (auto& sourceBuffer : *m_sourceBuffers) {
unsigned length = sourceBuffer->bufferedInternal().length();
if (length && newDuration < sourceBuffer->bufferedInternal().ranges().end(length - 1))
sourceBuffer->rangeRemoval(newDuration, sourceBuffer->bufferedInternal().ranges().end(length - 1));
}
}
#else
// Upstream implementation, conforming to the latest MSE spec.
Expand DownExpand Up@@ -855,12 +858,32 @@ bool MediaSource::isTypeSupported(const String& type)
if (contentType.containerType().isEmpty())
return false;

bool ok;
unsigned channels = contentType.parameter("channels").toUInt(&ok);
if (!ok)
channels = 0;

float width = contentType.parameter("width").toFloat(&ok);
if (!ok)
width = 0;

float height = contentType.parameter("height").toFloat(&ok);
if (!ok)
height = 0;

float framerate = contentType.parameter("framerate").toFloat(&ok);
if (!ok)
framerate = 0;

// 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.
MediaEngineSupportParameters parameters;
parameters.type = contentType;
parameters.channels = channels;
parameters.dimension = { width, height };
parameters.framerate = framerate;
parameters.isMediaSource = true;
MediaPlayer::SupportsType supported = MediaPlayer::supportsType(parameters, 0);

Expand Down
Loading