зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1148102: P3. Add TimeUnitToFrames method. r=jya
This commit is contained in:
Родитель
186d37e9f7
Коммит
ade97e5996
|
@ -41,6 +41,11 @@ CheckedInt64 UsecsToFrames(int64_t aUsecs, uint32_t aRate) {
|
|||
return (CheckedInt64(aUsecs) * aRate) / USECS_PER_S;
|
||||
}
|
||||
|
||||
// Format TimeUnit as number of frames at given rate.
|
||||
CheckedInt64 TimeUnitToFrames(const media::TimeUnit& aTime, uint32_t aRate) {
|
||||
return UsecsToFrames(aTime.ToMicroseconds(), aRate);
|
||||
}
|
||||
|
||||
nsresult SecondsToUsecs(double aSeconds, int64_t& aOutUsecs) {
|
||||
if (aSeconds * double(USECS_PER_S) > INT64_MAX) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -140,6 +140,9 @@ media::TimeUnit FramesToTimeUnit(int64_t aFrames, uint32_t aRate);
|
|||
// overflow while calulating the conversion.
|
||||
CheckedInt64 UsecsToFrames(int64_t aUsecs, uint32_t aRate);
|
||||
|
||||
// Format TimeUnit as number of frames at given rate.
|
||||
CheckedInt64 TimeUnitToFrames(const media::TimeUnit& aTime, uint32_t aRate);
|
||||
|
||||
// Converts milliseconds to seconds.
|
||||
#define MS_TO_SECONDS(ms) ((double)(ms) / (PR_MSEC_PER_SEC))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче