Bug 628665 - Supress warnings in nsBuiltinDecoderStateMachine. r=roc

This commit is contained in:
Chris Pearce 2011-03-24 11:28:58 +13:00
Родитель c315c58902
Коммит 7ab7facd1d
5 изменённых файлов: 17 добавлений и 16 удалений

Просмотреть файл

@ -96,7 +96,7 @@ nsAudioAvailableEventManager::~nsAudioAvailableEventManager()
void nsAudioAvailableEventManager::Init(PRUint32 aChannels, PRUint32 aRate)
{
NS_ASSERTION(aChannels != 0 && aRate != 0, "Audio metadata not known.");
mSamplesPerSecond = aChannels * aRate;
mSamplesPerSecond = static_cast<float>(aChannels * aRate);
}
void nsAudioAvailableEventManager::DispatchPendingEvents(PRUint64 aCurrentTime)

Просмотреть файл

@ -78,7 +78,7 @@ static const PRUint32 LOW_AUDIO_MS = 300;
// decoding more audio. If we increase the low audio threshold (see
// LOW_AUDIO_MS above) we'll also increase this value to ensure it's not
// less than the low audio threshold.
const unsigned AMPLE_AUDIO_MS = 1000;
const PRInt64 AMPLE_AUDIO_MS = 1000;
// Maximum number of bytes we'll allocate and write at once to the audio
// hardware when the audio stream contains missing samples and we're
@ -330,12 +330,11 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
videoPlaying = mReader->DecodeVideoFrame(skipToNextKeyframe, currentTime);
decodeTime = TimeStamp::Now() - start;
}
if (THRESHOLD_FACTOR * decodeTime.ToMilliseconds() > lowAudioThreshold &&
if (THRESHOLD_FACTOR * DurationToMs(decodeTime) > lowAudioThreshold &&
!HasLowUndecodedData())
{
lowAudioThreshold =
NS_MIN(static_cast<PRInt64>(THRESHOLD_FACTOR * decodeTime.ToMilliseconds()),
static_cast<PRInt64>(AMPLE_AUDIO_MS));
NS_MIN(THRESHOLD_FACTOR * DurationToMs(decodeTime), AMPLE_AUDIO_MS);
ampleAudioThreshold = NS_MAX(THRESHOLD_FACTOR * lowAudioThreshold,
ampleAudioThreshold);
LOG(PR_LOG_DEBUG,
@ -1458,7 +1457,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
if (currentFrame) {
// Decode one frame and display it.
TimeStamp presTime = mPlayStartTime - mPlayDuration +
TimeDuration::FromMilliseconds(currentFrame->mTime - mStartTime);
MsToDuration(currentFrame->mTime - mStartTime);
NS_ASSERTION(currentFrame->mTime >= mStartTime, "Should have positive frame time");
{
MonitorAutoExit exitMon(mDecoder->GetMonitor());
@ -1513,21 +1512,21 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
}
}
void nsBuiltinDecoderStateMachine::Wait(PRUint32 aMs) {
void nsBuiltinDecoderStateMachine::Wait(PRInt64 aMs) {
mDecoder->GetMonitor().AssertCurrentThreadIn();
TimeStamp end = TimeStamp::Now() + TimeDuration::FromMilliseconds(aMs);
TimeStamp end = TimeStamp::Now() + MsToDuration(aMs);
TimeStamp now;
while ((now = TimeStamp::Now()) < end &&
mState != DECODER_STATE_SHUTDOWN &&
mState != DECODER_STATE_SEEKING)
{
PRInt64 ms = NS_round((end - now).ToSeconds() * 1000);
if (ms == 0) {
PRInt64 ms = static_cast<PRInt64>(NS_round((end - now).ToSeconds() * 1000));
if (ms == 0 || ms > PR_UINT32_MAX) {
break;
}
NS_ASSERTION(ms <= aMs && ms > 0,
"nsBuiltinDecoderStateMachine::Wait interval very wrong!");
mDecoder->GetMonitor().Wait(PR_MillisecondsToInterval(ms));
mDecoder->GetMonitor().Wait(PR_MillisecondsToInterval(static_cast<PRUint32>(ms)));
}
}

Просмотреть файл

@ -282,7 +282,7 @@ protected:
// time, and that the myriad of Notify()s we do an the decoder monitor
// don't cause the audio thread to be starved. The decoder monitor must
// be locked.
void Wait(PRUint32 aMs);
void Wait(PRInt64 aMs);
// Dispatches an asynchronous event to update the media element's ready state.
void UpdateReadyState();

Просмотреть файл

@ -335,7 +335,8 @@ PRBool nsMediaDecoder::CanPlayThrough()
// our download rate or decode rate estimation is otherwise inaccurate,
// we don't suddenly discover that we need to buffer. This is particularly
// required near the start of the media, when not much data is downloaded.
PRInt64 readAheadMargin = stats.mPlaybackRate * CAN_PLAY_THROUGH_MARGIN;
PRInt64 readAheadMargin =
static_cast<PRInt64>(stats.mPlaybackRate * CAN_PLAY_THROUGH_MARGIN);
return stats.mTotalBytes == stats.mDownloadPosition ||
stats.mDownloadPosition > stats.mPlaybackPosition + readAheadMargin;
}

Просмотреть файл

@ -1301,8 +1301,9 @@ PageSync(nsMediaStream* aStream,
NS_ASSERTION(buffer, "Must have a buffer");
// Read from the file into the buffer
PRInt64 bytesToRead = NS_MIN(static_cast<PRInt64>(PAGE_STEP),
aEndOffset - readHead);
PRUint32 bytesToRead =
static_cast<PRUint32>(NS_MIN(static_cast<PRInt64>(PAGE_STEP),
aEndOffset - readHead));
if (bytesToRead <= 0) {
return PAGE_SYNC_END_OF_RANGE;
}
@ -1426,7 +1427,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
// offset using an exponential backoff until we determine the time.
SEEK_LOG(PR_LOG_DEBUG, ("Backing off %d bytes, backsteps=%d",
static_cast<PRInt32>(PAGE_STEP * pow(2.0, backsteps)), backsteps));
guess -= PAGE_STEP * pow(2.0, backsteps);
guess -= PAGE_STEP * static_cast<ogg_int64_t>(pow(2.0, backsteps));
backsteps = NS_MIN(backsteps + 1, maxBackStep);
// We reset mustBackoff. If we still need to backoff further, it will
// be set to PR_TRUE again.