Merge "Fix cert-dcl16-c clang-tidy warnings in nuplayer."

gugelfrei
Treehugger Robot 6 years ago committed by Gerrit Code Review
commit 83c76fb62f

@ -68,7 +68,7 @@ NuPlayer::GenericSource::GenericSource(
mVideoDataGeneration(0),
mFetchSubtitleDataGeneration(0),
mFetchTimedTextDataGeneration(0),
mDurationUs(-1ll),
mDurationUs(-1LL),
mAudioIsVorbis(false),
mIsSecure(false),
mIsStreaming(false),
@ -76,7 +76,7 @@ NuPlayer::GenericSource::GenericSource(
mUID(uid),
mMediaClock(mediaClock),
mFd(-1),
mBitrate(-1ll),
mBitrate(-1LL),
mPendingReadBufferTypes(0) {
ALOGV("GenericSource");
CHECK(mediaClock != NULL);
@ -727,7 +727,7 @@ void NuPlayer::GenericSource::fetchTextData(
}
if (msg->what() == kWhatFetchSubtitleData) {
subTimeUs -= 1000000ll; // send subtile data one second earlier
subTimeUs -= 1000000LL; // send subtile data one second earlier
}
sp<AMessage> msg2 = new AMessage(sendWhat, this);
msg2->setInt32("generation", msgGeneration);
@ -764,7 +764,7 @@ void NuPlayer::GenericSource::sendTextData(
notify->post();
if (msg->what() == kWhatSendSubtitleData) {
nextSubTimeUs -= 1000000ll; // send subtile data one second earlier
nextSubTimeUs -= 1000000LL; // send subtile data one second earlier
}
mMediaClock->addTimer(msg, nextSubTimeUs);
}
@ -855,7 +855,7 @@ status_t NuPlayer::GenericSource::dequeueAccessUnit(
// TODO: maxRebufferingMarkMs could be larger than
// mBufferingSettings.mResumePlaybackMarkMs
int64_t restartBufferingMarkUs =
mBufferingSettings.mResumePlaybackMarkMs * 1000ll / 2;
mBufferingSettings.mResumePlaybackMarkMs * 1000LL / 2;
if (finalResult == OK) {
if (durationUs < restartBufferingMarkUs) {
postReadBuffer(audio? MEDIA_TRACK_TYPE_AUDIO : MEDIA_TRACK_TYPE_VIDEO);
@ -1446,7 +1446,7 @@ void NuPlayer::GenericSource::readBuffer(
// TODO: maxRebufferingMarkMs could be larger than
// mBufferingSettings.mResumePlaybackMarkMs
int64_t markUs = (mPreparing ? mBufferingSettings.mInitialMarkMs
: mBufferingSettings.mResumePlaybackMarkMs) * 1000ll;
: mBufferingSettings.mResumePlaybackMarkMs) * 1000LL;
if (finalResult == ERROR_END_OF_STREAM || durationUs >= markUs) {
if (mPreparing || mSentPauseOnBuffering) {
Track *counterTrack =
@ -1514,12 +1514,12 @@ void NuPlayer::GenericSource::schedulePollBuffering() {
sp<AMessage> msg = new AMessage(kWhatPollBuffering, this);
msg->setInt32("generation", mPollBufferingGeneration);
// Enquires buffering status every second.
msg->post(1000000ll);
msg->post(1000000LL);
}
void NuPlayer::GenericSource::onPollBuffering() {
status_t finalStatus = UNKNOWN_ERROR;
int64_t cachedDurationUs = -1ll;
int64_t cachedDurationUs = -1LL;
ssize_t cachedDataRemaining = -1;
if (mCachedSource != NULL) {
@ -1527,15 +1527,15 @@ void NuPlayer::GenericSource::onPollBuffering() {
if (finalStatus == OK) {
off64_t size;
int64_t bitrate = 0ll;
int64_t bitrate = 0LL;
if (mDurationUs > 0 && mCachedSource->getSize(&size) == OK) {
// |bitrate| uses bits/second unit, while size is number of bytes.
bitrate = size * 8000000ll / mDurationUs;
bitrate = size * 8000000LL / mDurationUs;
} else if (mBitrate > 0) {
bitrate = mBitrate;
}
if (bitrate > 0) {
cachedDurationUs = cachedDataRemaining * 8000000ll / bitrate;
cachedDurationUs = cachedDataRemaining * 8000000LL / bitrate;
}
}
}
@ -1550,8 +1550,8 @@ void NuPlayer::GenericSource::onPollBuffering() {
return;
}
if (cachedDurationUs >= 0ll) {
if (mDurationUs > 0ll) {
if (cachedDurationUs >= 0LL) {
if (mDurationUs > 0LL) {
int64_t cachedPosUs = getLastReadPosition() + cachedDurationUs;
int percentage = 100.0 * cachedPosUs / mDurationUs;
if (percentage > 100) {

@ -271,10 +271,10 @@ void NuPlayer::HTTPLiveSource::pollForRawData(
if (fetchType == LiveSession::STREAMTYPE_SUBTITLES) {
notify->post();
msg->post(delayUs > 0ll ? delayUs : 0ll);
msg->post(delayUs > 0LL ? delayUs : 0LL);
return;
} else if (fetchType == LiveSession::STREAMTYPE_METADATA) {
if (delayUs < -1000000ll) { // 1 second
if (delayUs < -1000000LL) { // 1 second
continue;
}
notify->post();
@ -286,7 +286,7 @@ void NuPlayer::HTTPLiveSource::pollForRawData(
}
// try again in 1 second
msg->post(1000000ll);
msg->post(1000000LL);
}
void NuPlayer::HTTPLiveSource::onMessageReceived(const sp<AMessage> &msg) {

@ -750,7 +750,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
}
}
msg->post(1000000ll); // poll again in a second.
msg->post(1000000LL); // poll again in a second.
break;
}
@ -1038,7 +1038,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
}
if (rescan) {
msg->post(100000ll);
msg->post(100000LL);
mScanSourcesPending = true;
}
break;
@ -2675,7 +2675,7 @@ void NuPlayer::onSourceNotify(const sp<AMessage> &msg) {
int posMs;
int64_t timeUs, posUs;
driver->getCurrentPosition(&posMs);
posUs = (int64_t) posMs * 1000ll;
posUs = (int64_t) posMs * 1000LL;
CHECK(buffer->meta()->findInt64("timeUs", &timeUs));
if (posUs < timeUs) {

@ -542,7 +542,7 @@ void NuPlayer::CCDecoder::display(int64_t timeUs) {
ccBuf->meta()->setInt32("track-index", mSelectedTrack);
ccBuf->meta()->setInt64("timeUs", timeUs);
ccBuf->meta()->setInt64("durationUs", 0ll);
ccBuf->meta()->setInt64("durationUs", 0LL);
sp<AMessage> msg = mNotify->dup();
msg->setInt32("what", kWhatClosedCaptionData);

@ -71,10 +71,10 @@ NuPlayer::Decoder::Decoder(
mCCDecoder(ccDecoder),
mPid(pid),
mUid(uid),
mSkipRenderingUntilMediaTimeUs(-1ll),
mNumFramesTotal(0ll),
mNumInputFramesDropped(0ll),
mNumOutputFramesDropped(0ll),
mSkipRenderingUntilMediaTimeUs(-1LL),
mNumFramesTotal(0LL),
mNumInputFramesDropped(0LL),
mNumOutputFramesDropped(0LL),
mVideoWidth(0),
mVideoHeight(0),
mIsAudio(true),
@ -408,10 +408,10 @@ void NuPlayer::Decoder::onSetParameters(const sp<AMessage> &params) {
// TODO: For now, layer fps is calculated for some specific architectures.
// But it really should be extracted from the stream.
mVideoTemporalLayerAggregateFps[0] =
mFrameRateTotal / (float)(1ll << (mNumVideoTemporalLayerTotal - 1));
mFrameRateTotal / (float)(1LL << (mNumVideoTemporalLayerTotal - 1));
for (int32_t i = 1; i < mNumVideoTemporalLayerTotal; ++i) {
mVideoTemporalLayerAggregateFps[i] =
mFrameRateTotal / (float)(1ll << (mNumVideoTemporalLayerTotal - i))
mFrameRateTotal / (float)(1LL << (mNumVideoTemporalLayerTotal - i))
+ mVideoTemporalLayerAggregateFps[i - 1];
}
}
@ -933,7 +933,7 @@ status_t NuPlayer::Decoder::fetchInputData(sp<AMessage> &reply) {
int32_t layerId = 0;
bool haveLayerId = accessUnit->meta()->findInt32("temporal-layer-id", &layerId);
if (mRenderer->getVideoLateByUs() > 100000ll
if (mRenderer->getVideoLateByUs() > 100000LL
&& mIsVideoAVC
&& !IsAVCReferenceFrame(accessUnit)) {
dropAccessUnit = true;

@ -120,7 +120,7 @@ void NuPlayer::DecoderBase::onRequestInputBuffers() {
mRequestInputBuffersPending = true;
sp<AMessage> msg = new AMessage(kWhatRequestInputBuffers, this);
msg->post(10 * 1000ll);
msg->post(10 * 1000LL);
}
}

@ -47,7 +47,7 @@ NuPlayer::DecoderPassThrough::DecoderPassThrough(
: DecoderBase(notify),
mSource(source),
mRenderer(renderer),
mSkipRenderingUntilMediaTimeUs(-1ll),
mSkipRenderingUntilMediaTimeUs(-1LL),
mReachedEOS(true),
mPendingAudioErr(OK),
mPendingBuffersToDrain(0),

@ -473,7 +473,7 @@ status_t NuPlayerDriver::seekTo(int msec, MediaPlayerSeekMode mode) {
ALOGD("seekTo(%p) (%d ms, %d) at state %d", this, msec, mode, mState);
Mutex::Autolock autoLock(mLock);
int64_t seekTimeUs = msec * 1000ll;
int64_t seekTimeUs = msec * 1000LL;
switch (mState) {
case STATE_PREPARED:
@ -530,7 +530,7 @@ status_t NuPlayerDriver::getDuration(int *msec) {
return UNKNOWN_ERROR;
}
*msec = (mDurationUs + 500ll) / 1000;
*msec = (mDurationUs + 500LL) / 1000;
return OK;
}
@ -738,7 +738,7 @@ status_t NuPlayerDriver::invoke(const Parcel &request, Parcel *reply) {
int msec = 0;
// getCurrentPosition should always return OK
getCurrentPosition(&msec);
return mPlayer->selectTrack(trackIndex, true /* select */, msec * 1000ll);
return mPlayer->selectTrack(trackIndex, true /* select */, msec * 1000LL);
}
case INVOKE_ID_UNSELECT_TRACK:

@ -68,10 +68,10 @@ static inline int32_t getAudioSinkPcmMsSetting() {
// Maximum time in paused state when offloading audio decompression. When elapsed, the AudioSink
// is closed to allow the audio DSP to power down.
static const int64_t kOffloadPauseMaxUs = 10000000ll;
static const int64_t kOffloadPauseMaxUs = 10000000LL;
// Maximum allowed delay from AudioSink, 1.5 seconds.
static const int64_t kMaxAllowedAudioSinkDelayUs = 1500000ll;
static const int64_t kMaxAllowedAudioSinkDelayUs = 1500000LL;
static const int64_t kMinimumAudioClockUpdatePeriodUs = 20 /* msec */ * 1000;
@ -109,7 +109,7 @@ NuPlayer::Renderer::Renderer(
mAudioFirstAnchorTimeMediaUs(-1),
mAnchorTimeMediaUs(-1),
mAnchorNumFramesWritten(-1),
mVideoLateByUs(0ll),
mVideoLateByUs(0LL),
mNextVideoTimeMediaUs(-1),
mHasAudio(false),
mHasVideo(false),
@ -564,7 +564,7 @@ void NuPlayer::Renderer::onMessageReceived(const sp<AMessage> &msg) {
// play back.
int64_t delayUs =
mAudioSink->msecsPerFrame()
* numFramesPendingPlayout * 1000ll;
* numFramesPendingPlayout * 1000LL;
if (mPlaybackRate > 1.0f) {
delayUs /= mPlaybackRate;
}
@ -1156,7 +1156,7 @@ int64_t NuPlayer::Renderer::getPendingAudioPlayoutDurationUs(int64_t nowUs) {
int64_t nowUs = ALooper::GetNowUs();
int64_t mediaUs;
if (mMediaClock->getMediaTime(nowUs, &mediaUs) != OK) {
return 0ll;
return 0LL;
} else {
return writtenAudioDurationUs - (mediaUs - mAudioFirstAnchorTimeMediaUs);
}
@ -1371,7 +1371,7 @@ void NuPlayer::Renderer::onDrainVideoQueue() {
tooLate = false;
}
entry->mNotifyConsumed->setInt64("timestampNs", realTimeUs * 1000ll);
entry->mNotifyConsumed->setInt64("timestampNs", realTimeUs * 1000LL);
entry->mNotifyConsumed->setInt32("render", !tooLate);
entry->mNotifyConsumed->post();
mVideoQueue.erase(mVideoQueue.begin());
@ -1503,7 +1503,7 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) {
ALOGV("queueDiff = %.2f secs", diff / 1E6);
if (diff > 100000ll) {
if (diff > 100000LL) {
// Audio data starts More than 0.1 secs before video.
// Drop some audio.

@ -30,7 +30,7 @@
namespace android {
const int64_t kNearEOSTimeoutUs = 2000000ll; // 2 secs
const int64_t kNearEOSTimeoutUs = 2000000LL; // 2 secs
// Default Buffer Underflow/Prepare/StartServer/Overflow Marks
static const int kUnderflowMarkMs = 1000; // 1 second
@ -169,7 +169,7 @@ bool NuPlayer::RTSPSource::haveSufficientDataOnAllTracks() {
// We're going to buffer at least 2 secs worth data on all tracks before
// starting playback (both at startup and after a seek).
static const int64_t kMinDurationUs = 2000000ll;
static const int64_t kMinDurationUs = 2000000LL;
int64_t mediaDurationUs = 0;
getDuration(&mediaDurationUs);
@ -273,7 +273,7 @@ void NuPlayer::RTSPSource::setEOSTimeout(bool audio, int64_t timeout) {
}
status_t NuPlayer::RTSPSource::getDuration(int64_t *durationUs) {
*durationUs = -1ll;
*durationUs = -1LL;
int64_t audioDurationUs;
if (mAudioTrack != NULL
@ -322,7 +322,7 @@ void NuPlayer::RTSPSource::performSeek(int64_t seekTimeUs) {
void NuPlayer::RTSPSource::schedulePollBuffering() {
sp<AMessage> msg = new AMessage(kWhatPollBuffering, this);
msg->post(1000000ll); // 1 second intervals
msg->post(1000000LL); // 1 second intervals
}
void NuPlayer::RTSPSource::checkBuffering(
@ -346,10 +346,10 @@ void NuPlayer::RTSPSource::checkBuffering(
int64_t maxRebufferingMarkUs;
{
Mutex::Autolock _l(mBufferingSettingsLock);
initialMarkUs = mBufferingSettings.mInitialMarkMs * 1000ll;
initialMarkUs = mBufferingSettings.mInitialMarkMs * 1000LL;
// TODO: maxRebufferingMarkUs could be larger than
// mBufferingSettings.mResumePlaybackMarkMs * 1000ll.
maxRebufferingMarkUs = mBufferingSettings.mResumePlaybackMarkMs * 1000ll;
maxRebufferingMarkUs = mBufferingSettings.mResumePlaybackMarkMs * 1000LL;
}
// isFinished when duration is 0 checks for EOS result only
if (bufferedDurationUs > initialMarkUs
@ -369,7 +369,7 @@ void NuPlayer::RTSPSource::checkBuffering(
++overflowCount;
}
int64_t startServerMarkUs =
(kUnderflowMarkMs * 1000ll + maxRebufferingMarkUs) / 2;
(kUnderflowMarkMs * 1000LL + maxRebufferingMarkUs) / 2;
if (bufferedDurationUs < startServerMarkUs) {
++startCount;
}
@ -640,7 +640,7 @@ void NuPlayer::RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
int64_t nptUs =
((double)rtpTime - (double)info->mRTPTime)
/ info->mTimeScale
* 1000000ll
* 1000000LL
+ info->mNormalPlaytimeUs;
accessUnit->meta()->setInt64("timeUs", nptUs);
@ -748,7 +748,7 @@ void NuPlayer::RTSPSource::onConnected() {
TrackInfo info;
info.mTimeScale = timeScale;
info.mRTPTime = 0;
info.mNormalPlaytimeUs = 0ll;
info.mNormalPlaytimeUs = 0LL;
info.mNPTMappingValid = false;
if ((isAudio && mAudioTrack == NULL)

@ -186,7 +186,7 @@ bool NuPlayer::StreamingSource::haveSufficientDataOnAllTracks() {
// We're going to buffer at least 2 secs worth data on all tracks before
// starting playback (both at startup and after a seek).
static const int64_t kMinDurationUs = 2000000ll;
static const int64_t kMinDurationUs = 2000000LL;
sp<AnotherPacketSource> audioTrack = getSource(true /*audio*/);
sp<AnotherPacketSource> videoTrack = getSource(false /*audio*/);

Loading…
Cancel
Save