b=1023697 add methods to MediaStream for tick and time conversions r=roc

When MediaTime depends on the audio rate of the graph, the stream will know the
graph rate and so can perform the conversion.

Existing methods in StreamBuffer.h and MediaSegment.h will be removed once
clients have been changed to the new methods.

--HG--
extra : transplant_source : %155uv%90%EC%81%C8%888%C4%17%AF%ED%1B%A0B%90%5E%26
This commit is contained in:
Karl Tomlinson 2014-06-12 16:44:56 +12:00
parent 0820fd82f2
commit e248292a1d

View File

@ -479,6 +479,31 @@ public:
}
const StreamBuffer& GetStreamBuffer() { return mBuffer; }
GraphTime GetStreamBufferStartTime() { return mBufferStartTime; }
double StreamTimeToSeconds(StreamTime aTime)
{
return mozilla::MediaTimeToSeconds(aTime);
}
int64_t StreamTimeToMicroseconds(StreamTime aTime)
{
return mozilla::MediaTimeToMicroseconds(aTime);
}
StreamTime SecondsToStreamTimeRoundDown(double aS)
{
return mozilla::SecondsToMediaTime(aS);
}
TrackTicks TimeToTicksRoundUp(TrackRate aRate, StreamTime aTime)
{
return mozilla::TimeToTicksRoundUp(aRate, aTime);
}
TrackTicks TimeToTicksRoundDown(TrackRate aRate, StreamTime aTime)
{
return mozilla::TimeToTicksRoundDown(aRate, aTime);
}
StreamTime TicksToTimeRoundDown(TrackRate aRate, TrackTicks aTicks)
{
return mozilla::TicksToTimeRoundDown(aRate, aTicks);
}
/**
* Convert graph time to stream time. aTime must be <= mStateComputedTime
* to ensure we know exactly how much time this stream will be blocked during