Bug 905513 - Annotate functions with virtual/MOZ_OVERRIDE and document use of SBR monitor.

This commit is contained in:
Matthew Gregan 2013-09-27 17:22:38 +12:00
parent b64f0348e3
commit 9d86738c16
5 changed files with 95 additions and 245 deletions

View File

@ -30,49 +30,49 @@ public:
// This has to be called before decoding begins
void BeginDecoding(nsIThread* aDecodeThread);
ReentrantMonitor& GetReentrantMonitor() MOZ_OVERRIDE;
virtual ReentrantMonitor& GetReentrantMonitor() MOZ_OVERRIDE;
bool IsShutdown() const MOZ_FINAL MOZ_OVERRIDE;
virtual bool IsShutdown() const MOZ_FINAL MOZ_OVERRIDE;
bool OnStateMachineThread() const MOZ_OVERRIDE;
virtual bool OnStateMachineThread() const MOZ_OVERRIDE;
bool OnDecodeThread() const MOZ_OVERRIDE;
virtual bool OnDecodeThread() const MOZ_OVERRIDE;
MediaResource* GetResource() const MOZ_OVERRIDE;
virtual MediaResource* GetResource() const MOZ_OVERRIDE;
void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) MOZ_FINAL MOZ_OVERRIDE;
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) MOZ_FINAL MOZ_OVERRIDE;
int64_t GetEndMediaTime() const MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetEndMediaTime() const MOZ_FINAL MOZ_OVERRIDE;
int64_t GetMediaDuration() MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetMediaDuration() MOZ_FINAL MOZ_OVERRIDE;
void SetMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
virtual void SetMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
virtual void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
void SetMediaSeekable(bool aMediaSeekable) MOZ_OVERRIDE;
virtual void SetMediaSeekable(bool aMediaSeekable) MOZ_OVERRIDE;
void SetTransportSeekable(bool aTransportSeekable) MOZ_OVERRIDE;
virtual void SetTransportSeekable(bool aTransportSeekable) MOZ_OVERRIDE;
VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE;
layers::ImageContainer* GetImageContainer() MOZ_OVERRIDE;
virtual VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE;
virtual layers::ImageContainer* GetImageContainer() MOZ_OVERRIDE;
bool IsTransportSeekable() MOZ_FINAL MOZ_OVERRIDE;
virtual bool IsTransportSeekable() MOZ_FINAL MOZ_OVERRIDE;
bool IsMediaSeekable() MOZ_FINAL MOZ_OVERRIDE;
virtual bool IsMediaSeekable() MOZ_FINAL MOZ_OVERRIDE;
void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
void QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
virtual void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
virtual void QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
void SetMediaEndTime(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
virtual void SetMediaEndTime(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
void UpdatePlaybackPosition(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
virtual void UpdatePlaybackPosition(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
void OnReadMetadataCompleted() MOZ_FINAL MOZ_OVERRIDE;
virtual void OnReadMetadataCompleted() MOZ_FINAL MOZ_OVERRIDE;
MediaDecoderOwner* GetOwner() MOZ_FINAL MOZ_OVERRIDE;
virtual MediaDecoderOwner* GetOwner() MOZ_FINAL MOZ_OVERRIDE;
protected:
// This monitor object is not really used to synchronize access to anything.

View File

@ -20,7 +20,7 @@ public:
, mName(aName)
{}
NS_IMETHOD Run()
NS_IMETHOD Run() MOZ_OVERRIDE
{
mTarget->DispatchSimpleEvent(mName);
return NS_OK;

View File

@ -38,9 +38,9 @@ class MediaSourceDecoder : public MediaDecoder
public:
MediaSourceDecoder(HTMLMediaElement* aElement);
MediaDecoder* Clone() MOZ_OVERRIDE;
MediaDecoderStateMachine* CreateStateMachine() MOZ_OVERRIDE;
nsresult Load(nsIStreamListener**, MediaDecoder*) MOZ_OVERRIDE;
virtual MediaDecoder* Clone() MOZ_OVERRIDE;
virtual MediaDecoderStateMachine* CreateStateMachine() MOZ_OVERRIDE;
virtual nsresult Load(nsIStreamListener**, MediaDecoder*) MOZ_OVERRIDE;
void AttachMediaSource(MediaSource* aMediaSource);
void DetachMediaSource();
@ -91,151 +91,42 @@ private:
class MediaSourceResource MOZ_FINAL : public MediaResource
{
public:
MediaSourceResource()
{
}
MediaSourceResource() {}
nsresult Close()
{
return NS_OK;
}
virtual nsresult Close() MOZ_OVERRIDE { return NS_OK; }
virtual void Suspend(bool aCloseImmediately) MOZ_OVERRIDE {}
virtual void Resume() MOZ_OVERRIDE {}
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() MOZ_OVERRIDE { return nullptr; }
virtual bool CanClone() MOZ_OVERRIDE { return false; }
virtual already_AddRefed<MediaResource> CloneData(MediaDecoder* aDecoder) MOZ_OVERRIDE { return nullptr; }
virtual void SetReadMode(MediaCacheStream::ReadMode aMode) MOZ_OVERRIDE {}
virtual void SetPlaybackRate(uint32_t aBytesPerSecond) MOZ_OVERRIDE {}
virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult Seek(int32_t aWhence, int64_t aOffset) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual void StartSeekingForMetadata() MOZ_OVERRIDE {}
virtual void EndSeekingForMetadata() MOZ_OVERRIDE {}
virtual int64_t Tell() MOZ_OVERRIDE { return -1; }
virtual void Pin() MOZ_OVERRIDE {}
virtual void Unpin() MOZ_OVERRIDE {}
virtual double GetDownloadRate(bool* aIsReliable) MOZ_OVERRIDE { return 0; }
virtual int64_t GetLength() MOZ_OVERRIDE { return -1; }
virtual int64_t GetNextCachedData(int64_t aOffset) MOZ_OVERRIDE { return aOffset; }
virtual int64_t GetCachedDataEnd(int64_t aOffset) MOZ_OVERRIDE { return GetLength(); }
virtual bool IsDataCachedToEndOfResource(int64_t aOffset) MOZ_OVERRIDE { return true; }
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return false; }
virtual bool IsSuspended() MOZ_OVERRIDE { return false; }
virtual nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult Open(nsIStreamListener** aStreamListener) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
void Suspend(bool aCloseImmediately)
{
}
void Resume()
{
}
already_AddRefed<nsIPrincipal> GetCurrentPrincipal()
{
return nullptr;
}
bool CanClone()
{
return false;
}
already_AddRefed<MediaResource> CloneData(MediaDecoder* aDecoder)
{
return nullptr;
}
void SetReadMode(MediaCacheStream::ReadMode aMode)
{
}
void SetPlaybackRate(uint32_t aBytesPerSecond)
{
}
nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
{
return NS_ERROR_FAILURE;
}
nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes)
{
return NS_ERROR_FAILURE;
}
nsresult Seek(int32_t aWhence, int64_t aOffset)
{
return NS_ERROR_FAILURE;
}
void StartSeekingForMetadata()
{
}
void EndSeekingForMetadata()
{
}
int64_t Tell()
{
return -1;
}
void Pin()
{
}
void Unpin()
{
}
double GetDownloadRate(bool* aIsReliable)
{
return 0;
}
int64_t GetLength()
{
return -1;
}
int64_t GetNextCachedData(int64_t aOffset)
{
return aOffset;
}
int64_t GetCachedDataEnd(int64_t aOffset)
{
return GetLength();
}
bool IsDataCachedToEndOfResource(int64_t aOffset)
{
return true;
}
bool IsSuspendedByCache()
{
return false;
}
bool IsSuspended()
{
return false;
}
nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount)
{
return NS_ERROR_FAILURE;
}
nsresult Open(nsIStreamListener** aStreamListener)
{
return NS_ERROR_FAILURE;
}
#ifdef MOZ_DASH
nsresult OpenByteRange(nsIStreamListener** aStreamListener,
const MediaByteRange& aByteRange)
{
return NS_ERROR_FAILURE;
}
#endif
nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) MOZ_OVERRIDE
{
aRanges.AppendElement(MediaByteRange(0, GetLength()));
return NS_OK;
}
bool IsTransportSeekable() MOZ_OVERRIDE
{
return true;
}
const nsCString& GetContentType() const MOZ_OVERRIDE
{
return mType;
}
virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
virtual const nsCString& GetContentType() const MOZ_OVERRIDE { return mType; }
private:
const nsAutoCString mType;

View File

@ -37,92 +37,48 @@ public:
const nsACString& aType);
~SourceBufferResource();
nsresult Close();
void Suspend(bool aCloseImmediately) {}
void Resume() {}
virtual nsresult Close() MOZ_OVERRIDE;
virtual void Suspend(bool aCloseImmediately) MOZ_OVERRIDE {}
virtual void Resume() MOZ_OVERRIDE {}
already_AddRefed<nsIPrincipal> GetCurrentPrincipal()
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() MOZ_OVERRIDE
{
return nsCOMPtr<nsIPrincipal>(mPrincipal).forget();
}
bool CanClone()
{
return false;
}
already_AddRefed<MediaResource> CloneData(MediaDecoder* aDecoder)
virtual already_AddRefed<MediaResource> CloneData(MediaDecoder* aDecoder) MOZ_OVERRIDE
{
return nullptr;
}
void SetReadMode(MediaCacheStream::ReadMode aMode)
{
}
virtual void SetReadMode(MediaCacheStream::ReadMode aMode) MOZ_OVERRIDE {}
virtual void SetPlaybackRate(uint32_t aBytesPerSecond) MOZ_OVERRIDE {}
virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE;
virtual nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE;
virtual nsresult Seek(int32_t aWhence, int64_t aOffset) MOZ_OVERRIDE;
virtual void StartSeekingForMetadata() MOZ_OVERRIDE { }
virtual void EndSeekingForMetadata() MOZ_OVERRIDE {}
virtual int64_t Tell() MOZ_OVERRIDE { return mOffset; }
virtual void Pin() MOZ_OVERRIDE {}
virtual void Unpin() MOZ_OVERRIDE {}
virtual double GetDownloadRate(bool* aIsReliable) MOZ_OVERRIDE { return 0; }
virtual int64_t GetLength() MOZ_OVERRIDE { return mInputBuffer.Length(); }
virtual int64_t GetNextCachedData(int64_t aOffset) MOZ_OVERRIDE { return aOffset; }
virtual int64_t GetCachedDataEnd(int64_t aOffset) MOZ_OVERRIDE { return GetLength(); }
virtual bool IsDataCachedToEndOfResource(int64_t aOffset) MOZ_OVERRIDE { return true; }
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return false; }
virtual bool IsSuspended() MOZ_OVERRIDE { return false; }
virtual nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) MOZ_OVERRIDE;
virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
virtual nsresult Open(nsIStreamListener** aStreamListener) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
void SetPlaybackRate(uint32_t aBytesPerSecond)
{
}
nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes);
nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes);
nsresult Seek(int32_t aWhence, int64_t aOffset);
void StartSeekingForMetadata()
{
}
void EndSeekingForMetadata()
{
}
int64_t Tell()
{
return mOffset;
}
void Pin()
{
}
void Unpin()
{
}
double GetDownloadRate(bool* aIsReliable) { return 0; }
int64_t GetLength() { return mInputBuffer.Length(); }
int64_t GetNextCachedData(int64_t aOffset) { return aOffset; }
int64_t GetCachedDataEnd(int64_t aOffset) { return GetLength(); }
bool IsDataCachedToEndOfResource(int64_t aOffset) { return true; }
bool IsSuspendedByCache() { return false; }
bool IsSuspended() { return false; }
nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount);
nsresult Open(nsIStreamListener** aStreamListener)
{
return NS_ERROR_FAILURE;
}
#ifdef MOZ_DASH
nsresult OpenByteRange(nsIStreamListener** aStreamListener,
const MediaByteRange& aByteRange)
{
return NS_ERROR_FAILURE;
}
#endif
nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) MOZ_OVERRIDE
{
aRanges.AppendElement(MediaByteRange(0, GetLength()));
return NS_OK;
}
bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
const nsCString& GetContentType() const MOZ_OVERRIDE
{
return mType;
}
virtual const nsCString& GetContentType() const MOZ_OVERRIDE { return mType; }
// Used by SourceBuffer.
void AppendData(const uint8_t* aData, uint32_t aLength);
@ -133,6 +89,9 @@ private:
const nsAutoCString mType;
// Provides synchronization between SourceBuffers and InputAdapters.
// Protects all of the member variables below. Read() will await a
// Notify() (from Seek, AppendData, Ended, or Close) when insufficient
// data is available in mData.
ReentrantMonitor mMonitor;
nsTArray<uint8_t> mInputBuffer;

View File

@ -30,15 +30,15 @@ public:
mReader = aReader;
}
ReentrantMonitor& GetReentrantMonitor() MOZ_OVERRIDE;
bool OnStateMachineThread() const MOZ_OVERRIDE;
bool OnDecodeThread() const MOZ_OVERRIDE;
SourceBufferResource* GetResource() const MOZ_OVERRIDE;
void SetMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
void SetMediaSeekable(bool aMediaSeekable) MOZ_OVERRIDE;
void SetTransportSeekable(bool aTransportSeekable) MOZ_OVERRIDE;
layers::ImageContainer* GetImageContainer() MOZ_OVERRIDE;
virtual ReentrantMonitor& GetReentrantMonitor() MOZ_OVERRIDE;
virtual bool OnStateMachineThread() const MOZ_OVERRIDE;
virtual bool OnDecodeThread() const MOZ_OVERRIDE;
virtual SourceBufferResource* GetResource() const MOZ_OVERRIDE;
virtual void SetMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
virtual void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
virtual void SetMediaSeekable(bool aMediaSeekable) MOZ_OVERRIDE;
virtual void SetTransportSeekable(bool aTransportSeekable) MOZ_OVERRIDE;
virtual layers::ImageContainer* GetImageContainer() MOZ_OVERRIDE;
void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset)
{