Bug 1186257 - Avoid 'using' namespace imports in headers. r=jya

This is poor style as it can have side-effects in the caller's
code. Instead, use full namespace prefixes.
This commit is contained in:
Ralph Giles 2015-07-22 11:40:09 -07:00
parent 31d84bc29e
commit f104891fe4
6 changed files with 68 additions and 61 deletions

View File

@ -38,9 +38,6 @@ class TrackBuffersManager;
namespace dom {
using media::TimeUnit;
using media::TimeIntervals;
class TimeRanges;
class SourceBuffer final : public DOMEventTargetHelper
@ -60,7 +57,7 @@ public:
}
already_AddRefed<TimeRanges> GetBuffered(ErrorResult& aRv);
TimeIntervals GetTimeIntervals();
media::TimeIntervals GetTimeIntervals();
double TimestampOffset() const
{
@ -168,7 +165,7 @@ private:
void AppendDataErrored(nsresult aError);
// Set timestampOffset, must be called on the main thread.
void SetTimestampOffset(const TimeUnit& aTimestampOffset);
void SetTimestampOffset(const media::TimeUnit& aTimestampOffset);
nsRefPtr<MediaSource> mMediaSource;
@ -180,7 +177,7 @@ private:
double mAppendWindowEnd;
double mApparentTimestampOffset;
TimeUnit mTimestampOffset;
media::TimeUnit mTimestampOffset;
SourceBufferAppendMode mAppendMode;
bool mUpdating;

View File

@ -16,9 +16,6 @@
namespace mozilla {
using media::TimeUnit;
using media::TimeIntervals;
namespace dom {
class SourceBuffer;
}
@ -37,7 +34,7 @@ public:
// Add data to the end of the input buffer.
// Returns false if the append failed.
virtual bool
AppendData(MediaByteBuffer* aData, TimeUnit aTimestampOffset) = 0;
AppendData(MediaByteBuffer* aData, media::TimeUnit aTimestampOffset) = 0;
// Run MSE Buffer Append Algorithm
// 3.5.5 Buffer Append Algorithm.
@ -54,7 +51,8 @@ public:
// Runs MSE range removal algorithm.
// http://w3c.github.io/media-source/#sourcebuffer-coded-frame-removal
virtual nsRefPtr<RangeRemovalPromise> RangeRemoval(TimeUnit aStart, TimeUnit aEnd) = 0;
virtual nsRefPtr<RangeRemovalPromise> RangeRemoval(media::TimeUnit aStart,
media::TimeUnit aEnd) = 0;
enum class EvictDataResult : int8_t
{
@ -69,10 +67,12 @@ public:
// bytes. aBufferStartTime contains the new start time of the data after the
// eviction.
virtual EvictDataResult
EvictData(TimeUnit aPlaybackTime, uint32_t aThreshold, TimeUnit* aBufferStartTime) = 0;
EvictData(media::TimeUnit aPlaybackTime,
uint32_t aThreshold,
media::TimeUnit* aBufferStartTime) = 0;
// Evicts data up to aTime.
virtual void EvictBefore(TimeUnit aTime) = 0;
virtual void EvictBefore(media::TimeUnit aTime) = 0;
// Returns the buffered range currently managed.
// This may be called on any thread.
@ -102,9 +102,9 @@ public:
return AppendState::WAITING_FOR_SEGMENT;
}
virtual void SetGroupStartTimestamp(const TimeUnit& aGroupStartTimestamp) {}
virtual void SetGroupStartTimestamp(const media::TimeUnit& aGroupStartTimestamp) {}
virtual void RestartGroupStartTimestamp() {}
virtual TimeUnit GroupEndTimestamp() = 0;
virtual media::TimeUnit GroupEndTimestamp() = 0;
#if defined(DEBUG)
virtual void Dump(const char* aPath) { }

View File

@ -40,6 +40,7 @@ namespace mozilla {
using media::TimeIntervals;
using media::Interval;
using media::TimeUnit;
TrackBuffer::TrackBuffer(MediaSourceDecoder* aParentDecoder, const nsACString& aType)
: mParentDecoder(aParentDecoder)

View File

@ -31,7 +31,8 @@ public:
nsRefPtr<ShutdownPromise> Shutdown();
bool AppendData(MediaByteBuffer* aData, TimeUnit aTimestampOffset) override;
bool AppendData(MediaByteBuffer* aData,
media::TimeUnit aTimestampOffset) override;
// Append data to the current decoder. Also responsible for calling
// NotifyDataArrived on the decoder to keep buffered range computation up
@ -43,13 +44,16 @@ public:
// bound the data being evicted. It will not evict more than aThreshold
// bytes. aBufferStartTime contains the new start time of the current
// decoders buffered data after the eviction.
EvictDataResult EvictData(TimeUnit aPlaybackTime, uint32_t aThreshold, TimeUnit* aBufferStartTime) override;
EvictDataResult EvictData(media::TimeUnit aPlaybackTime,
uint32_t aThreshold,
media::TimeUnit* aBufferStartTime) override;
// Evicts data held in all the decoders SourceBufferResource from the start
// of the buffer through to aTime.
void EvictBefore(TimeUnit aTime) override;
void EvictBefore(media::TimeUnit aTime) override;
nsRefPtr<RangeRemovalPromise> RangeRemoval(TimeUnit aStart, TimeUnit aEnd) override;
nsRefPtr<RangeRemovalPromise> RangeRemoval(media::TimeUnit aStart,
media::TimeUnit aEnd) override;
void AbortAppendData() override;
@ -68,7 +72,7 @@ public:
void Detach() override;
TimeUnit GroupEndTimestamp() override
media::TimeUnit GroupEndTimestamp() override
{
return Buffered().GetEnd();
}
@ -211,7 +215,7 @@ private:
// AppendData. Accessed on the main thread only.
int64_t mLastStartTimestamp;
Maybe<int64_t> mLastEndTimestamp;
void AdjustDecodersTimestampOffset(TimeUnit aOffset);
void AdjustDecodersTimestampOffset(media::TimeUnit aOffset);
// The timestamp offset used by our current decoder.
media::TimeUnit mLastTimestampOffset;

View File

@ -37,6 +37,9 @@ PRLogModuleInfo* GetMediaSourceSamplesLog()
namespace mozilla {
using dom::SourceBufferAppendMode;
using media::TimeUnit;
using media::TimeInterval;
using media::TimeIntervals;
static const char*
AppendStateToStr(TrackBuffersManager::AppendState aState)
@ -253,7 +256,7 @@ TrackBuffersManager::EvictBefore(TimeUnit aTime)
GetTaskQueue()->Dispatch(task.forget());
}
media::TimeIntervals
TimeIntervals
TrackBuffersManager::Buffered()
{
MSE_DEBUG("");

View File

@ -28,10 +28,6 @@ class MediaSourceDemuxer;
class SourceBuffer;
class SourceBufferResource;
using media::TimeUnit;
using media::TimeInterval;
using media::TimeIntervals;
class TrackBuffersManager : public SourceBufferContentManager {
public:
typedef MozPromise<bool, nsresult, /* IsExclusive = */ true> CodedFrameProcessingPromise;
@ -41,7 +37,8 @@ public:
TrackBuffersManager(dom::SourceBuffer* aParent, MediaSourceDecoder* aParentDecoder, const nsACString& aType);
bool AppendData(MediaByteBuffer* aData, TimeUnit aTimestampOffset) override;
bool AppendData(MediaByteBuffer* aData,
media::TimeUnit aTimestampOffset) override;
nsRefPtr<AppendPromise> BufferAppend() override;
@ -49,14 +46,17 @@ public:
void ResetParserState() override;
nsRefPtr<RangeRemovalPromise> RangeRemoval(TimeUnit aStart, TimeUnit aEnd) override;
nsRefPtr<RangeRemovalPromise> RangeRemoval(media::TimeUnit aStart,
media::TimeUnit aEnd) override;
EvictDataResult
EvictData(TimeUnit aPlaybackTime, uint32_t aThreshold, TimeUnit* aBufferStartTime) override;
EvictData(media::TimeUnit aPlaybackTime,
uint32_t aThreshold,
media::TimeUnit* aBufferStartTime) override;
void EvictBefore(TimeUnit aTime) override;
void EvictBefore(media::TimeUnit aTime) override;
TimeIntervals Buffered() override;
media::TimeIntervals Buffered() override;
int64_t GetSize() override;
@ -69,27 +69,28 @@ public:
return mAppendState;
}
void SetGroupStartTimestamp(const TimeUnit& aGroupStartTimestamp) override;
void SetGroupStartTimestamp(const media::TimeUnit& aGroupStartTimestamp) override;
void RestartGroupStartTimestamp() override;
TimeUnit GroupEndTimestamp() override;
media::TimeUnit GroupEndTimestamp() override;
// Interface for MediaSourceDemuxer
MediaInfo GetMetadata();
const TrackBuffer& GetTrackBuffer(TrackInfo::TrackType aTrack);
const TimeIntervals& Buffered(TrackInfo::TrackType);
TimeIntervals SafeBuffered(TrackInfo::TrackType) const;
const media::TimeIntervals& Buffered(TrackInfo::TrackType);
media::TimeIntervals SafeBuffered(TrackInfo::TrackType) const;
bool IsEnded() const
{
return mEnded;
}
TimeUnit Seek(TrackInfo::TrackType aTrack, const TimeUnit& aTime);
media::TimeUnit Seek(TrackInfo::TrackType aTrack,
const media::TimeUnit& aTime);
uint32_t SkipToNextRandomAccessPoint(TrackInfo::TrackType aTrack,
const TimeUnit& aTimeThreadshold,
const media::TimeUnit& aTimeThreadshold,
bool& aFound);
already_AddRefed<MediaRawData> GetSample(TrackInfo::TrackType aTrack,
const TimeUnit& aFuzz,
const media::TimeUnit& aFuzz,
bool& aError);
TimeUnit GetNextRandomAccessPoint(TrackInfo::TrackType aTrack);
media::TimeUnit GetNextRandomAccessPoint(TrackInfo::TrackType aTrack);
#if defined(DEBUG)
void Dump(const char* aPath) override;
@ -117,8 +118,9 @@ private:
// current media segment.
void FinishCodedFrameProcessing();
void CompleteResetParserState();
nsRefPtr<RangeRemovalPromise> CodedFrameRemovalWithPromise(TimeInterval aInterval);
bool CodedFrameRemoval(TimeInterval aInterval);
nsRefPtr<RangeRemovalPromise>
CodedFrameRemovalWithPromise(media::TimeInterval aInterval);
bool CodedFrameRemoval(media::TimeInterval aInterval);
void SetAppendState(AppendState aAppendState);
bool HasVideo() const
@ -130,7 +132,7 @@ private:
return mAudioTracks.mNumTracks > 0;
}
typedef Pair<nsRefPtr<MediaByteBuffer>, TimeUnit> IncomingBuffer;
typedef Pair<nsRefPtr<MediaByteBuffer>, media::TimeUnit> IncomingBuffer;
void AppendIncomingBuffer(IncomingBuffer aData);
nsTArray<IncomingBuffer> mIncomingBuffers;
@ -145,8 +147,8 @@ private:
Atomic<bool> mBufferFull;
bool mFirstInitializationSegmentReceived;
bool mActiveTrack;
Maybe<TimeUnit> mGroupStartTimestamp;
TimeUnit mGroupEndTimestamp;
Maybe<media::TimeUnit> mGroupStartTimestamp;
media::TimeUnit mGroupEndTimestamp;
nsCString mType;
// ContainerParser objects and methods.
@ -185,7 +187,7 @@ private:
OnDemuxFailed(TrackType::kAudioTrack, aFailure);
}
void DoEvictData(const TimeUnit& aPlaybackTime, uint32_t aThreshold);
void DoEvictData(const media::TimeUnit& aPlaybackTime, uint32_t aThreshold);
struct TrackData {
TrackData()
@ -200,20 +202,20 @@ private:
// last coded frame appended in the current coded frame group.
// The variable is initially unset to indicate that no coded frames have
// been appended yet.
Maybe<TimeUnit> mLastDecodeTimestamp;
Maybe<media::TimeUnit> mLastDecodeTimestamp;
// Last frame duration variable that stores the coded frame duration of the
// last coded frame appended in the current coded frame group.
// The variable is initially unset to indicate that no coded frames have
// been appended yet.
Maybe<TimeUnit> mLastFrameDuration;
Maybe<media::TimeUnit> mLastFrameDuration;
// Highest end timestamp variable that stores the highest coded frame end
// timestamp across all coded frames in the current coded frame group that
// were appended to this track buffer.
// The variable is initially unset to indicate that no coded frames have
// been appended yet.
Maybe<TimeUnit> mHighestEndTimestamp;
Maybe<media::TimeUnit> mHighestEndTimestamp;
// Longest frame duration seen in a coded frame group.
Maybe<TimeUnit> mLongestFrameDuration;
Maybe<media::TimeUnit> mLongestFrameDuration;
// Need random access point flag variable that keeps track of whether the
// track buffer is waiting for a random access point coded frame.
// The variable is initially set to true to indicate that random access
@ -232,7 +234,7 @@ private:
nsTArray<TrackBuffer> mBuffers;
// Track buffer ranges variable that represents the presentation time ranges
// occupied by the coded frames currently stored in the track buffer.
TimeIntervals mBufferedRanges;
media::TimeIntervals mBufferedRanges;
// Byte size of all samples contained in this track buffer.
uint32_t mSizeBuffer;
// TrackInfo of the first metadata received.
@ -243,9 +245,9 @@ private:
// If set, position of the next sample to be retrieved by GetSample().
Maybe<uint32_t> mNextGetSampleIndex;
// Approximation of the next sample's decode timestamp.
TimeUnit mNextSampleTimecode;
media::TimeUnit mNextSampleTimecode;
// Approximation of the next sample's presentation timestamp.
TimeUnit mNextSampleTime;
media::TimeUnit mNextSampleTime;
void ResetAppendState()
{
@ -262,11 +264,11 @@ private:
void CheckSequenceDiscontinuity();
void ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData);
void CheckNextInsertionIndex(TrackData& aTrackData,
const TimeUnit& aSampleTime);
const media::TimeUnit& aSampleTime);
void InsertFrames(TrackBuffer& aSamples,
const TimeIntervals& aIntervals,
const media::TimeIntervals& aIntervals,
TrackData& aTrackData);
void RemoveFrames(const TimeIntervals& aIntervals,
void RemoveFrames(const media::TimeIntervals& aIntervals,
TrackData& aTrackData,
uint32_t aStartIndex);
void UpdateBufferedRanges();
@ -306,9 +308,9 @@ private:
}
RefPtr<TaskQueue> mTaskQueue;
TimeInterval mAppendWindow;
TimeUnit mTimestampOffset;
TimeUnit mLastTimestampOffset;
media::TimeInterval mAppendWindow;
media::TimeUnit mTimestampOffset;
media::TimeUnit mLastTimestampOffset;
void RestoreCachedVariables();
// Strong references to external objects.
@ -332,9 +334,9 @@ private:
// Monitor to protect following objects accessed across multipple threads.
mutable Monitor mMonitor;
// Stable audio and video track time ranges.
TimeIntervals mVideoBufferedRanges;
TimeIntervals mAudioBufferedRanges;
TimeUnit mOfficialGroupEndTimestamp;
media::TimeIntervals mVideoBufferedRanges;
media::TimeIntervals mAudioBufferedRanges;
media::TimeUnit mOfficialGroupEndTimestamp;
// MediaInfo of the first init segment read.
MediaInfo mInfo;
};