Bug 1394653 - remove MediaResource from the base class of MediaSourceResource. r=jya

MozReview-Commit-ID: 9Pmp7K6zp13

--HG--
extra : rebase_source : b6ce308423c530f6c0b5c71127fc9343561f0fdb
extra : intermediate-source : b443c01608e693905afb69db2ae24bde162a65b9
extra : source : 3fc73f9bd173467c50159bc12ea2274013338b71
This commit is contained in:
JW Wang 2017-08-25 14:08:07 +08:00
parent c26c18e8c8
commit c8952581e9
3 changed files with 4 additions and 37 deletions

View File

@ -55,7 +55,7 @@ MediaSourceDecoder::Load(nsIPrincipal* aPrincipal)
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))) {

View File

@ -74,7 +74,7 @@ private:
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

View File

@ -7,23 +7,11 @@
#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()
@ -31,31 +19,12 @@ public:
, 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.
@ -67,13 +36,11 @@ private:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
private:
Monitor mMonitor;
bool mEnded; // protected by mMonitor
};
} // namespace mozilla
#undef MSE_DEBUG
#undef UNIMPLEMENTED
#endif /* MOZILLA_MEDIASOURCERESOURCE_H_ */