2013-09-27 09:22:37 +04: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/. */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_MEDIASOURCEDECODER_H_
|
|
|
|
#define MOZILLA_MEDIASOURCEDECODER_H_
|
|
|
|
|
2014-08-13 16:22:00 +04:00
|
|
|
#include "MediaDecoder.h"
|
2017-08-15 07:13:00 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2019-05-27 19:15:33 +03:00
|
|
|
#include "mozilla/dom/MediaDebugInfoBinding.h"
|
2013-09-27 09:22:37 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class MediaDecoderStateMachine;
|
2015-06-12 02:26:57 +03:00
|
|
|
class MediaSourceDemuxer;
|
2013-09-27 09:22:37 +04:00
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class MediaSource;
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
|
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
|
|
|
DDLoggedTypeDeclNameAndBase(MediaSourceDecoder, MediaDecoder);
|
|
|
|
|
|
|
|
class MediaSourceDecoder : public MediaDecoder,
|
|
|
|
public DecoderDoctorLifeLogger<MediaSourceDecoder> {
|
2013-09-27 09:22:37 +04:00
|
|
|
public:
|
2017-06-07 07:14:11 +03:00
|
|
|
explicit MediaSourceDecoder(MediaDecoderInit& aInit);
|
2013-09-27 09:22:37 +04:00
|
|
|
|
2017-06-23 10:39:57 +03:00
|
|
|
nsresult Load(nsIPrincipal* aPrincipal);
|
2016-01-18 06:46:10 +03:00
|
|
|
media::TimeIntervals GetSeekable() override;
|
2015-06-18 00:22:10 +03:00
|
|
|
media::TimeIntervals GetBuffered() override;
|
2013-09-27 09:22:37 +04:00
|
|
|
|
2016-05-04 11:13:25 +03:00
|
|
|
void Shutdown() override;
|
2014-08-25 08:09:44 +04:00
|
|
|
|
2013-11-18 08:22:47 +04:00
|
|
|
void AttachMediaSource(dom::MediaSource* aMediaSource);
|
2013-09-27 09:22:37 +04:00
|
|
|
void DetachMediaSource();
|
|
|
|
|
2015-03-23 13:08:05 +03:00
|
|
|
void Ended(bool aEnded);
|
2014-08-26 11:25:09 +04:00
|
|
|
|
2015-02-12 10:52:12 +03:00
|
|
|
// Return the duration of the video in seconds.
|
2016-01-18 06:46:10 +03:00
|
|
|
double GetDuration() override;
|
2015-02-12 10:52:12 +03:00
|
|
|
|
2015-02-04 12:20:15 +03:00
|
|
|
void SetInitialDuration(int64_t aDuration);
|
2016-07-15 16:38:33 +03:00
|
|
|
void SetMediaSourceDuration(double aDuration);
|
2014-08-25 08:09:44 +04:00
|
|
|
|
2015-06-12 02:26:57 +03:00
|
|
|
MediaSourceDemuxer* GetDemuxer() { return mDemuxer; }
|
2014-12-09 22:43:21 +03:00
|
|
|
|
2017-08-24 11:58:06 +03:00
|
|
|
already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override;
|
|
|
|
|
2019-06-04 09:32:37 +03:00
|
|
|
bool HadCrossOriginRedirects() override;
|
|
|
|
|
2017-08-23 19:06:23 +03:00
|
|
|
bool IsTransportSeekable() override { return true; }
|
|
|
|
|
2019-05-27 19:15:33 +03:00
|
|
|
// Returns a structure describing the state of the MediaSource internal
|
2015-01-29 05:35:58 +03:00
|
|
|
// buffered data. Used for debugging purposes.
|
2019-05-27 19:15:33 +03:00
|
|
|
void GetDebugInfo(dom::MediaSourceDecoderDebugInfo& aInfo);
|
2015-01-29 05:35:58 +03:00
|
|
|
|
2015-08-21 01:10:33 +03:00
|
|
|
void AddSizeOfResources(ResourceSizes* aSizes) override;
|
|
|
|
|
2015-12-02 05:01:40 +03:00
|
|
|
MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus() override;
|
|
|
|
|
2017-02-08 13:15:28 +03:00
|
|
|
bool IsMSE() const override { return true; }
|
|
|
|
|
2017-04-27 20:53:53 +03:00
|
|
|
void NotifyInitDataArrived();
|
|
|
|
|
2017-11-30 06:07:13 +03:00
|
|
|
// Called as data appended to the source buffer or EOS is called on the media
|
|
|
|
// source. Main thread only.
|
|
|
|
void NotifyDataArrived();
|
|
|
|
|
2013-09-27 09:22:37 +04:00
|
|
|
private:
|
2017-08-15 07:37:00 +03:00
|
|
|
MediaDecoderStateMachine* CreateStateMachine();
|
2015-01-16 15:49:02 +03:00
|
|
|
void DoSetMediaSourceDuration(double aDuration);
|
2016-05-02 08:21:40 +03:00
|
|
|
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
|
2017-08-04 12:38:20 +03:00
|
|
|
bool CanPlayThroughImpl() override;
|
2015-01-16 15:49:02 +03:00
|
|
|
|
2017-08-24 12:13:03 +03:00
|
|
|
RefPtr<nsIPrincipal> mPrincipal;
|
2017-08-03 10:38:28 +03:00
|
|
|
|
2014-04-21 17:30:00 +04:00
|
|
|
// The owning MediaSource holds a strong reference to this decoder, and
|
|
|
|
// calls Attach/DetachMediaSource on this decoder to set and clear
|
|
|
|
// mMediaSource.
|
2013-11-18 08:22:47 +04:00
|
|
|
dom::MediaSource* mMediaSource;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<MediaSourceDemuxer> mDemuxer;
|
2015-06-12 02:26:57 +03:00
|
|
|
|
2016-08-08 06:56:38 +03:00
|
|
|
bool mEnded;
|
2013-09-27 09:22:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* MOZILLA_MEDIASOURCEDECODER_H_ */
|