Bug 1394653 - remove MediaResource from the base class of MediaSourceResource.
MozReview-Commit-ID: 9Pmp7K6zp13
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -50,17 +50,17 @@ MediaSourceDecoder::CreateStateMachine()
nsresult
MediaSourceDecoder::Load(nsIPrincipal* aPrincipal)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!GetStateMachine());
AbstractThread::AutoEnter context(AbstractMainThread());
mPrincipal = aPrincipal;
- mResource = new MediaSourceResource();
+ mResource = MakeUnique<MediaSourceResource>();
nsresult rv = MediaShutdownManager::Instance().Register(this);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
SetStateMachine(CreateStateMachine());
if (!GetStateMachine()) {
--- a/dom/media/mediasource/MediaSourceDecoder.h
+++ b/dom/media/mediasource/MediaSourceDecoder.h
@@ -69,17 +69,17 @@ private:
void PinForSeek() override {}
void UnpinForSeek() override {}
MediaDecoderStateMachine* CreateStateMachine();
void DoSetMediaSourceDuration(double aDuration);
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
bool CanPlayThroughImpl() override;
bool IsLiveStream() override final { return !mEnded; }
- RefPtr<MediaSourceResource> mResource;
+ UniquePtr<MediaSourceResource> mResource;
RefPtr<nsIPrincipal> mPrincipal;
// The owning MediaSource holds a strong reference to this decoder, and
// calls Attach/DetachMediaSource on this decoder to set and clear
// mMediaSource.
dom::MediaSource* mMediaSource;
RefPtr<MediaSourceDemuxer> mDemuxer;
--- a/dom/media/mediasource/MediaSourceResource.h
+++ b/dom/media/mediasource/MediaSourceResource.h
@@ -2,78 +2,45 @@
/* 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_MEDIASOURCERESOURCE_H_
#define MOZILLA_MEDIASOURCERESOURCE_H_
-#include "MediaResource.h"
#include "mozilla/Monitor.h"
-#include "mozilla/Logging.h"
-
-extern mozilla::LogModule* GetMediaSourceLog();
-
-#define MSE_DEBUG(arg, ...) \
- MOZ_LOG( \
- GetMediaSourceLog(), \
- mozilla::LogLevel::Debug, \
- ("MediaSourceResource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-
-#define UNIMPLEMENTED() MSE_DEBUG("UNIMPLEMENTED FUNCTION at %s:%d", __FILE__, __LINE__)
namespace mozilla {
-class MediaSourceResource final : public MediaResource
+class MediaSourceResource final
{
public:
MediaSourceResource()
: mMonitor("MediaSourceResource")
, mEnded(false)
{}
- nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) override { UNIMPLEMENTED(); return NS_ERROR_FAILURE; }
- bool ShouldCacheReads() override { UNIMPLEMENTED(); return false; }
- int64_t Tell() override { UNIMPLEMENTED(); return -1; }
- void Pin() override { UNIMPLEMENTED(); }
- void Unpin() override { UNIMPLEMENTED(); }
- int64_t GetLength() override { UNIMPLEMENTED(); return -1; }
- int64_t GetNextCachedData(int64_t aOffset) override { UNIMPLEMENTED(); return -1; }
- int64_t GetCachedDataEnd(int64_t aOffset) override { UNIMPLEMENTED(); return -1; }
- bool IsDataCachedToEndOfResource(int64_t aOffset) override { UNIMPLEMENTED(); return false; }
- nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) override { UNIMPLEMENTED(); return NS_ERROR_FAILURE; }
-
- nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
- {
- UNIMPLEMENTED();
- aRanges += MediaByteRange(0, GetLength());
- return NS_OK;
- }
-
void SetEnded(bool aEnded)
{
MonitorAutoLock mon(mMonitor);
mEnded = aEnded;
}
-private:
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
// TODO: track source buffers appended to MediaSource.
return 0;
}
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
+private:
Monitor mMonitor;
bool mEnded; // protected by mMonitor
};
} // namespace mozilla
-#undef MSE_DEBUG
-#undef UNIMPLEMENTED
-
#endif /* MOZILLA_MEDIASOURCERESOURCE_H_ */