2013-06-21 03:14:42 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "MediaSource.h"
|
|
|
|
|
2013-09-27 05:22:37 +00:00
|
|
|
#include "AsyncEventRunner.h"
|
|
|
|
#include "DecoderTraits.h"
|
2013-06-21 03:14:42 +00:00
|
|
|
#include "SourceBuffer.h"
|
|
|
|
#include "SourceBufferList.h"
|
2013-09-27 05:22:37 +00:00
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/FloatingPoint.h"
|
2014-04-14 11:24:00 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
2013-09-27 05:22:37 +00:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
|
|
|
#include "mozilla/dom/HTMLMediaElement.h"
|
|
|
|
#include "mozilla/mozalloc.h"
|
2013-08-21 19:28:26 +00:00
|
|
|
#include "nsContentTypeParser.h"
|
2013-09-27 05:22:37 +00:00
|
|
|
#include "nsDebug.h"
|
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsIEventTarget.h"
|
|
|
|
#include "nsIRunnable.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsStringGlue.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "prlog.h"
|
|
|
|
|
|
|
|
struct JSContext;
|
|
|
|
class JSObject;
|
2013-06-21 03:14:42 +00:00
|
|
|
|
|
|
|
#ifdef PR_LOGGING
|
|
|
|
PRLogModuleInfo* gMediaSourceLog;
|
2014-03-05 03:35:46 +00:00
|
|
|
#define MSE_DEBUG(...) PR_LOG(gMediaSourceLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
2013-06-21 03:14:42 +00:00
|
|
|
#else
|
2014-03-05 03:35:46 +00:00
|
|
|
#define MSE_DEBUG(...)
|
2013-06-21 03:14:42 +00:00
|
|
|
#endif
|
|
|
|
|
2013-09-27 05:22:37 +00:00
|
|
|
// Arbitrary limit.
|
|
|
|
static const unsigned int MAX_SOURCE_BUFFERS = 16;
|
|
|
|
|
2013-06-21 03:14:42 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
2014-03-05 03:35:47 +00:00
|
|
|
static const char* const gMediaSourceTypes[6] = {
|
|
|
|
"video/webm",
|
|
|
|
"audio/webm",
|
|
|
|
"video/mp4",
|
|
|
|
"audio/mp4",
|
|
|
|
"audio/mpeg",
|
|
|
|
nullptr
|
|
|
|
};
|
|
|
|
|
|
|
|
static nsresult
|
|
|
|
IsTypeSupported(const nsAString& aType)
|
|
|
|
{
|
|
|
|
if (aType.IsEmpty()) {
|
|
|
|
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
|
|
|
}
|
|
|
|
// TODO: Further restrict this to formats in the spec.
|
|
|
|
nsContentTypeParser parser(aType);
|
|
|
|
nsAutoString mimeType;
|
|
|
|
nsresult rv = parser.GetType(mimeType);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
bool found = false;
|
|
|
|
for (uint32_t i = 0; gMediaSourceTypes[i]; ++i) {
|
|
|
|
if (mimeType.EqualsASCII(gMediaSourceTypes[i])) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
2014-04-14 11:24:00 +00:00
|
|
|
if (Preferences::GetBool("media.mediasource.ignore_codecs", false)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2014-03-05 03:35:47 +00:00
|
|
|
// Check aType against HTMLMediaElement list of MIME types. Since we've
|
|
|
|
// already restricted the container format, this acts as a specific check
|
|
|
|
// of any specified "codecs" parameter of aType.
|
|
|
|
if (dom::HTMLMediaElement::GetCanPlay(aType) == CANPLAY_NO) {
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-09-27 05:22:37 +00:00
|
|
|
namespace dom {
|
2013-06-21 03:14:42 +00:00
|
|
|
|
|
|
|
/* static */ already_AddRefed<MediaSource>
|
2013-08-23 05:17:08 +00:00
|
|
|
MediaSource::Constructor(const GlobalObject& aGlobal,
|
|
|
|
ErrorResult& aRv)
|
2013-06-21 03:14:42 +00:00
|
|
|
{
|
2013-08-23 05:17:08 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
2013-06-21 03:14:42 +00:00
|
|
|
if (!window) {
|
|
|
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<MediaSource> mediaSource = new MediaSource(window);
|
|
|
|
return mediaSource.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
SourceBufferList*
|
|
|
|
MediaSource::SourceBuffers()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT_IF(mReadyState == MediaSourceReadyState::Closed, mSourceBuffers->IsEmpty());
|
|
|
|
return mSourceBuffers;
|
|
|
|
}
|
|
|
|
|
|
|
|
SourceBufferList*
|
|
|
|
MediaSource::ActiveSourceBuffers()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT_IF(mReadyState == MediaSourceReadyState::Closed, mActiveSourceBuffers->IsEmpty());
|
|
|
|
return mActiveSourceBuffers;
|
|
|
|
}
|
|
|
|
|
|
|
|
MediaSourceReadyState
|
|
|
|
MediaSource::ReadyState()
|
|
|
|
{
|
|
|
|
return mReadyState;
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
MediaSource::Duration()
|
|
|
|
{
|
|
|
|
if (mReadyState == MediaSourceReadyState::Closed) {
|
2014-02-27 15:23:16 +00:00
|
|
|
return UnspecifiedNaN<double>();
|
2013-06-21 03:14:42 +00:00
|
|
|
}
|
|
|
|
return mDuration;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::SetDuration(double aDuration, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
if (aDuration < 0 || IsNaN(aDuration)) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (mReadyState != MediaSourceReadyState::Open ||
|
|
|
|
mSourceBuffers->AnyUpdating()) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
DurationChange(aDuration, aRv);
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<SourceBuffer>
|
|
|
|
MediaSource::AddSourceBuffer(const nsAString& aType, ErrorResult& aRv)
|
|
|
|
{
|
2014-03-05 03:35:47 +00:00
|
|
|
nsresult rv = mozilla::IsTypeSupported(aType);
|
2014-04-14 11:24:00 +00:00
|
|
|
MSE_DEBUG("MediaSource::AddSourceBuffer(Type=%s) -> %x", NS_ConvertUTF16toUTF8(aType).get(), rv);
|
2014-03-05 03:35:47 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
aRv.Throw(rv);
|
2013-06-21 03:14:42 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
2013-09-27 05:22:37 +00:00
|
|
|
if (mSourceBuffers->Length() >= MAX_SOURCE_BUFFERS) {
|
2013-06-21 03:14:42 +00:00
|
|
|
aRv.Throw(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
if (mReadyState != MediaSourceReadyState::Open) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-09-27 05:22:37 +00:00
|
|
|
nsContentTypeParser parser(aType);
|
|
|
|
nsAutoString mimeType;
|
2014-03-05 03:35:47 +00:00
|
|
|
rv = parser.GetType(mimeType);
|
2013-09-27 05:22:37 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-04-21 13:31:00 +00:00
|
|
|
nsRefPtr<SourceBuffer> sourceBuffer = SourceBuffer::Create(this, NS_ConvertUTF16toUTF8(mimeType));
|
|
|
|
if (!sourceBuffer) {
|
2014-04-14 11:24:00 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE); // XXX need a better error here
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-06-21 03:14:42 +00:00
|
|
|
mSourceBuffers->Append(sourceBuffer);
|
2014-03-05 03:35:46 +00:00
|
|
|
MSE_DEBUG("%p AddSourceBuffer(Type=%s) -> %p", this,
|
|
|
|
NS_ConvertUTF16toUTF8(mimeType).get(), sourceBuffer.get());
|
2013-06-21 03:14:42 +00:00
|
|
|
return sourceBuffer.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::RemoveSourceBuffer(SourceBuffer& aSourceBuffer, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
SourceBuffer* sourceBuffer = &aSourceBuffer;
|
2014-04-14 11:24:00 +00:00
|
|
|
MSE_DEBUG("%p RemoveSourceBuffer(Buffer=%p)", this, sourceBuffer);
|
2013-06-21 03:14:42 +00:00
|
|
|
if (!mSourceBuffers->Contains(sourceBuffer)) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (sourceBuffer->Updating()) {
|
|
|
|
// TODO:
|
|
|
|
// abort stream append loop (if running)
|
|
|
|
// set updating to false
|
|
|
|
// fire "abort" at sourceBuffer
|
|
|
|
// fire "updateend" at sourceBuffer
|
|
|
|
}
|
|
|
|
// TODO:
|
|
|
|
// For all sourceBuffer audioTracks, videoTracks, textTracks:
|
|
|
|
// set sourceBuffer to null
|
|
|
|
// remove sourceBuffer video, audio, text Tracks from MediaElement tracks
|
|
|
|
// remove sourceBuffer video, audio, text Tracks and fire "removetrack" at affected lists
|
|
|
|
// fire "removetrack" at modified MediaElement track lists
|
|
|
|
// If removed enabled/selected, fire "change" at affected MediaElement list.
|
|
|
|
if (mActiveSourceBuffers->Contains(sourceBuffer)) {
|
|
|
|
mActiveSourceBuffers->Remove(sourceBuffer);
|
|
|
|
}
|
|
|
|
mSourceBuffers->Remove(sourceBuffer);
|
|
|
|
// TODO: Free all resources associated with sourceBuffer
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::EndOfStream(const Optional<MediaSourceEndOfStreamError>& aError, ErrorResult& aRv)
|
|
|
|
{
|
2014-04-14 11:24:00 +00:00
|
|
|
MSE_DEBUG("%p EndOfStream(Error=%u)", this, aError.WasPassed() ? uint32_t(aError.Value()) : 0);
|
2013-06-21 03:14:42 +00:00
|
|
|
if (mReadyState != MediaSourceReadyState::Open ||
|
|
|
|
mSourceBuffers->AnyUpdating()) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
|
|
return;
|
|
|
|
}
|
2014-03-05 03:35:47 +00:00
|
|
|
|
|
|
|
SetReadyState(MediaSourceReadyState::Ended);
|
|
|
|
mSourceBuffers->Ended();
|
|
|
|
if (!aError.WasPassed()) {
|
|
|
|
// TODO:
|
|
|
|
// Run duration change algorithm.
|
|
|
|
// DurationChange(highestDurationOfSourceBuffers, aRv);
|
|
|
|
// if (aRv.Failed()) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// Notify media element that all data is now available.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (aError.Value()) {
|
|
|
|
case MediaSourceEndOfStreamError::Network:
|
|
|
|
// TODO: If media element has a readyState of:
|
|
|
|
// HAVE_NOTHING -> run resource fetch algorithm
|
|
|
|
// > HAVE_NOTHING -> run "interrupted" steps of resource fetch
|
|
|
|
break;
|
|
|
|
case MediaSourceEndOfStreamError::Decode:
|
|
|
|
// TODO: If media element has a readyState of:
|
|
|
|
// HAVE_NOTHING -> run "unsupported" steps of resource fetch
|
|
|
|
// > HAVE_NOTHING -> run "corrupted" steps of resource fetch
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
|
|
|
}
|
2013-06-21 03:14:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ bool
|
2014-03-05 03:35:47 +00:00
|
|
|
MediaSource::IsTypeSupported(const GlobalObject&, const nsAString& aType)
|
2013-06-21 03:14:42 +00:00
|
|
|
{
|
2014-04-14 11:24:00 +00:00
|
|
|
#ifdef PR_LOGGING
|
|
|
|
if (!gMediaSourceLog) {
|
|
|
|
gMediaSourceLog = PR_NewLogModule("MediaSource");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
nsresult rv = mozilla::IsTypeSupported(aType);
|
|
|
|
MSE_DEBUG("MediaSource::IsTypeSupported(Type=%s) -> %x", NS_ConvertUTF16toUTF8(aType).get(), rv);
|
|
|
|
return NS_SUCCEEDED(rv);
|
2013-06-21 03:14:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-09-27 05:22:37 +00:00
|
|
|
MediaSource::Attach(MediaSourceDecoder* aDecoder)
|
2013-06-21 03:14:42 +00:00
|
|
|
{
|
2014-03-05 03:35:46 +00:00
|
|
|
MSE_DEBUG("%p Attaching decoder %p owner %p", this, aDecoder, aDecoder->GetOwner());
|
2013-09-27 05:22:37 +00:00
|
|
|
MOZ_ASSERT(aDecoder);
|
2013-06-21 03:14:42 +00:00
|
|
|
if (mReadyState != MediaSourceReadyState::Closed) {
|
|
|
|
return false;
|
|
|
|
}
|
2013-09-27 05:22:37 +00:00
|
|
|
mDecoder = aDecoder;
|
|
|
|
mDecoder->AttachMediaSource(this);
|
2013-06-21 03:14:42 +00:00
|
|
|
SetReadyState(MediaSourceReadyState::Open);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-09-27 05:22:37 +00:00
|
|
|
MediaSource::Detach()
|
2013-06-21 03:14:42 +00:00
|
|
|
{
|
2014-03-05 03:35:46 +00:00
|
|
|
MSE_DEBUG("%p Detaching decoder %p owner %p", this, mDecoder.get(), mDecoder->GetOwner());
|
2013-09-27 05:22:37 +00:00
|
|
|
MOZ_ASSERT(mDecoder);
|
|
|
|
mDecoder->DetachMediaSource();
|
|
|
|
mDecoder = nullptr;
|
2014-02-27 15:23:16 +00:00
|
|
|
mDuration = UnspecifiedNaN<double>();
|
2013-06-21 03:14:42 +00:00
|
|
|
mActiveSourceBuffers->Clear();
|
2013-09-27 05:22:37 +00:00
|
|
|
mSourceBuffers->Clear();
|
2013-06-21 03:14:42 +00:00
|
|
|
SetReadyState(MediaSourceReadyState::Closed);
|
|
|
|
}
|
|
|
|
|
|
|
|
MediaSource::MediaSource(nsPIDOMWindow* aWindow)
|
2014-04-01 06:13:50 +00:00
|
|
|
: DOMEventTargetHelper(aWindow)
|
2014-02-27 15:23:16 +00:00
|
|
|
, mDuration(UnspecifiedNaN<double>())
|
2013-09-27 05:22:37 +00:00
|
|
|
, mDecoder(nullptr)
|
2013-06-21 03:14:42 +00:00
|
|
|
, mReadyState(MediaSourceReadyState::Closed)
|
|
|
|
{
|
|
|
|
mSourceBuffers = new SourceBufferList(this);
|
|
|
|
mActiveSourceBuffers = new SourceBufferList(this);
|
|
|
|
|
|
|
|
#ifdef PR_LOGGING
|
|
|
|
if (!gMediaSourceLog) {
|
|
|
|
gMediaSourceLog = PR_NewLogModule("MediaSource");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::SetReadyState(MediaSourceReadyState aState)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aState != mReadyState);
|
2014-04-14 11:24:00 +00:00
|
|
|
MSE_DEBUG("%p SetReadyState old=%d new=%d", this, mReadyState, aState);
|
2013-06-21 03:14:42 +00:00
|
|
|
|
2013-10-05 08:03:50 +00:00
|
|
|
MediaSourceReadyState oldState = mReadyState;
|
|
|
|
mReadyState = aState;
|
|
|
|
|
|
|
|
if (mReadyState == MediaSourceReadyState::Open &&
|
|
|
|
(oldState == MediaSourceReadyState::Closed ||
|
|
|
|
oldState == MediaSourceReadyState::Ended)) {
|
2013-06-21 03:14:42 +00:00
|
|
|
QueueAsyncSimpleEvent("sourceopen");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-10-05 08:03:50 +00:00
|
|
|
if (mReadyState == MediaSourceReadyState::Ended &&
|
|
|
|
oldState == MediaSourceReadyState::Open) {
|
2013-06-21 03:14:42 +00:00
|
|
|
QueueAsyncSimpleEvent("sourceended");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-10-05 08:03:50 +00:00
|
|
|
if (mReadyState == MediaSourceReadyState::Closed &&
|
|
|
|
(oldState == MediaSourceReadyState::Open ||
|
|
|
|
oldState == MediaSourceReadyState::Ended)) {
|
2013-06-21 03:14:42 +00:00
|
|
|
QueueAsyncSimpleEvent("sourceclose");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_WARNING("Invalid MediaSource readyState transition");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::DispatchSimpleEvent(const char* aName)
|
|
|
|
{
|
2014-03-05 03:35:46 +00:00
|
|
|
MSE_DEBUG("%p Dispatching event %s to MediaSource", this, aName);
|
2013-06-21 03:14:42 +00:00
|
|
|
DispatchTrustedEvent(NS_ConvertUTF8toUTF16(aName));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::QueueAsyncSimpleEvent(const char* aName)
|
|
|
|
{
|
2014-03-05 03:35:46 +00:00
|
|
|
MSE_DEBUG("%p Queuing event %s to MediaSource", this, aName);
|
2013-09-27 05:22:37 +00:00
|
|
|
nsCOMPtr<nsIRunnable> event = new AsyncEventRunner<MediaSource>(this, aName);
|
2013-06-21 03:14:42 +00:00
|
|
|
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaSource::DurationChange(double aNewDuration, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
if (mDuration == aNewDuration) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
double oldDuration = mDuration;
|
|
|
|
mDuration = aNewDuration;
|
|
|
|
if (aNewDuration < oldDuration) {
|
|
|
|
mSourceBuffers->Remove(aNewDuration, oldDuration, aRv);
|
|
|
|
if (aRv.Failed()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// TODO: If partial audio frames/text cues exist, clamp duration based on mSourceBuffers.
|
|
|
|
// TODO: Update media element's duration and run element's duration change algorithm.
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPIDOMWindow*
|
|
|
|
MediaSource::GetParentObject() const
|
|
|
|
{
|
|
|
|
return GetOwner();
|
|
|
|
}
|
|
|
|
|
|
|
|
JSObject*
|
2014-04-08 22:27:18 +00:00
|
|
|
MediaSource::WrapObject(JSContext* aCx)
|
2013-06-21 03:14:42 +00:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-08 22:27:17 +00:00
|
|
|
return MediaSourceBinding::Wrap(aCx, this);
|
2013-06-21 03:14:42 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 00:54:48 +00:00
|
|
|
void
|
|
|
|
MediaSource::NotifyEvicted(double aStart, double aEnd)
|
|
|
|
{
|
|
|
|
// Cycle through all SourceBuffers and tell them to evict data in
|
|
|
|
// the given range.
|
|
|
|
mSourceBuffers->Evict(aStart, aEnd);
|
|
|
|
}
|
|
|
|
|
2014-04-01 06:13:50 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED_2(MediaSource, DOMEventTargetHelper,
|
2013-09-27 05:22:37 +00:00
|
|
|
mSourceBuffers, mActiveSourceBuffers)
|
2013-06-21 03:14:42 +00:00
|
|
|
|
2014-04-01 06:13:50 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(MediaSource, DOMEventTargetHelper)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(MediaSource, DOMEventTargetHelper)
|
2013-06-21 03:14:42 +00:00
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MediaSource)
|
2013-06-21 03:15:15 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(mozilla::dom::MediaSource)
|
2014-04-01 06:13:50 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
2013-06-21 03:14:42 +00:00
|
|
|
|
|
|
|
} // namespace dom
|
2013-09-27 05:22:37 +00:00
|
|
|
|
2013-06-21 03:14:42 +00:00
|
|
|
} // namespace mozilla
|