2008-07-30 10:50:14 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2011-07-12 07:39:39 +04:00
|
|
|
|
2012-11-14 23:46:40 +04:00
|
|
|
#if !defined(MediaDecoder_h_)
|
|
|
|
#define MediaDecoder_h_
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2017-12-06 01:22:36 +03:00
|
|
|
#include "BackgroundVideoDecodingPermissionObserver.h"
|
2017-06-20 18:56:55 +03:00
|
|
|
#include "DecoderDoctorDiagnostics.h"
|
2017-10-04 21:57:11 +03:00
|
|
|
#include "MediaContainerType.h"
|
2017-06-20 18:56:55 +03:00
|
|
|
#include "MediaDecoderOwner.h"
|
|
|
|
#include "MediaEventSource.h"
|
|
|
|
#include "MediaMetadataManager.h"
|
2017-11-03 15:14:17 +03:00
|
|
|
#include "MediaPromiseDefs.h"
|
2017-06-20 18:56:55 +03:00
|
|
|
#include "MediaResource.h"
|
|
|
|
#include "MediaStatistics.h"
|
|
|
|
#include "MediaStreamGraph.h"
|
|
|
|
#include "SeekTarget.h"
|
|
|
|
#include "TimeUnits.h"
|
2015-08-21 01:10:33 +03:00
|
|
|
#include "mozilla/Atomics.h"
|
2016-09-08 13:06:20 +03:00
|
|
|
#include "mozilla/CDMProxy.h"
|
2015-07-16 21:52:43 +03:00
|
|
|
#include "mozilla/MozPromise.h"
|
|
|
|
#include "mozilla/ReentrantMonitor.h"
|
|
|
|
#include "mozilla/StateMirroring.h"
|
|
|
|
#include "mozilla/StateWatching.h"
|
2015-09-07 06:39:46 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2008-07-30 10:50:14 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIObserver.h"
|
2015-09-07 06:39:46 +03:00
|
|
|
#include "nsISupports.h"
|
2015-01-28 17:31:31 +03:00
|
|
|
#include "nsITimer.h"
|
2015-09-07 06:39:46 +03:00
|
|
|
|
2012-11-14 23:45:33 +04:00
|
|
|
class nsIPrincipal;
|
|
|
|
|
2012-08-19 23:33:25 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2016-11-29 08:03:36 +03:00
|
|
|
class AbstractThread;
|
2017-07-13 12:38:06 +03:00
|
|
|
class FrameStatistics;
|
2012-11-14 23:45:33 +04:00
|
|
|
class VideoFrameContainer;
|
2017-07-19 12:01:32 +03:00
|
|
|
class MediaFormatReader;
|
2012-11-14 23:46:40 +04:00
|
|
|
class MediaDecoderStateMachine;
|
2017-12-01 05:33:44 +03:00
|
|
|
struct MediaPlaybackEvent;
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2017-03-17 07:51:11 +03:00
|
|
|
enum class Visibility : uint8_t;
|
2015-12-01 04:34:02 +03:00
|
|
|
|
2013-01-02 21:26:08 +04:00
|
|
|
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
|
|
|
|
// GetTickCount() and conflicts with MediaDecoder::GetCurrentTime implementation.
|
|
|
|
#ifdef GetCurrentTime
|
|
|
|
#undef GetCurrentTime
|
|
|
|
#endif
|
|
|
|
|
2017-06-26 12:10:47 +03:00
|
|
|
struct MOZ_STACK_CLASS MediaDecoderInit
|
2017-06-07 07:14:11 +03:00
|
|
|
{
|
|
|
|
MediaDecoderOwner* const mOwner;
|
2017-06-07 09:10:26 +03:00
|
|
|
const double mVolume;
|
|
|
|
const bool mPreservesPitch;
|
|
|
|
const double mPlaybackRate;
|
|
|
|
const bool mMinimizePreroll;
|
|
|
|
const bool mHasSuspendTaint;
|
2017-06-08 07:03:10 +03:00
|
|
|
const bool mLooping;
|
2017-06-26 12:10:47 +03:00
|
|
|
const MediaContainerType mContainerType;
|
2017-06-07 09:10:26 +03:00
|
|
|
|
|
|
|
MediaDecoderInit(MediaDecoderOwner* aOwner,
|
|
|
|
double aVolume,
|
|
|
|
bool aPreservesPitch,
|
|
|
|
double aPlaybackRate,
|
|
|
|
bool aMinimizePreroll,
|
2017-06-08 07:03:10 +03:00
|
|
|
bool aHasSuspendTaint,
|
2017-06-26 12:10:47 +03:00
|
|
|
bool aLooping,
|
|
|
|
const MediaContainerType& aContainerType)
|
2017-06-07 07:14:11 +03:00
|
|
|
: mOwner(aOwner)
|
2017-06-07 09:10:26 +03:00
|
|
|
, mVolume(aVolume)
|
|
|
|
, mPreservesPitch(aPreservesPitch)
|
|
|
|
, mPlaybackRate(aPlaybackRate)
|
|
|
|
, mMinimizePreroll(aMinimizePreroll)
|
|
|
|
, mHasSuspendTaint(aHasSuspendTaint)
|
2017-06-08 07:03:10 +03:00
|
|
|
, mLooping(aLooping)
|
2017-06-26 12:10:47 +03:00
|
|
|
, mContainerType(aContainerType)
|
2017-06-07 07:14:11 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Bug 1407810 - Use DDLogger in media stack - r=jwwang
Mostly-mechanical additions:
- Log constructions&destructions, usually by just inheriting from
DecoderDoctorLifeLogger, otherwise with explicit log commands (for internal
classes for which DecoderDoctorTraits can't be specialized),
- Log links between most objects, e.g.: Media element -> decoder -> state
machine -> reader -> demuxer -> resource, etc.
And logging some important properties and events (JS events, duration change,
frames being decoded, etc.)
More will be added later on, from just converting MOZ_LOGs, and as needed.
MozReview-Commit-ID: KgNhHSz35t0
--HG--
extra : rebase_source : dd7206e350e32671adc6f3b9e54ebf777251de2c
2017-10-10 09:55:27 +03:00
|
|
|
DDLoggedTypeDeclName(MediaDecoder);
|
|
|
|
|
|
|
|
class MediaDecoder : public DecoderDoctorLifeLogger<MediaDecoder>
|
2010-04-27 12:53:44 +04:00
|
|
|
{
|
2012-02-15 08:35:01 +04:00
|
|
|
public:
|
2017-01-27 15:20:37 +03:00
|
|
|
typedef MozPromise<bool /* aIgnored */, bool /* aIgnored */,
|
|
|
|
/* IsExclusive = */ true>
|
|
|
|
SeekPromise;
|
2013-12-02 01:09:06 +04:00
|
|
|
|
2017-07-13 12:38:06 +03:00
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoder)
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2008-10-19 11:39:21 +04:00
|
|
|
// Enumeration for the valid play states (see mPlayState)
|
2017-01-27 15:20:37 +03:00
|
|
|
enum PlayState
|
|
|
|
{
|
2008-10-19 11:39:21 +04:00
|
|
|
PLAY_STATE_START,
|
|
|
|
PLAY_STATE_LOADING,
|
|
|
|
PLAY_STATE_PAUSED,
|
|
|
|
PLAY_STATE_PLAYING,
|
|
|
|
PLAY_STATE_ENDED,
|
|
|
|
PLAY_STATE_SHUTDOWN
|
|
|
|
};
|
|
|
|
|
2017-11-08 10:34:19 +03:00
|
|
|
// Must be called exactly once, on the main thread, during startup.
|
|
|
|
static void InitStatics();
|
|
|
|
|
2017-06-07 07:14:11 +03:00
|
|
|
explicit MediaDecoder(MediaDecoderInit& aInit);
|
2012-11-07 02:33:02 +04:00
|
|
|
|
2017-06-26 12:10:47 +03:00
|
|
|
// Returns the container content type of the resource.
|
|
|
|
// Safe to call from any thread.
|
|
|
|
const MediaContainerType& ContainerType() const { return mContainerType; }
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Cleanup internal data structures. Must be called on the main
|
|
|
|
// thread by the owning object before that object disposes of this object.
|
2016-05-04 11:13:25 +03:00
|
|
|
virtual void Shutdown();
|
2012-11-07 02:33:02 +04:00
|
|
|
|
2017-02-03 12:12:38 +03:00
|
|
|
// Notified by the shutdown manager that XPCOM shutdown has begun.
|
|
|
|
// The decoder should notify its owner to drop the reference to the decoder
|
|
|
|
// to prevent further calls into the decoder.
|
|
|
|
void NotifyXPCOMShutdown();
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Called if the media file encounters a network error.
|
2017-11-17 06:07:30 +03:00
|
|
|
void NetworkError(const MediaResult& aError);
|
2012-11-14 23:45:13 +04:00
|
|
|
|
|
|
|
// Return the principal of the current URI being played or downloaded.
|
2017-08-24 11:58:06 +03:00
|
|
|
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() = 0;
|
2012-11-14 23:45:13 +04:00
|
|
|
|
|
|
|
// Return the time position in the video stream being
|
|
|
|
// played measured in seconds.
|
|
|
|
virtual double GetCurrentTime();
|
|
|
|
|
|
|
|
// Seek to the time position in (seconds) from the start of the video.
|
2014-04-01 07:39:04 +04:00
|
|
|
// If aDoFastSeek is true, we'll seek to the sync point/keyframe preceeding
|
|
|
|
// the seek target.
|
2018-04-30 20:59:32 +03:00
|
|
|
void Seek(double aTime, SeekTarget::Type aSeekType);
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2012-09-18 00:45:38 +04:00
|
|
|
// Initialize state machine and schedule it.
|
2015-10-14 06:46:27 +03:00
|
|
|
nsresult InitializeStateMachine();
|
2012-09-18 00:45:38 +04:00
|
|
|
|
2008-07-30 10:50:14 +04:00
|
|
|
// Start playback of a video. 'Load' must have previously been
|
|
|
|
// called.
|
2018-05-02 18:27:27 +03:00
|
|
|
virtual void Play();
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2015-01-22 07:01:12 +03:00
|
|
|
// Notify activity of the decoder owner is changed.
|
2017-03-11 14:56:17 +03:00
|
|
|
virtual void NotifyOwnerActivityChanged(bool aIsDocumentVisible,
|
2017-03-17 07:51:11 +03:00
|
|
|
Visibility aElementVisibility,
|
2017-03-12 09:02:04 +03:00
|
|
|
bool aIsElementInTree);
|
2013-06-10 16:22:05 +04:00
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Pause video playback.
|
2008-10-30 08:20:08 +03:00
|
|
|
virtual void Pause();
|
2012-11-14 23:45:13 +04:00
|
|
|
// Adjust the speed of the playback, optionally with pitch correction,
|
2017-06-07 09:41:37 +03:00
|
|
|
void SetVolume(double aVolume);
|
2012-04-30 07:12:42 +04:00
|
|
|
|
2017-06-07 09:41:37 +03:00
|
|
|
void SetPlaybackRate(double aPlaybackRate);
|
2012-11-22 14:38:28 +04:00
|
|
|
void SetPreservesPitch(bool aPreservesPitch);
|
2017-06-08 07:03:10 +03:00
|
|
|
void SetLooping(bool aLooping);
|
2012-11-22 14:38:28 +04:00
|
|
|
|
2018-10-12 11:44:47 +03:00
|
|
|
// Set the given device as the output device.
|
|
|
|
RefPtr<GenericPromise> SetSink(AudioDeviceInfo* aSink);
|
|
|
|
|
2017-01-05 12:59:19 +03:00
|
|
|
bool GetMinimizePreroll() const { return mMinimizePreroll; }
|
|
|
|
|
2012-07-31 16:17:22 +04:00
|
|
|
// All MediaStream-related data is protected by mReentrantMonitor.
|
2012-11-14 23:46:40 +04:00
|
|
|
// We have at most one DecodedStreamData per MediaDecoder. Its stream
|
2012-07-31 16:17:22 +04:00
|
|
|
// is used as the input for each ProcessedMediaStream created by calls to
|
|
|
|
// captureStream(UntilEnded). Seeking creates a new source stream, as does
|
|
|
|
// replaying after the input as ended. In the latter case, the new source is
|
|
|
|
// not connected to streams created by captureStreamUntilEnded.
|
2012-08-21 08:06:46 +04:00
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Add an output stream. All decoder output will be sent to the stream.
|
|
|
|
// The stream is initially blocked. The decoder is responsible for unblocking
|
|
|
|
// it while it is playing back.
|
2017-01-27 15:20:37 +03:00
|
|
|
virtual void AddOutputStream(ProcessedMediaStream* aStream,
|
2018-05-29 11:21:51 +03:00
|
|
|
TrackID aNextAvailableTrackID,
|
2017-01-27 15:20:37 +03:00
|
|
|
bool aFinishWhenEnded);
|
2015-07-24 15:28:17 +03:00
|
|
|
// Remove an output stream added with AddOutputStream.
|
|
|
|
virtual void RemoveOutputStream(MediaStream* aStream);
|
2018-05-29 11:21:51 +03:00
|
|
|
// The next TrackID that can be used without risk of a collision.
|
|
|
|
virtual TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const;
|
2012-04-30 07:12:42 +04:00
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Return the duration of the video in seconds.
|
2011-01-17 06:03:00 +03:00
|
|
|
virtual double GetDuration();
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2017-08-01 09:15:29 +03:00
|
|
|
// Return true if the stream is infinite.
|
2016-07-13 11:35:37 +03:00
|
|
|
bool IsInfinite() const;
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2012-05-15 09:57:17 +04:00
|
|
|
// Return true if we are currently seeking in the media resource.
|
|
|
|
// Call on the main thread only.
|
2016-07-13 11:35:37 +03:00
|
|
|
bool IsSeeking() const;
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2016-08-01 10:22:32 +03:00
|
|
|
// Return true if the decoder has reached the end of playback.
|
|
|
|
bool IsEnded() const;
|
2008-12-14 21:02:54 +03:00
|
|
|
|
2017-02-08 13:15:28 +03:00
|
|
|
// True if we are playing a MediaSource object.
|
|
|
|
virtual bool IsMSE() const { return false; }
|
|
|
|
|
2016-02-08 07:28:15 +03:00
|
|
|
// Return true if the MediaDecoderOwner's error attribute is not null.
|
2016-07-28 12:21:09 +03:00
|
|
|
// Must be called before Shutdown().
|
2016-02-08 07:28:15 +03:00
|
|
|
bool OwnerHasError() const;
|
|
|
|
|
2016-02-04 07:31:21 +03:00
|
|
|
// Returns true if this media supports random seeking. False for example with
|
|
|
|
// chained ogg files.
|
2015-11-23 05:26:49 +03:00
|
|
|
bool IsMediaSeekable();
|
2012-11-30 17:17:54 +04:00
|
|
|
// Returns true if seeking is supported on a transport level (e.g. the server
|
|
|
|
// supports range requests, we are playing a file, etc.).
|
2017-08-23 19:06:23 +03:00
|
|
|
virtual bool IsTransportSeekable() = 0;
|
2011-08-09 14:10:48 +04:00
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Return the time ranges that can be seeked into.
|
2015-05-18 09:15:47 +03:00
|
|
|
virtual media::TimeIntervals GetSeekable();
|
2008-11-10 04:38:02 +03:00
|
|
|
|
2011-08-25 03:42:23 +04:00
|
|
|
// Set the end time of the media resource. When playback reaches
|
|
|
|
// this point the media pauses. aTime is in seconds.
|
2012-11-19 19:11:21 +04:00
|
|
|
virtual void SetFragmentEndTime(double aTime);
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Invalidate the frame.
|
|
|
|
void Invalidate();
|
2013-10-02 07:05:34 +04:00
|
|
|
void InvalidateWithFlags(uint32_t aFlags);
|
2009-02-05 11:02:21 +03:00
|
|
|
|
2009-01-22 02:54:40 +03:00
|
|
|
// Suspend any media downloads that are in progress. Called by the
|
2012-11-14 23:45:13 +04:00
|
|
|
// media element when it is sent to the bfcache, or when we need
|
|
|
|
// to throttle the download. Call on the main thread only. This can
|
|
|
|
// be called multiple times, there's an internal "suspend count".
|
2017-08-07 13:09:56 +03:00
|
|
|
virtual void Suspend() {}
|
2009-01-22 02:54:40 +03:00
|
|
|
|
|
|
|
// Resume any media downloads that have been suspended. Called by the
|
2012-11-14 23:45:13 +04:00
|
|
|
// media element when it is restored from the bfcache, or when we need
|
|
|
|
// to stop throttling the download. Call on the main thread only.
|
|
|
|
// The download will only actually resume once as many Resume calls
|
2016-01-12 03:04:32 +03:00
|
|
|
// have been made as Suspend calls.
|
2017-08-07 13:09:56 +03:00
|
|
|
virtual void Resume() {}
|
2009-01-22 02:54:40 +03:00
|
|
|
|
2014-12-23 04:16:05 +03:00
|
|
|
// Moves any existing channel loads into or out of background. Background
|
|
|
|
// loads don't block the load event. This is called when we stop or restart
|
|
|
|
// delaying the load event. This also determines whether any new loads
|
|
|
|
// initiated (for example to seek) will be in the background. This calls
|
|
|
|
// SetLoadInBackground() on mResource.
|
2017-08-07 13:09:56 +03:00
|
|
|
virtual void SetLoadInBackground(bool aLoadInBackground) {}
|
2009-04-10 05:28:24 +04:00
|
|
|
|
2015-09-22 08:57:36 +03:00
|
|
|
MediaDecoderStateMachine* GetStateMachine() const;
|
2015-04-02 20:49:01 +03:00
|
|
|
void SetStateMachine(MediaDecoderStateMachine* aStateMachine);
|
|
|
|
|
2010-08-05 11:40:35 +04:00
|
|
|
// Constructs the time ranges representing what segments of the media
|
|
|
|
// are buffered and playable.
|
2015-05-18 09:15:47 +03:00
|
|
|
virtual media::TimeIntervals GetBuffered();
|
2010-08-05 11:40:35 +04:00
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Returns the size, in bytes, of the heap memory used by the currently
|
|
|
|
// queued decoded video and audio data.
|
2014-03-20 01:33:12 +04:00
|
|
|
size_t SizeOfVideoQueue();
|
2014-01-23 07:14:45 +04:00
|
|
|
size_t SizeOfAudioQueue();
|
2011-07-22 07:17:23 +04:00
|
|
|
|
2015-08-21 01:10:33 +03:00
|
|
|
// Helper struct for accumulating resource sizes that need to be measured
|
|
|
|
// asynchronously. Once all references are dropped the callback will be
|
|
|
|
// invoked.
|
|
|
|
struct ResourceSizes
|
|
|
|
{
|
|
|
|
typedef MozPromise<size_t, size_t, true> SizeOfPromise;
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ResourceSizes)
|
|
|
|
explicit ResourceSizes(MallocSizeOf aMallocSizeOf)
|
|
|
|
: mMallocSizeOf(aMallocSizeOf)
|
|
|
|
, mByteSize(0)
|
|
|
|
, mCallback()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::MallocSizeOf mMallocSizeOf;
|
|
|
|
mozilla::Atomic<size_t> mByteSize;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<SizeOfPromise> Promise()
|
2015-08-21 01:10:33 +03:00
|
|
|
{
|
|
|
|
return mCallback.Ensure(__func__);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
~ResourceSizes()
|
|
|
|
{
|
|
|
|
mCallback.ResolveIfExists(mByteSize, __func__);
|
|
|
|
}
|
|
|
|
|
|
|
|
MozPromiseHolder<SizeOfPromise> mCallback;
|
|
|
|
};
|
|
|
|
|
2017-08-24 12:35:24 +03:00
|
|
|
virtual void AddSizeOfResources(ResourceSizes* aSizes) = 0;
|
2015-08-21 01:10:33 +03:00
|
|
|
|
2017-07-13 12:38:06 +03:00
|
|
|
VideoFrameContainer* GetVideoFrameContainer()
|
2012-11-19 19:11:21 +04:00
|
|
|
{
|
|
|
|
return mVideoFrameContainer;
|
|
|
|
}
|
2017-07-13 12:38:06 +03:00
|
|
|
|
|
|
|
layers::ImageContainer* GetImageContainer();
|
2010-09-13 12:45:50 +04:00
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Fire timeupdate events if needed according to the time constraints
|
|
|
|
// outlined in the specification.
|
|
|
|
void FireTimeUpdate();
|
|
|
|
|
|
|
|
// Returns true if we can play the entire media through without stopping
|
|
|
|
// to buffer, given the current download and playback rates.
|
2017-08-04 12:38:20 +03:00
|
|
|
bool CanPlayThrough();
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2016-04-12 08:48:06 +03:00
|
|
|
// Called from HTMLMediaElement when owner document activity changes
|
2017-03-11 14:56:17 +03:00
|
|
|
virtual void SetElementVisibility(bool aIsDocumentVisible,
|
2017-03-17 07:51:11 +03:00
|
|
|
Visibility aElementVisibility,
|
2017-03-12 09:02:04 +03:00
|
|
|
bool aIsElementInTree);
|
2016-04-12 08:48:06 +03:00
|
|
|
|
2016-08-25 05:10:05 +03:00
|
|
|
// Force override the visible state to hidden.
|
|
|
|
// Called from HTMLMediaElement when testing of video decode suspend from mochitests.
|
|
|
|
void SetForcedHidden(bool aForcedHidden);
|
|
|
|
|
2017-03-08 14:28:13 +03:00
|
|
|
// Mark the decoder as tainted, meaning suspend-video-decoder is disabled.
|
|
|
|
void SetSuspendTaint(bool aTaint);
|
|
|
|
|
|
|
|
// Returns true if the decoder can't participate in suspend-video-decoder.
|
|
|
|
bool HasSuspendTaint() const;
|
|
|
|
|
2017-03-10 11:52:03 +03:00
|
|
|
void UpdateVideoDecodeMode();
|
|
|
|
|
2017-12-06 01:22:36 +03:00
|
|
|
void SetIsBackgroundVideoDecodingAllowed(bool aAllowed);
|
|
|
|
|
2012-11-07 02:33:02 +04:00
|
|
|
/******
|
2008-07-30 10:50:14 +04:00
|
|
|
* The following methods must only be called on the main
|
|
|
|
* thread.
|
|
|
|
******/
|
|
|
|
|
2008-11-18 11:19:32 +03:00
|
|
|
// Change to a new play state. This updates the mState variable and
|
|
|
|
// notifies any thread blocking on this object's monitor of the
|
|
|
|
// change. Call on the main thread only.
|
2014-04-08 19:29:07 +04:00
|
|
|
virtual void ChangeState(PlayState aState);
|
2008-11-18 11:19:32 +03:00
|
|
|
|
2008-07-30 10:50:14 +04:00
|
|
|
// Called when the video has completed playing.
|
|
|
|
// Call on the main thread only.
|
2008-10-19 11:39:21 +04:00
|
|
|
void PlaybackEnded();
|
2008-07-30 10:50:14 +04:00
|
|
|
|
2016-06-09 22:27:39 +03:00
|
|
|
void OnSeekRejected();
|
2016-11-14 12:00:53 +03:00
|
|
|
void OnSeekResolved();
|
2009-05-31 14:02:17 +04:00
|
|
|
|
2016-08-03 12:18:54 +03:00
|
|
|
// Seeking has started. Inform the element on the main thread.
|
|
|
|
void SeekingStarted();
|
2008-10-19 11:39:21 +04:00
|
|
|
|
2016-11-03 10:59:02 +03:00
|
|
|
void UpdateLogicalPositionInternal();
|
2015-07-01 00:39:41 +03:00
|
|
|
void UpdateLogicalPosition()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2017-01-19 05:42:29 +03:00
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
2016-04-18 13:57:47 +03:00
|
|
|
// Per spec, offical position remains stable during pause and seek.
|
|
|
|
if (mPlayState == PLAY_STATE_PAUSED || IsSeeking()) {
|
|
|
|
return;
|
|
|
|
}
|
2016-11-03 10:59:02 +03:00
|
|
|
UpdateLogicalPositionInternal();
|
2015-07-01 00:39:41 +03:00
|
|
|
}
|
2008-10-23 12:02:18 +04:00
|
|
|
|
2009-04-01 04:52:56 +04:00
|
|
|
// Find the end of the cached data starting at the current decoder
|
|
|
|
// position.
|
2012-08-22 19:56:38 +04:00
|
|
|
int64_t GetDownloadPosition();
|
2009-04-01 04:52:56 +04:00
|
|
|
|
2009-09-22 04:08:13 +04:00
|
|
|
// Notifies the element that decoding has failed.
|
2016-09-10 17:51:13 +03:00
|
|
|
void DecodeError(const MediaResult& aError);
|
2009-09-22 04:08:13 +04:00
|
|
|
|
2013-07-24 13:55:23 +04:00
|
|
|
// Indicate whether the media is same-origin with the element.
|
|
|
|
void UpdateSameOriginStatus(bool aSameOrigin);
|
|
|
|
|
2017-07-13 12:38:06 +03:00
|
|
|
MediaDecoderOwner* GetOwner() const;
|
2013-05-04 14:12:41 +04:00
|
|
|
|
2017-07-13 12:38:06 +03:00
|
|
|
AbstractThread* AbstractMainThread() const
|
2016-11-29 08:03:36 +03:00
|
|
|
{
|
|
|
|
return mAbstractMainThread;
|
|
|
|
}
|
|
|
|
|
2017-11-03 15:14:17 +03:00
|
|
|
RefPtr<SetCDMPromise> SetCDMProxy(CDMProxy* aProxy);
|
2014-07-30 10:53:34 +04:00
|
|
|
|
2015-11-25 02:52:48 +03:00
|
|
|
void EnsureTelemetryReported();
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
static bool IsOggEnabled();
|
|
|
|
static bool IsOpusEnabled();
|
|
|
|
static bool IsWaveEnabled();
|
|
|
|
static bool IsWebMEnabled();
|
2015-12-12 21:49:07 +03:00
|
|
|
|
2012-12-18 12:49:58 +04:00
|
|
|
#ifdef MOZ_WMF
|
|
|
|
static bool IsWMFEnabled();
|
|
|
|
#endif
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Return the frame decode/paint related statistics.
|
2015-12-03 10:59:30 +03:00
|
|
|
FrameStatistics& GetFrameStatistics() { return *mFrameStats; }
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2015-04-29 05:02:31 +03:00
|
|
|
void UpdateReadyState()
|
|
|
|
{
|
2015-10-19 08:55:38 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2017-01-19 05:42:29 +03:00
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
2017-01-20 06:47:53 +03:00
|
|
|
GetOwner()->UpdateReadyState();
|
2015-04-29 05:02:31 +03:00
|
|
|
}
|
2015-03-19 05:01:12 +03:00
|
|
|
|
2017-10-06 10:58:59 +03:00
|
|
|
MediaDecoderOwner::NextFrameStatus NextFrameStatus() const
|
2017-01-27 15:20:37 +03:00
|
|
|
{
|
2017-10-06 10:58:59 +03:00
|
|
|
return mNextFrameStatus;
|
2017-01-27 15:20:37 +03:00
|
|
|
}
|
2017-08-16 10:33:58 +03:00
|
|
|
|
2015-12-02 03:50:21 +03:00
|
|
|
virtual MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus();
|
2015-04-01 04:44:36 +03:00
|
|
|
|
2016-01-18 07:34:07 +03:00
|
|
|
// Returns a string describing the state of the media player internal
|
|
|
|
// data. Used for debugging purposes.
|
2017-08-15 08:07:13 +03:00
|
|
|
virtual void GetMozDebugReaderData(nsACString& aString);
|
2016-01-18 07:34:07 +03:00
|
|
|
|
2017-11-03 05:46:02 +03:00
|
|
|
RefPtr<GenericPromise> DumpDebugInfo();
|
2016-04-22 09:18:26 +03:00
|
|
|
|
2017-01-19 09:18:41 +03:00
|
|
|
using DebugInfoPromise = MozPromise<nsCString, bool, true>;
|
|
|
|
RefPtr<DebugInfoPromise> RequestDebugInfo();
|
|
|
|
|
2013-11-18 08:22:47 +04:00
|
|
|
protected:
|
2014-06-24 20:36:43 +04:00
|
|
|
virtual ~MediaDecoder();
|
2015-11-23 05:35:18 +03:00
|
|
|
|
|
|
|
// Called when the first audio and/or video from the media file has been loaded
|
|
|
|
// by the state machine. Call on the main thread only.
|
|
|
|
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
|
|
|
MediaDecoderEventVisibility aEventVisibility);
|
|
|
|
|
2014-08-05 18:55:02 +04:00
|
|
|
void SetStateMachineParameters();
|
2014-06-24 20:36:43 +04:00
|
|
|
|
2016-07-13 11:45:30 +03:00
|
|
|
bool IsShutdown() const;
|
|
|
|
|
2017-08-07 08:23:43 +03:00
|
|
|
// Called to notify the decoder that the duration has changed.
|
|
|
|
virtual void DurationChanged();
|
2015-06-10 01:31:46 +03:00
|
|
|
|
2015-04-29 05:02:31 +03:00
|
|
|
// State-watching manager.
|
|
|
|
WatchManager<MediaDecoder> mWatchManager;
|
2015-03-19 05:01:12 +03:00
|
|
|
|
2017-08-01 10:06:13 +03:00
|
|
|
double ExplicitDuration() { return mExplicitDuration.ref(); }
|
2015-07-17 08:00:26 +03:00
|
|
|
|
|
|
|
void SetExplicitDuration(double aValue)
|
|
|
|
{
|
2017-01-19 05:42:29 +03:00
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
2017-08-01 10:06:13 +03:00
|
|
|
mExplicitDuration = Some(aValue);
|
2015-07-17 08:00:26 +03:00
|
|
|
|
|
|
|
// We Invoke DurationChanged explicitly, rather than using a watcher, so
|
|
|
|
// that it takes effect immediately, rather than at the end of the current task.
|
|
|
|
DurationChanged();
|
|
|
|
}
|
2015-04-01 04:44:36 +03:00
|
|
|
|
2017-12-01 05:33:44 +03:00
|
|
|
virtual void OnPlaybackEvent(MediaPlaybackEvent&& aEvent);
|
2017-08-07 08:23:43 +03:00
|
|
|
|
2017-08-09 06:06:29 +03:00
|
|
|
// Called when the metadata from the media file has been loaded by the
|
|
|
|
// state machine. Call on the main thread only.
|
|
|
|
virtual void MetadataLoaded(UniquePtr<MediaInfo> aInfo,
|
|
|
|
UniquePtr<MetadataTags> aTags,
|
|
|
|
MediaDecoderEventVisibility aEventVisibility);
|
|
|
|
|
2008-07-30 10:50:14 +04:00
|
|
|
/******
|
2009-02-05 11:02:21 +03:00
|
|
|
* The following members should be accessed with the decoder lock held.
|
2008-07-30 10:50:14 +04:00
|
|
|
******/
|
2009-02-05 11:02:21 +03:00
|
|
|
|
2015-05-08 03:04:22 +03:00
|
|
|
// The logical playback position of the media resource in units of
|
|
|
|
// seconds. This corresponds to the "official position" in HTML5. Note that
|
|
|
|
// we need to store this as a double, rather than an int64_t (like
|
|
|
|
// mCurrentPosition), so that |v.currentTime = foo; v.currentTime == foo|
|
|
|
|
// returns true without being affected by rounding errors.
|
|
|
|
double mLogicalPosition;
|
|
|
|
|
|
|
|
// The current playback position of the underlying playback infrastructure.
|
|
|
|
// This corresponds to the "current position" in HTML5.
|
|
|
|
// We allow omx subclasses to substitute an alternative current position for
|
|
|
|
// usage with the audio offload player.
|
2017-04-17 12:04:39 +03:00
|
|
|
virtual media::TimeUnit CurrentPosition()
|
2017-03-28 13:13:22 +03:00
|
|
|
{
|
2017-04-17 12:04:39 +03:00
|
|
|
return mCurrentPosition.Ref();
|
2017-03-28 13:13:22 +03:00
|
|
|
}
|
2008-10-23 12:02:18 +04:00
|
|
|
|
2017-07-12 10:37:02 +03:00
|
|
|
already_AddRefed<layers::KnowsCompositor> GetCompositor();
|
|
|
|
|
2015-06-09 21:40:03 +03:00
|
|
|
// Official duration of the media resource as observed by script.
|
|
|
|
double mDuration;
|
2008-11-10 04:38:02 +03:00
|
|
|
|
2008-07-30 10:50:14 +04:00
|
|
|
/******
|
|
|
|
* The following member variables can be accessed from any thread.
|
|
|
|
******/
|
|
|
|
|
2017-07-19 12:01:32 +03:00
|
|
|
RefPtr<MediaFormatReader> mReader;
|
2017-07-05 12:21:17 +03:00
|
|
|
|
2015-12-02 03:50:21 +03:00
|
|
|
// Amount of buffered data ahead of current time required to consider that
|
|
|
|
// the next frame is available.
|
|
|
|
// An arbitrary value of 250ms is used.
|
2017-04-17 11:58:44 +03:00
|
|
|
static constexpr auto DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED =
|
|
|
|
media::TimeUnit::FromMicroseconds(250000);
|
2015-12-02 03:50:21 +03:00
|
|
|
|
2017-10-25 08:57:39 +03:00
|
|
|
virtual nsCString GetDebugInfo();
|
|
|
|
|
2015-04-02 20:49:01 +03:00
|
|
|
private:
|
2017-03-10 11:29:59 +03:00
|
|
|
// Called when the owner's activity changed.
|
|
|
|
void NotifyCompositor();
|
|
|
|
|
2016-09-10 17:51:13 +03:00
|
|
|
void OnPlaybackErrorEvent(const MediaResult& aError);
|
2015-11-30 08:06:19 +03:00
|
|
|
|
2016-09-19 13:38:06 +03:00
|
|
|
void OnDecoderDoctorEvent(DecoderDoctorEvent aEvent);
|
|
|
|
|
2015-12-02 10:42:32 +03:00
|
|
|
void OnMediaNotSeekable()
|
|
|
|
{
|
2016-11-02 09:41:04 +03:00
|
|
|
mMediaSeekable = false;
|
2015-12-02 10:42:32 +03:00
|
|
|
}
|
|
|
|
|
2017-10-06 10:48:38 +03:00
|
|
|
void OnNextFrameStatus(MediaDecoderOwner::NextFrameStatus);
|
|
|
|
|
2016-05-04 11:13:25 +03:00
|
|
|
void FinishShutdown();
|
2015-12-03 10:59:44 +03:00
|
|
|
|
2016-07-15 10:35:41 +03:00
|
|
|
void ConnectMirrors(MediaDecoderStateMachine* aObject);
|
|
|
|
void DisconnectMirrors();
|
|
|
|
|
2017-08-07 06:48:43 +03:00
|
|
|
virtual bool CanPlayThroughImpl() = 0;
|
2017-08-04 12:38:20 +03:00
|
|
|
|
2010-04-02 07:03:07 +04:00
|
|
|
// The state machine object for handling the decoding. It is safe to
|
|
|
|
// call methods of this object from other threads. Its internal data
|
|
|
|
// is synchronised on a monitor. The lifetime of this object is
|
|
|
|
// after mPlayState is LOADING and before mPlayState is SHUTDOWN. It
|
|
|
|
// is safe to access it during this period.
|
2015-04-02 20:49:01 +03:00
|
|
|
//
|
|
|
|
// Explicitly prievate to force access via accessors.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<MediaDecoderStateMachine> mDecoderStateMachine;
|
2010-04-02 07:03:07 +04:00
|
|
|
|
2015-04-25 06:35:06 +03:00
|
|
|
protected:
|
2017-11-30 05:51:56 +03:00
|
|
|
void NotifyReaderDataArrived();
|
2016-06-09 22:27:39 +03:00
|
|
|
void DiscardOngoingSeekIfExists();
|
2017-04-17 13:49:55 +03:00
|
|
|
virtual void CallSeek(const SeekTarget& aTarget);
|
2013-09-04 15:13:06 +04:00
|
|
|
|
2017-06-20 13:10:56 +03:00
|
|
|
// Called by MediaResource when the principal of the resource has
|
|
|
|
// changed. Called on main thread only.
|
2018-03-01 04:08:30 +03:00
|
|
|
virtual void NotifyPrincipalChanged();
|
2017-06-20 13:10:56 +03:00
|
|
|
|
2015-07-16 21:06:49 +03:00
|
|
|
MozPromiseRequestHolder<SeekPromise> mSeekRequest;
|
2015-03-03 03:46:32 +03:00
|
|
|
|
2015-03-05 04:32:54 +03:00
|
|
|
const char* PlayStateStr();
|
|
|
|
|
2015-09-07 06:38:34 +03:00
|
|
|
void OnMetadataUpdate(TimedMetadata&& aMetadata);
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// This should only ever be accessed from the main thread.
|
2016-07-29 09:44:22 +03:00
|
|
|
// It is set in the constructor and cleared in Shutdown when the element goes
|
|
|
|
// away. The decoder does not add a reference the element.
|
|
|
|
MediaDecoderOwner* mOwner;
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2016-11-29 08:03:36 +03:00
|
|
|
// The AbstractThread from mOwner.
|
|
|
|
const RefPtr<AbstractThread> mAbstractMainThread;
|
|
|
|
|
2012-11-14 23:45:13 +04:00
|
|
|
// Counters related to decode and presentation of frames.
|
2015-12-03 10:59:30 +03:00
|
|
|
const RefPtr<FrameStatistics> mFrameStats;
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2016-05-22 16:39:55 +03:00
|
|
|
RefPtr<VideoFrameContainer> mVideoFrameContainer;
|
2012-11-14 23:45:13 +04:00
|
|
|
|
2014-04-01 07:43:57 +04:00
|
|
|
// True if the decoder has been directed to minimize its preroll before
|
|
|
|
// playback starts. After the first time playback starts, we don't attempt
|
|
|
|
// to minimize preroll, as we assume the user is likely to keep playing,
|
|
|
|
// or play the media again.
|
2017-06-07 09:26:36 +03:00
|
|
|
const bool mMinimizePreroll;
|
2014-07-04 07:55:06 +04:00
|
|
|
|
2015-06-10 01:16:27 +03:00
|
|
|
// True if we've already fired metadataloaded.
|
|
|
|
bool mFiredMetadataLoaded;
|
|
|
|
|
2016-11-02 11:47:51 +03:00
|
|
|
// True if the media is seekable (i.e. supports random access).
|
|
|
|
bool mMediaSeekable = true;
|
|
|
|
|
2016-11-02 12:23:37 +03:00
|
|
|
// True if the media is only seekable within its buffered ranges
|
|
|
|
// like WebMs with no cues.
|
|
|
|
bool mMediaSeekableOnlyInBufferedRanges = false;
|
|
|
|
|
2014-07-04 07:55:06 +04:00
|
|
|
// Stores media info, including info of audio tracks and video tracks, should
|
|
|
|
// only be accessed from main thread.
|
|
|
|
nsAutoPtr<MediaInfo> mInfo;
|
2015-01-22 07:01:12 +03:00
|
|
|
|
2017-03-11 14:56:17 +03:00
|
|
|
// Tracks the visibility status of owner element's document.
|
|
|
|
bool mIsDocumentVisible;
|
|
|
|
|
2017-03-12 09:02:04 +03:00
|
|
|
// Tracks the visibility status of owner element.
|
2017-03-17 07:51:11 +03:00
|
|
|
Visibility mElementVisibility;
|
2016-08-25 05:10:05 +03:00
|
|
|
|
2017-03-12 09:02:04 +03:00
|
|
|
// Tracks the owner is in-tree or not.
|
|
|
|
bool mIsElementInTree;
|
|
|
|
|
2016-08-25 05:10:05 +03:00
|
|
|
// If true, forces the decoder to be considered hidden.
|
|
|
|
bool mForcedHidden;
|
|
|
|
|
2017-03-11 10:12:38 +03:00
|
|
|
// True if the decoder has a suspend taint - meaning suspend-video-decoder is
|
|
|
|
// disabled.
|
|
|
|
bool mHasSuspendTaint;
|
|
|
|
|
2017-10-06 10:48:38 +03:00
|
|
|
MediaDecoderOwner::NextFrameStatus mNextFrameStatus =
|
|
|
|
MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
|
|
|
|
|
2015-09-07 06:38:34 +03:00
|
|
|
// A listener to receive metadata updates from MDSM.
|
|
|
|
MediaEventListener mTimedMetadataListener;
|
|
|
|
|
2015-11-23 05:35:18 +03:00
|
|
|
MediaEventListener mMetadataLoadedListener;
|
|
|
|
MediaEventListener mFirstFrameLoadedListener;
|
|
|
|
|
2015-12-01 04:34:02 +03:00
|
|
|
MediaEventListener mOnPlaybackEvent;
|
2016-09-10 17:51:13 +03:00
|
|
|
MediaEventListener mOnPlaybackErrorEvent;
|
2016-09-19 13:38:06 +03:00
|
|
|
MediaEventListener mOnDecoderDoctorEvent;
|
2015-12-02 10:42:32 +03:00
|
|
|
MediaEventListener mOnMediaNotSeekable;
|
2017-07-13 06:18:07 +03:00
|
|
|
MediaEventListener mOnEncrypted;
|
2017-07-13 09:49:23 +03:00
|
|
|
MediaEventListener mOnWaitingForKey;
|
2017-07-13 10:02:06 +03:00
|
|
|
MediaEventListener mOnDecodeWarning;
|
2017-10-06 10:48:38 +03:00
|
|
|
MediaEventListener mOnNextFrameStatus;
|
2015-11-30 08:06:19 +03:00
|
|
|
|
2015-07-17 08:00:26 +03:00
|
|
|
protected:
|
2017-06-07 09:10:26 +03:00
|
|
|
// PlaybackRate and pitch preservation status we should start at.
|
|
|
|
double mPlaybackRate;
|
|
|
|
|
2015-07-17 08:00:26 +03:00
|
|
|
// Buffered range, mirrored from the reader.
|
|
|
|
Mirror<media::TimeIntervals> mBuffered;
|
|
|
|
|
|
|
|
// NB: Don't use mCurrentPosition directly, but rather CurrentPosition().
|
2017-03-28 13:13:22 +03:00
|
|
|
Mirror<media::TimeUnit> mCurrentPosition;
|
2015-07-17 08:00:26 +03:00
|
|
|
|
|
|
|
// Duration of the media resource according to the state machine.
|
|
|
|
Mirror<media::NullableTimeUnit> mStateMachineDuration;
|
|
|
|
|
2016-04-12 10:00:29 +03:00
|
|
|
// Used to distinguish whether the audio is producing sound.
|
2016-01-21 05:27:38 +03:00
|
|
|
Mirror<bool> mIsAudioDataAudible;
|
|
|
|
|
2015-07-17 08:00:26 +03:00
|
|
|
// Volume of playback. 0.0 = muted. 1.0 = full volume.
|
|
|
|
Canonical<double> mVolume;
|
|
|
|
|
|
|
|
Canonical<bool> mPreservesPitch;
|
|
|
|
|
2017-06-08 07:03:10 +03:00
|
|
|
Canonical<bool> mLooping;
|
|
|
|
|
2015-07-17 08:00:26 +03:00
|
|
|
// Media duration set explicitly by JS. At present, this is only ever present
|
|
|
|
// for MSE.
|
2017-08-01 10:06:13 +03:00
|
|
|
Maybe<double> mExplicitDuration;
|
2015-07-17 08:00:26 +03:00
|
|
|
|
|
|
|
// Set to one of the valid play states.
|
|
|
|
// This can only be changed on the main thread while holding the decoder
|
|
|
|
// monitor. Thus, it can be safely read while holding the decoder monitor
|
|
|
|
// OR on the main thread.
|
|
|
|
Canonical<PlayState> mPlayState;
|
|
|
|
|
2017-07-31 05:21:43 +03:00
|
|
|
// This can only be changed on the main thread.
|
|
|
|
PlayState mNextState = PLAY_STATE_PAUSED;
|
2015-07-17 08:00:26 +03:00
|
|
|
|
|
|
|
// True if the decoder is seeking.
|
|
|
|
Canonical<bool> mLogicallySeeking;
|
|
|
|
|
2015-08-06 13:05:30 +03:00
|
|
|
// True if the media is same-origin with the element. Data can only be
|
|
|
|
// passed to MediaStreams when this is true.
|
|
|
|
Canonical<bool> mSameOriginMedia;
|
|
|
|
|
2016-02-02 08:14:13 +03:00
|
|
|
// An identifier for the principal of the media. Used to track when
|
|
|
|
// main-thread induced principal changes get reflected on MSG thread.
|
|
|
|
Canonical<PrincipalHandle> mMediaPrincipalHandle;
|
|
|
|
|
2017-07-20 09:13:37 +03:00
|
|
|
// We can allow video decoding in background when we match some special
|
|
|
|
// conditions, eg. when the cursor is hovering over the tab. This observer is
|
|
|
|
// used to listen the related events.
|
|
|
|
RefPtr<BackgroundVideoDecodingPermissionObserver> mVideoDecodingOberver;
|
|
|
|
|
|
|
|
// True if we want to resume video decoding even the media element is in the
|
|
|
|
// background.
|
|
|
|
bool mIsBackgroundVideoDecodingAllowed;
|
|
|
|
|
2015-07-17 08:00:26 +03:00
|
|
|
public:
|
2017-01-27 15:20:37 +03:00
|
|
|
AbstractCanonical<double>* CanonicalVolume() { return &mVolume; }
|
|
|
|
AbstractCanonical<bool>* CanonicalPreservesPitch()
|
|
|
|
{
|
2015-07-17 08:00:26 +03:00
|
|
|
return &mPreservesPitch;
|
|
|
|
}
|
2017-06-08 07:03:10 +03:00
|
|
|
AbstractCanonical<bool>* CanonicalLooping()
|
|
|
|
{
|
|
|
|
return &mLooping;
|
|
|
|
}
|
2017-01-27 15:20:37 +03:00
|
|
|
AbstractCanonical<PlayState>* CanonicalPlayState() { return &mPlayState; }
|
|
|
|
AbstractCanonical<bool>* CanonicalLogicallySeeking()
|
|
|
|
{
|
2015-07-17 08:00:26 +03:00
|
|
|
return &mLogicallySeeking;
|
|
|
|
}
|
2017-01-27 15:20:37 +03:00
|
|
|
AbstractCanonical<bool>* CanonicalSameOriginMedia()
|
|
|
|
{
|
2015-08-06 13:05:30 +03:00
|
|
|
return &mSameOriginMedia;
|
|
|
|
}
|
2017-01-27 15:20:37 +03:00
|
|
|
AbstractCanonical<PrincipalHandle>* CanonicalMediaPrincipalHandle()
|
|
|
|
{
|
2016-02-02 08:14:13 +03:00
|
|
|
return &mMediaPrincipalHandle;
|
|
|
|
}
|
2015-10-27 05:28:26 +03:00
|
|
|
|
|
|
|
private:
|
2016-01-21 05:27:38 +03:00
|
|
|
// Notify owner when the audible state changed
|
|
|
|
void NotifyAudibleStateChanged();
|
|
|
|
|
2015-11-25 02:52:48 +03:00
|
|
|
bool mTelemetryReported;
|
2017-06-26 12:10:47 +03:00
|
|
|
const MediaContainerType mContainerType;
|
2017-08-04 12:38:20 +03:00
|
|
|
bool mCanPlayThrough = false;
|
2008-07-30 10:50:14 +04:00
|
|
|
};
|
|
|
|
|
2012-11-14 23:45:33 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2008-07-30 10:50:14 +04:00
|
|
|
#endif
|