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

gugelfrei
Chih-hung Hsieh 6 years ago committed by Gerrit Code Review
commit 55e72131c2

@ -566,8 +566,8 @@ ACodec::ACodec()
mDequeueCounter(0),
mMetadataBuffersToSubmit(0),
mNumUndequeuedBuffers(0),
mRepeatFrameDelayUs(-1ll),
mMaxPtsGapUs(0ll),
mRepeatFrameDelayUs(-1LL),
mMaxPtsGapUs(0LL),
mMaxFps(-1),
mFps(-1.0),
mCaptureFps(-1.0),
@ -1818,15 +1818,15 @@ status_t ACodec::configureCodec(
if (!msg->findInt64(
"repeat-previous-frame-after",
&mRepeatFrameDelayUs)) {
mRepeatFrameDelayUs = -1ll;
mRepeatFrameDelayUs = -1LL;
}
// only allow 32-bit value, since we pass it as U32 to OMX.
if (!msg->findInt64("max-pts-gap-to-encoder", &mMaxPtsGapUs)) {
mMaxPtsGapUs = 0ll;
mMaxPtsGapUs = 0LL;
} else if (mMaxPtsGapUs > INT32_MAX || mMaxPtsGapUs < INT32_MIN) {
ALOGW("Unsupported value for max pts gap %lld", (long long) mMaxPtsGapUs);
mMaxPtsGapUs = 0ll;
mMaxPtsGapUs = 0LL;
}
if (!msg->findFloat("max-fps-to-encoder", &mMaxFps)) {
@ -1834,7 +1834,7 @@ status_t ACodec::configureCodec(
}
// notify GraphicBufferSource to allow backward frames
if (mMaxPtsGapUs < 0ll) {
if (mMaxPtsGapUs < 0LL) {
mMaxFps = -1;
}
@ -6538,7 +6538,7 @@ void ACodec::LoadedState::stateEntered() {
mCodec->mDequeueCounter = 0;
mCodec->mMetadataBuffersToSubmit = 0;
mCodec->mRepeatFrameDelayUs = -1ll;
mCodec->mRepeatFrameDelayUs = -1LL;
mCodec->mInputFormat.clear();
mCodec->mOutputFormat.clear();
mCodec->mBaseOutputFormat.clear();
@ -6680,7 +6680,7 @@ status_t ACodec::LoadedState::setupInputSurface() {
return err;
}
if (mCodec->mRepeatFrameDelayUs > 0ll) {
if (mCodec->mRepeatFrameDelayUs > 0LL) {
err = statusFromBinderStatus(
mCodec->mGraphicBufferSource->setRepeatPreviousFrameDelayUs(
mCodec->mRepeatFrameDelayUs));
@ -6693,7 +6693,7 @@ status_t ACodec::LoadedState::setupInputSurface() {
}
}
if (mCodec->mMaxPtsGapUs != 0ll) {
if (mCodec->mMaxPtsGapUs != 0LL) {
OMX_PARAM_U32TYPE maxPtsGapParams;
InitOMXParams(&maxPtsGapParams);
maxPtsGapParams.nPortIndex = kPortIndexInput;

@ -337,7 +337,7 @@ status_t AudioSource::dataCallback(const AudioRecord::Buffer& audioBuffer) {
} else {
// This should not happen in normal case.
ALOGW("Failed to get audio timestamp, fallback to use systemclock");
timeUs = systemTime() / 1000ll;
timeUs = systemTime() / 1000LL;
// Estimate the real sampling time of the 1st sample in this buffer
// from AudioRecord's latency. (Apply this adjustment first so that
// the start time logic is not affected.)

@ -39,7 +39,7 @@
namespace android {
static const int64_t kBufferTimeOutUs = 10000ll; // 10 msec
static const int64_t kBufferTimeOutUs = 10000LL; // 10 msec
static const size_t kRetryCount = 50; // must be >0
sp<IMemory> allocVideoFrame(const sp<MetaData>& trackMeta,
@ -274,7 +274,7 @@ status_t FrameDecoder::extractInternal() {
size_t retriesLeft = kRetryCount;
do {
size_t index;
int64_t ptsUs = 0ll;
int64_t ptsUs = 0LL;
uint32_t flags = 0;
// Queue as many inputs as we possibly can, then block on dequeuing
@ -406,7 +406,7 @@ VideoFrameDecoder::VideoFrameDecoder(
: FrameDecoder(componentName, trackMeta, source),
mIsAvcOrHevc(false),
mSeekMode(MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC),
mTargetTimeUs(-1ll),
mTargetTimeUs(-1LL),
mNumFrames(0),
mNumFramesDecoded(0) {
}
@ -487,7 +487,7 @@ status_t VideoFrameDecoder::onOutputReceived(
const sp<MediaCodecBuffer> &videoFrameBuffer,
const sp<AMessage> &outputFormat,
int64_t timeUs, bool *done) {
bool shouldOutput = (mTargetTimeUs < 0ll) || (timeUs >= mTargetTimeUs);
bool shouldOutput = (mTargetTimeUs < 0LL) || (timeUs >= mTargetTimeUs);
// If this is not the target frame, skip color convert.
if (!shouldOutput) {

@ -240,7 +240,7 @@ void MPEG2TSWriter::SourceInfo::extractCodecSpecificData() {
size -= length;
}
out->meta()->setInt64("timeUs", 0ll);
out->meta()->setInt64("timeUs", 0LL);
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kNotifyBuffer);
@ -842,7 +842,7 @@ void MPEG2TSWriter::writeAccessUnit(
int64_t timeUs;
CHECK(accessUnit->meta()->findInt64("timeUs", &timeUs));
uint32_t PTS = (timeUs * 9ll) / 100ll;
uint32_t PTS = (timeUs * 9LL) / 100LL;
size_t PES_packet_length = accessUnit->size() + 8;
bool padding = (accessUnit->size() < (188 - 18));

@ -481,7 +481,7 @@ void MPEG4Writer::initInternal(int fd, bool isFirstSession) {
mInterleaveDurationUs = 1000000;
mStartTimestampUs = -1ll;
mStartTimestampUs = -1LL;
mStartTimeOffsetMs = -1;
mPaused = false;
mStarted = false;
@ -1734,7 +1734,7 @@ bool MPEG4Writer::reachedEOS() {
void MPEG4Writer::setStartTimestampUs(int64_t timeUs) {
ALOGI("setStartTimestampUs: %" PRId64, timeUs);
CHECK_GE(timeUs, 0ll);
CHECK_GE(timeUs, 0LL);
Mutex::Autolock autoLock(mLock);
if (mStartTimestampUs < 0 || mStartTimestampUs > timeUs) {
mStartTimestampUs = timeUs;
@ -3067,7 +3067,7 @@ status_t MPEG4Writer::Track::threadEntry() {
if (mResumed) {
int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs;
if (WARN_UNLESS(durExcludingEarlierPausesUs >= 0ll, "for %s track", trackName)) {
if (WARN_UNLESS(durExcludingEarlierPausesUs >= 0LL, "for %s track", trackName)) {
copy->release();
mSource->stop();
mIsMalformed = true;
@ -3088,7 +3088,7 @@ status_t MPEG4Writer::Track::threadEntry() {
TimestampDebugHelperEntry timestampDebugEntry;
timestampUs -= previousPausedDurationUs;
timestampDebugEntry.pts = timestampUs;
if (WARN_UNLESS(timestampUs >= 0ll, "for %s track", trackName)) {
if (WARN_UNLESS(timestampUs >= 0LL, "for %s track", trackName)) {
copy->release();
mSource->stop();
mIsMalformed = true;
@ -3127,7 +3127,7 @@ status_t MPEG4Writer::Track::threadEntry() {
cttsOffsetTimeUs =
timestampUs + kMaxCttsOffsetTimeUs - decodingTimeUs;
if (WARN_UNLESS(cttsOffsetTimeUs >= 0ll, "for %s track", trackName)) {
if (WARN_UNLESS(cttsOffsetTimeUs >= 0LL, "for %s track", trackName)) {
copy->release();
mSource->stop();
mIsMalformed = true;
@ -3185,7 +3185,7 @@ status_t MPEG4Writer::Track::threadEntry() {
}
}
if (WARN_UNLESS(timestampUs >= 0ll, "for %s track", trackName)) {
if (WARN_UNLESS(timestampUs >= 0LL, "for %s track", trackName)) {
copy->release();
mSource->stop();
mIsMalformed = true;
@ -3206,7 +3206,7 @@ status_t MPEG4Writer::Track::threadEntry() {
currDurationTicks =
((timestampUs * mTimeScale + 500000LL) / 1000000LL -
(lastTimestampUs * mTimeScale + 500000LL) / 1000000LL);
if (currDurationTicks < 0ll) {
if (currDurationTicks < 0LL) {
ALOGE("do not support out of order frames (timestamp: %lld < last: %lld for %s track",
(long long)timestampUs, (long long)lastTimestampUs, trackName);
copy->release();

@ -28,7 +28,7 @@ namespace android {
// Maximum allowed time backwards from anchor change.
// If larger than this threshold, it's treated as discontinuity.
static const int64_t kAnchorFluctuationAllowedUs = 10000ll;
static const int64_t kAnchorFluctuationAllowedUs = 10000LL;
MediaClock::Timer::Timer(const sp<AMessage> &notify, int64_t mediaTimeUs, int64_t adjustRealUs)
: mNotify(notify),

@ -2692,7 +2692,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
int64_t timeoutUs;
CHECK(msg->findInt64("timeoutUs", &timeoutUs));
if (timeoutUs == 0ll) {
if (timeoutUs == 0LL) {
PostReplyWithError(replyID, -EAGAIN);
break;
}
@ -2700,7 +2700,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
mFlags |= kFlagDequeueInputPending;
mDequeueInputReplyID = replyID;
if (timeoutUs > 0ll) {
if (timeoutUs > 0LL) {
sp<AMessage> timeoutMsg =
new AMessage(kWhatDequeueInputTimedOut, this);
timeoutMsg->setInt32(
@ -2766,7 +2766,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
int64_t timeoutUs;
CHECK(msg->findInt64("timeoutUs", &timeoutUs));
if (timeoutUs == 0ll) {
if (timeoutUs == 0LL) {
PostReplyWithError(replyID, -EAGAIN);
break;
}
@ -2774,7 +2774,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
mFlags |= kFlagDequeueOutputPending;
mDequeueOutputReplyID = replyID;
if (timeoutUs > 0ll) {
if (timeoutUs > 0LL) {
sp<AMessage> timeoutMsg =
new AMessage(kWhatDequeueOutputTimedOut, this);
timeoutMsg->setInt32(
@ -3035,7 +3035,7 @@ status_t MediaCodec::queueCSDInputBuffer(size_t bufferIndex) {
msg->setSize("index", bufferIndex);
msg->setSize("offset", 0);
msg->setSize("size", csd->size());
msg->setInt64("timeUs", 0ll);
msg->setInt64("timeUs", 0LL);
msg->setInt32("flags", BUFFER_FLAG_CODECCONFIG);
msg->setPointer("errorDetailMsg", &errorDetailMsg);

@ -372,7 +372,7 @@ int64_t MediaCodecSource::getFirstSampleSystemTimeUs() {
msg->postAndAwaitResponse(&response);
int64_t timeUs;
if (!response->findInt64("time-us", &timeUs)) {
timeUs = -1ll;
timeUs = -1LL;
}
return timeUs;
}
@ -452,9 +452,9 @@ MediaCodecSource::MediaCodecSource(
mEncoderDataSpace(0),
mPersistentSurface(persistentSurface),
mInputBufferTimeOffsetUs(0),
mFirstSampleSystemTimeUs(-1ll),
mFirstSampleSystemTimeUs(-1LL),
mPausePending(false),
mFirstSampleTimeUs(-1ll),
mFirstSampleTimeUs(-1LL),
mGeneration(0) {
CHECK(mLooper != NULL);
@ -687,13 +687,13 @@ status_t MediaCodecSource::feedEncoderInputBuffers() {
size_t bufferIndex = *mAvailEncoderInputIndices.begin();
mAvailEncoderInputIndices.erase(mAvailEncoderInputIndices.begin());
int64_t timeUs = 0ll;
int64_t timeUs = 0LL;
uint32_t flags = 0;
size_t size = 0;
if (mbuf != NULL) {
CHECK(mbuf->meta_data().findInt64(kKeyTime, &timeUs));
if (mFirstSampleSystemTimeUs < 0ll) {
if (mFirstSampleSystemTimeUs < 0LL) {
mFirstSampleSystemTimeUs = systemTime() / 1000;
if (mPausePending) {
mPausePending = false;
@ -767,7 +767,7 @@ status_t MediaCodecSource::onStart(MetaData *params) {
}
int64_t startTimeUs;
if (params == NULL || !params->findInt64(kKeyTime, &startTimeUs)) {
startTimeUs = -1ll;
startTimeUs = -1LL;
}
if (mStarted) {
@ -914,7 +914,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {
if (mIsVideo) {
int64_t decodingTimeUs;
if (mFlags & FLAG_USE_SURFACE_INPUT) {
if (mFirstSampleSystemTimeUs < 0ll) {
if (mFirstSampleSystemTimeUs < 0LL) {
mFirstSampleSystemTimeUs = systemTime() / 1000;
if (mPausePending) {
mPausePending = false;
@ -926,7 +926,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {
// Timestamp offset is already adjusted in GraphicBufferSource.
// GraphicBufferSource is supposed to discard samples
// queued before start, and offset timeUs by start time
CHECK_GE(timeUs, 0ll);
CHECK_GE(timeUs, 0LL);
// TODO:
// Decoding time for surface source is unavailable,
// use presentation time for now. May need to move
@ -954,7 +954,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {
}
mbuf->meta_data().setInt64(kKeyTime, timeUs);
} else {
mbuf->meta_data().setInt64(kKeyTime, 0ll);
mbuf->meta_data().setInt64(kKeyTime, 0LL);
mbuf->meta_data().setInt32(kKeyIsCodecConfig, true);
}
if (flags & MediaCodec::BUFFER_FLAG_SYNCFRAME) {
@ -1081,7 +1081,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {
MetaData *params = static_cast<MetaData *>(obj.get());
int64_t pauseStartTimeUs = -1;
if (params == NULL || !params->findInt64(kKeyTime, &pauseStartTimeUs)) {
pauseStartTimeUs = -1ll;
pauseStartTimeUs = -1LL;
}
onPause(pauseStartTimeUs);
}

@ -36,7 +36,7 @@
// Maximum late time allowed for a video frame to be rendered. When a video
// frame arrives later than this number, it will be discarded without rendering.
static const int64_t kMaxAllowedVideoLateTimeUs = 40000ll;
static const int64_t kMaxAllowedVideoLateTimeUs = 40000LL;
namespace android {

@ -436,12 +436,12 @@ void NuCachedSource2::onFetch() {
if (mFetching) {
if (mFinalStatus != OK && mNumRetriesLeft > 0) {
// We failed this time and will try again in 3 seconds.
delayUs = 3000000ll;
delayUs = 3000000LL;
} else {
delayUs = 0;
}
} else {
delayUs = 100000ll;
delayUs = 100000LL;
}
(new AMessage(kWhatFetchMore, mReflector))->post(delayUs);
@ -728,7 +728,7 @@ void NuCachedSource2::updateCacheParamsFromString(const char *s) {
}
if (keepAliveSecs >= 0) {
mKeepAliveIntervalUs = keepAliveSecs * 1000000ll;
mKeepAliveIntervalUs = keepAliveSecs * 1000000LL;
} else {
mKeepAliveIntervalUs = kDefaultKeepAliveIntervalUs;
}

@ -42,7 +42,7 @@ namespace android {
NuMediaExtractor::Sample::Sample()
: mBuffer(NULL),
mSampleTimeUs(-1ll) {
mSampleTimeUs(-1LL) {
}
NuMediaExtractor::Sample::Sample(MediaBufferBase *buffer, int64_t timeUs)
@ -51,8 +51,8 @@ NuMediaExtractor::Sample::Sample(MediaBufferBase *buffer, int64_t timeUs)
}
NuMediaExtractor::NuMediaExtractor()
: mTotalBitrate(-1ll),
mDurationUs(-1ll) {
: mTotalBitrate(-1LL),
mDurationUs(-1LL) {
}
NuMediaExtractor::~NuMediaExtractor() {
@ -219,8 +219,8 @@ status_t NuMediaExtractor::updateDurationAndBitrate() {
return ERROR_UNSUPPORTED;
}
mTotalBitrate = 0ll;
mDurationUs = -1ll;
mTotalBitrate = 0LL;
mDurationUs = -1LL;
for (size_t i = 0; i < mImpl->countTracks(); ++i) {
sp<MetaData> meta = mImpl->getTrackMetaData(i);
@ -235,8 +235,8 @@ status_t NuMediaExtractor::updateDurationAndBitrate() {
CHECK(meta->findCString(kKeyMIMEType, &mime));
ALOGV("track of type '%s' does not publish bitrate", mime);
mTotalBitrate = -1ll;
} else if (mTotalBitrate >= 0ll) {
mTotalBitrate = -1LL;
} else if (mTotalBitrate >= 0LL) {
mTotalBitrate += bitrate;
}
@ -513,7 +513,7 @@ void NuMediaExtractor::fetchTrackSamples(TrackInfo *info,
}
MediaSource::ReadOptions options;
if (seekTimeUs >= 0ll) {
if (seekTimeUs >= 0LL) {
options.setSeekTo(seekTimeUs, mode);
info->mFinalResult = OK;
releaseTrackSamples(info);
@ -778,7 +778,7 @@ bool NuMediaExtractor::getTotalBitrate(int64_t *bitrate) const {
off64_t size;
if (mDurationUs > 0 && mDataSource->getSize(&size) == OK) {
*bitrate = size * 8000000ll / mDurationUs; // in bits/sec
*bitrate = size * 8000000LL / mDurationUs; // in bits/sec
return true;
}

@ -51,7 +51,7 @@ ssize_t ThrottledSource::readAt(off64_t offset, void *data, size_t size) {
// How long would it have taken to transfer everything we ever
// transferred given the limited bandwidth.
int64_t durationUs =
mTotalTransferred * 1000000ll / mBandwidthLimitBytesPerSecond;
mTotalTransferred * 1000000LL / mBandwidthLimitBytesPerSecond;
int64_t whenUs = mStartTimeUs + durationUs;

@ -1802,7 +1802,7 @@ AString uriDebugString(const AString &uri, bool incognito) {
HLSTime::HLSTime(const sp<AMessage>& meta) :
mSeq(-1),
mTimeUs(-1ll),
mTimeUs(-1LL),
mMeta(meta) {
if (meta != NULL) {
CHECK(meta->findInt32("discontinuitySeq", &mSeq));
@ -1811,7 +1811,7 @@ HLSTime::HLSTime(const sp<AMessage>& meta) :
}
int64_t HLSTime::getSegmentTimeUs() const {
int64_t segmentStartTimeUs = -1ll;
int64_t segmentStartTimeUs = -1LL;
if (mMeta != NULL) {
CHECK(mMeta->findInt64("segmentStartTimeUs", &segmentStartTimeUs));

@ -35,7 +35,7 @@ FrameDropper::~FrameDropper() {
status_t FrameDropper::setMaxFrameRate(float maxFrameRate) {
if (maxFrameRate < 0) {
mMinIntervalUs = -1ll;
mMinIntervalUs = -1LL;
return OK;
}

@ -292,20 +292,20 @@ GraphicBufferSource::GraphicBufferSource() :
mSuspended(false),
mLastFrameTimestampUs(-1),
mStopTimeUs(-1),
mLastActionTimeUs(-1ll),
mSkipFramesBeforeNs(-1ll),
mFrameRepeatIntervalUs(-1ll),
mLastActionTimeUs(-1LL),
mSkipFramesBeforeNs(-1LL),
mFrameRepeatIntervalUs(-1LL),
mRepeatLastFrameGeneration(0),
mOutstandingFrameRepeatCount(0),
mFrameRepeatBlockedOnCodecBuffer(false),
mFps(-1.0),
mCaptureFps(-1.0),
mBaseCaptureUs(-1ll),
mBaseFrameUs(-1ll),
mBaseCaptureUs(-1LL),
mBaseFrameUs(-1LL),
mFrameCount(0),
mPrevCaptureUs(-1ll),
mPrevFrameUs(-1ll),
mInputBufferTimeOffsetUs(0ll) {
mPrevCaptureUs(-1LL),
mPrevFrameUs(-1LL),
mInputBufferTimeOffsetUs(0LL) {
ALOGV("GraphicBufferSource");
String8 name("GraphicBufferSource");
@ -392,7 +392,7 @@ Status GraphicBufferSource::start() {
submitEndOfInputStream_l();
}
if (mFrameRepeatIntervalUs > 0ll && mLooper == NULL) {
if (mFrameRepeatIntervalUs > 0LL && mLooper == NULL) {
mReflector = new AHandlerReflector<GraphicBufferSource>(this);
mLooper = new ALooper;
@ -655,7 +655,7 @@ bool GraphicBufferSource::fillCodecBuffer_l() {
// only submit sample if start time is unspecified, or sample
// is queued after the specified start time
if (mSkipFramesBeforeNs < 0ll || item.mTimestampNs >= mSkipFramesBeforeNs) {
if (mSkipFramesBeforeNs < 0LL || item.mTimestampNs >= mSkipFramesBeforeNs) {
// if start time is set, offset time stamp by start time
if (mSkipFramesBeforeNs > 0) {
item.mTimestampNs -= mSkipFramesBeforeNs;
@ -677,7 +677,7 @@ bool GraphicBufferSource::fillCodecBuffer_l() {
} else {
// Don't set the last buffer id if we're not repeating,
// we'll be holding on to the last buffer for nothing.
if (mFrameRepeatIntervalUs > 0ll) {
if (mFrameRepeatIntervalUs > 0LL) {
setLatestBuffer_l(item);
}
ALOGV("buffer submitted [slot=%d, useCount=%ld] acquired=%d",
@ -755,7 +755,7 @@ bool GraphicBufferSource::calculateCodecTimestamp_l(
&& (mFps > 2 * mCaptureFps
|| mCaptureFps > 2 * mFps)) {
// Time lapse or slow motion mode
if (mPrevCaptureUs < 0ll) {
if (mPrevCaptureUs < 0LL) {
// first capture
mPrevCaptureUs = mBaseCaptureUs = timeUs;
// adjust the first sample timestamp.
@ -1115,19 +1115,19 @@ status_t GraphicBufferSource::configure(
mSuspended = false;
mEndOfStream = false;
mEndOfStreamSent = false;
mSkipFramesBeforeNs = -1ll;
mSkipFramesBeforeNs = -1LL;
mFrameDropper.clear();
mFrameRepeatIntervalUs = -1ll;
mFrameRepeatIntervalUs = -1LL;
mRepeatLastFrameGeneration = 0;
mOutstandingFrameRepeatCount = 0;
mLatestBuffer.mBuffer.reset();
mFrameRepeatBlockedOnCodecBuffer = false;
mFps = -1.0;
mCaptureFps = -1.0;
mBaseCaptureUs = -1ll;
mBaseFrameUs = -1ll;
mPrevCaptureUs = -1ll;
mPrevFrameUs = -1ll;
mBaseCaptureUs = -1LL;
mBaseFrameUs = -1LL;
mPrevCaptureUs = -1LL;
mPrevFrameUs = -1LL;
mFrameCount = 0;
mInputBufferTimeOffsetUs = 0;
mStopTimeUs = -1;
@ -1193,7 +1193,7 @@ status_t GraphicBufferSource::setRepeatPreviousFrameDelayUs(int64_t repeatAfterU
Mutex::Autolock autoLock(mMutex);
if (mExecuting || repeatAfterUs <= 0ll) {
if (mExecuting || repeatAfterUs <= 0LL) {
return INVALID_OPERATION;
}
@ -1205,7 +1205,7 @@ status_t GraphicBufferSource::setTimeOffsetUs(int64_t timeOffsetUs) {
Mutex::Autolock autoLock(mMutex);
// timeOffsetUs must be negative for adjustment.
if (timeOffsetUs >= 0ll) {
if (timeOffsetUs >= 0LL) {
return INVALID_OPERATION;
}
@ -1239,7 +1239,7 @@ status_t GraphicBufferSource::setStartTimeUs(int64_t skipFramesBeforeUs) {
mSkipFramesBeforeNs =
(skipFramesBeforeUs > 0 && skipFramesBeforeUs <= INT64_MAX / 1000) ?
(skipFramesBeforeUs * 1000) : -1ll;
(skipFramesBeforeUs * 1000) : -1LL;
return OK;
}

@ -738,7 +738,7 @@ void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) {
} else {
int64_t currentTime = mBufferTimestamps.top();
currentTime += mStreamInfo->aacSamplesPerFrame *
1000000ll / mStreamInfo->aacSampleRate;
1000000LL / mStreamInfo->aacSampleRate;
mBufferTimestamps.add(currentTime);
}
} else {
@ -989,7 +989,7 @@ void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) {
// adjust/interpolate next time stamp
*currentBufLeft -= decodedSize;
*nextTimeStamp += mStreamInfo->aacSamplesPerFrame *
1000000ll / mStreamInfo->aacSampleRate;
1000000LL / mStreamInfo->aacSampleRate;
ALOGV("adjusted nextTimeStamp/size to %lld/%d",
(long long) *nextTimeStamp, *currentBufLeft);
} else {

@ -63,7 +63,7 @@ SoftAACEncoder2::SoftAACEncoder2(
mInputSize(0),
mInputFrame(NULL),
mAllocatedFrameSize(0),
mInputTimeUs(-1ll),
mInputTimeUs(-1LL),
mSawInputEOS(false),
mSignalledError(false) {
initPorts();
@ -587,7 +587,7 @@ void SoftAACEncoder2::onQueueFilled(OMX_U32 /* portIndex */) {
// "Time" on the input buffer has in effect advanced by the
// number of audio frames we just advanced nOffset by.
inHeader->nTimeStamp +=
(copy * 1000000ll / mSampleRate)
(copy * 1000000LL / mSampleRate)
/ (mNumChannels * sizeof(int16_t));
if (inHeader->nFilledLen == 0) {
@ -725,7 +725,7 @@ void SoftAACEncoder2::onReset() {
mAllocatedFrameSize = 0;
mSentCodecSpecificData = false;
mInputTimeUs = -1ll;
mInputTimeUs = -1LL;
mSawInputEOS = false;
mSignalledError = false;
}

@ -505,7 +505,7 @@ void SoftAMR::onQueueFilled(OMX_U32 /* portIndex */) {
outHeader->nTimeStamp =
mAnchorTimeUs
+ (mNumSamplesOutput * 1000000ll) / kSampleRateNB;
+ (mNumSamplesOutput * 1000000LL) / kSampleRateNB;
mNumSamplesOutput += kNumSamplesPerFrameNB;
} else {
@ -513,7 +513,7 @@ void SoftAMR::onQueueFilled(OMX_U32 /* portIndex */) {
outHeader->nTimeStamp =
mAnchorTimeUs
+ (mNumSamplesOutput * 1000000ll) / kSampleRateWB;
+ (mNumSamplesOutput * 1000000LL) / kSampleRateWB;
mNumSamplesOutput += kNumSamplesPerFrameWB;
}

@ -49,7 +49,7 @@ SoftAMRNBEncoder::SoftAMRNBEncoder(
mBitRate(0),
mMode(MR475),
mInputSize(0),
mInputTimeUs(-1ll),
mInputTimeUs(-1LL),
mSawInputEOS(false),
mSignalledError(false) {
initPorts();
@ -340,7 +340,7 @@ void SoftAMRNBEncoder::onQueueFilled(OMX_U32 /* portIndex */) {
// "Time" on the input buffer has in effect advanced by the
// number of audio frames we just advanced nOffset by.
inHeader->nTimeStamp +=
(copy * 1000000ll / kSampleRate) / sizeof(int16_t);
(copy * 1000000LL / kSampleRate) / sizeof(int16_t);
if (inHeader->nFilledLen == 0) {
if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {

@ -50,7 +50,7 @@ SoftAMRWBEncoder::SoftAMRWBEncoder(
mBitRate(0),
mMode(VOAMRWB_MD66),
mInputSize(0),
mInputTimeUs(-1ll),
mInputTimeUs(-1LL),
mSawInputEOS(false),
mSignalledError(false) {
initPorts();
@ -387,7 +387,7 @@ void SoftAMRWBEncoder::onQueueFilled(OMX_U32 /* portIndex */) {
// "Time" on the input buffer has in effect advanced by the
// number of audio frames we just advanced nOffset by.
inHeader->nTimeStamp +=
(copy * 1000000ll / kSampleRate) / sizeof(int16_t);
(copy * 1000000LL / kSampleRate) / sizeof(int16_t);
if (inHeader->nFilledLen == 0) {
if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {

@ -607,7 +607,7 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
timeTaken = mTimeEnd - mTimeStart;
ALOGV("timeTaken=%6lldus delay=%6lldus numBytes=%6d",
(long long) (timeTaken / 1000ll), (long long) (timeDelay / 1000ll),
(long long) (timeTaken / 1000LL), (long long) (timeDelay / 1000LL),
s_dec_op.u4_num_bytes_consumed);
if (s_dec_op.u4_frame_decoded_flag && !mFlushNeeded) {
mFlushNeeded = true;

@ -372,7 +372,7 @@ void SoftG711::DecodeMLaw(
int32_t step = 4 << segment;
int32_t abs = (0x80l << exponent) + step * mantissa + step / 2 - 4 * 33;
int32_t abs = (0x80L << exponent) + step * mantissa + step / 2 - 4 * 33;
*out++ = (x < 0x80) ? -abs : abs;
}

@ -407,7 +407,7 @@ void SoftMP3::onQueueFilled(OMX_U32 /* portIndex */) {
}
outHeader->nTimeStamp =
mAnchorTimeUs + (mNumFramesOutput * 1000000ll) / mSamplingRate;
mAnchorTimeUs + (mNumFramesOutput * 1000000LL) / mSamplingRate;
if (inHeader) {
CHECK_GE((int32_t)inHeader->nFilledLen, mConfig->inputBufferUsedLength);

@ -570,7 +570,7 @@ void SoftOpus::onQueueFilled(OMX_U32 /* portIndex */) {
outHeader->nFilledLen = numFrames * sizeof(int16_t) * mHeader->channels;
outHeader->nTimeStamp = mAnchorTimeUs +
(mNumFramesOutput * 1000000ll) /
(mNumFramesOutput * 1000000LL) /
kRate;
mNumFramesOutput += numFrames;

@ -554,7 +554,7 @@ void SoftVorbis::onQueueFilled(OMX_U32 /* portIndex */) {
outHeader->nTimeStamp =
mAnchorTimeUs
+ (mNumFramesOutput * 1000000ll) / mVi->rate;
+ (mNumFramesOutput * 1000000LL) / mVi->rate;
mNumFramesOutput += numFrames;

@ -665,7 +665,7 @@ void SoftXAAC::onQueueFilled(OMX_U32 /* portIndex */) {
mCurrentTimestamp = inHeader->nTimeStamp;
mLastInHeader = inHeader;
} else {
mCurrentTimestamp = mPrevTimestamp + mOutputFrameLength * 1000000ll / mSampFreq;
mCurrentTimestamp = mPrevTimestamp + mOutputFrameLength * 1000000LL / mSampFreq;
}
} else {
inBuffer = inHeader->pBuffer + inHeader->nOffset;

@ -66,7 +66,7 @@ private:
// static
int64_t ALooper::GetNowUs() {
return systemTime(SYSTEM_TIME_MONOTONIC) / 1000ll;
return systemTime(SYSTEM_TIME_MONOTONIC) / 1000LL;
}
ALooper::ALooper()

@ -44,10 +44,10 @@ namespace android {
// static
// Bandwidth Switch Mark Defaults
const int64_t LiveSession::kUpSwitchMarkUs = 15000000ll;
const int64_t LiveSession::kDownSwitchMarkUs = 20000000ll;
const int64_t LiveSession::kUpSwitchMarginUs = 5000000ll;
const int64_t LiveSession::kResumeThresholdUs = 100000ll;
const int64_t LiveSession::kUpSwitchMarkUs = 15000000LL;
const int64_t LiveSession::kDownSwitchMarkUs = 20000000LL;
const int64_t LiveSession::kUpSwitchMarginUs = 5000000LL;
const int64_t LiveSession::kResumeThresholdUs = 100000LL;
//TODO: redefine this mark to a fair value
// default buffer underflow mark
@ -66,9 +66,9 @@ private:
// Bandwidth estimation parameters
static const int32_t kShortTermBandwidthItems = 3;
static const int32_t kMinBandwidthHistoryItems = 20;
static const int64_t kMinBandwidthHistoryWindowUs = 5000000ll; // 5 sec
static const int64_t kMaxBandwidthHistoryWindowUs = 30000000ll; // 30 sec
static const int64_t kMaxBandwidthHistoryAgeUs = 60000000ll; // 60 sec
static const int64_t kMinBandwidthHistoryWindowUs = 5000000LL; // 5 sec
static const int64_t kMaxBandwidthHistoryWindowUs = 30000000LL; // 30 sec
static const int64_t kMaxBandwidthHistoryAgeUs = 60000000LL; // 60 sec
struct BandwidthEntry {
int64_t mTimestampUs;
@ -284,7 +284,7 @@ LiveSession::LiveSession(
mPrevBufferPercentage(-1),
mCurBandwidthIndex(-1),
mOrigBandwidthIndex(-1),
mLastBandwidthBps(-1ll),
mLastBandwidthBps(-1LL),
mLastBandwidthStable(false),
mBandwidthEstimator(new BandwidthEstimator()),
mMaxWidth(720),
@ -294,8 +294,8 @@ LiveSession::LiveSession(
mSwapMask(0),
mSwitchGeneration(0),
mSubtitleGeneration(0),
mLastDequeuedTimeUs(0ll),
mRealTimeBaseUs(0ll),
mLastDequeuedTimeUs(0LL),
mRealTimeBaseUs(0LL),
mReconfigurationInProgress(false),
mSwitchInProgress(false),
mUpSwitchMark(kUpSwitchMarkUs),
@ -844,7 +844,7 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) {
// (If we don't have that cushion we'd rather cancel and try again.)
int64_t delayUs =
switchUp ?
(kUnderflowMarkMs * 1000ll + 1000000ll)
(kUnderflowMarkMs * 1000LL + 1000000LL)
: 0;
bool needResumeUntil = false;
sp<AMessage> stopParams = msg;
@ -954,7 +954,7 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) {
// static
bool LiveSession::isBandwidthValid(const BandwidthItem &item) {
static const int64_t kBlacklistWindowUs = 300 * 1000000ll;
static const int64_t kBlacklistWindowUs = 300 * 1000000LL;
return item.mLastFailureUs < 0
|| ALooper::GetNowUs() - item.mLastFailureUs > kBlacklistWindowUs;
}
@ -1060,7 +1060,7 @@ void LiveSession::onMasterPlaylistFetched(const sp<AMessage> &msg) {
BandwidthItem item;
item.mPlaylistIndex = i;
item.mLastFailureUs = -1ll;
item.mLastFailureUs = -1LL;
sp<AMessage> meta;
AString uri;
@ -1114,7 +1114,7 @@ void LiveSession::onMasterPlaylistFetched(const sp<AMessage> &msg) {
mPlaylist->pickRandomMediaItems();
changeConfiguration(
0ll /* timeUs */, initialBandwidthIndex, false /* pickTrack */);
0LL /* timeUs */, initialBandwidthIndex, false /* pickTrack */);
}
void LiveSession::finishDisconnect() {
@ -1175,7 +1175,7 @@ sp<PlaylistFetcher> LiveSession::addFetcher(const char *uri) {
FetcherInfo info;
info.mFetcher = new PlaylistFetcher(
notify, this, uri, mCurBandwidthIndex, mSubtitleGeneration);
info.mDurationUs = -1ll;
info.mDurationUs = -1LL;
info.mToBeRemoved = false;
info.mToBeResumed = false;
mFetcherLooper->registerHandler(info.mFetcher);
@ -1466,7 +1466,7 @@ void LiveSession::onSeek(const sp<AMessage> &msg) {
}
status_t LiveSession::getDuration(int64_t *durationUs) const {
int64_t maxDurationUs = -1ll;
int64_t maxDurationUs = -1LL;
for (size_t i = 0; i < mFetcherInfos.size(); ++i) {
int64_t fetcherDurationUs = mFetcherInfos.valueAt(i).mDurationUs;
@ -1592,7 +1592,7 @@ void LiveSession::changeConfiguration(
// Delay fetcher removal if not picking tracks, AND old fetcher
// has stream mask that overlaps new variant. (Okay to discard
// old fetcher now, if completely no overlap.)
if (discardFetcher && timeUs < 0ll && !pickTrack
if (discardFetcher && timeUs < 0LL && !pickTrack
&& (fetcher->getStreamTypeMask() & streamMask)) {
discardFetcher = false;
delayRemoval = true;
@ -1604,7 +1604,7 @@ void LiveSession::changeConfiguration(
} else {
float threshold = 0.0f; // default to pause after current block (47Kbytes)
bool disconnect = false;
if (timeUs >= 0ll) {
if (timeUs >= 0LL) {
// seeking, no need to finish fetching
disconnect = true;
} else if (delayRemoval) {
@ -1620,7 +1620,7 @@ void LiveSession::changeConfiguration(
}
sp<AMessage> msg;
if (timeUs < 0ll) {
if (timeUs < 0LL) {
// skip onChangeConfiguration2 (decoder destruction) if not seeking.
msg = new AMessage(kWhatChangeConfiguration3, this);
} else {
@ -1654,9 +1654,9 @@ void LiveSession::onChangeConfiguration(const sp<AMessage> &msg) {
if (!mReconfigurationInProgress) {
int32_t pickTrack = 0;
msg->findInt32("pickTrack", &pickTrack);
changeConfiguration(-1ll /* timeUs */, -1, pickTrack);
changeConfiguration(-1LL /* timeUs */, -1, pickTrack);
} else {
msg->post(1000000ll); // retry in 1 sec
msg->post(1000000LL); // retry in 1 sec
}
}
@ -1788,7 +1788,7 @@ void LiveSession::onChangeConfiguration3(const sp<AMessage> &msg) {
CHECK(msg->findInt64("timeUs", &timeUs));
CHECK(msg->findInt32("pickTrack", &pickTrack));
if (timeUs < 0ll) {
if (timeUs < 0LL) {
if (!pickTrack) {
// mSwapMask contains streams that are in both old and new variant,
// (in mNewStreamMask & mStreamMask) but with different URIs
@ -2062,7 +2062,7 @@ void LiveSession::tryToFinishBandwidthSwitch(const AString &oldUri) {
void LiveSession::schedulePollBuffering() {
sp<AMessage> msg = new AMessage(kWhatPollBuffering, this);
msg->setInt32("generation", mPollBufferingGeneration);
msg->post(1000000ll);
msg->post(1000000LL);
}
void LiveSession::cancelPollBuffering() {
@ -2208,13 +2208,13 @@ bool LiveSession::checkBuffering(
int64_t readyMarkUs =
(mInPreparationPhase ?
mBufferingSettings.mInitialMarkMs :
mBufferingSettings.mResumePlaybackMarkMs) * 1000ll;
mBufferingSettings.mResumePlaybackMarkMs) * 1000LL;
if (bufferedDurationUs > readyMarkUs
|| mPacketSources[i]->isFinished(0)) {
++readyCount;
}
if (!mPacketSources[i]->isFinished(0)) {
if (bufferedDurationUs < kUnderflowMarkMs * 1000ll) {
if (bufferedDurationUs < kUnderflowMarkMs * 1000LL) {
++underflowCount;
}
if (bufferedDurationUs > mUpSwitchMark) {
@ -2300,7 +2300,7 @@ bool LiveSession::tryBandwidthFallback() {
ssize_t lowestValid = getLowestValidBandwidthIndex();
if (mCurBandwidthIndex > lowestValid) {
cancelBandwidthSwitch();
changeConfiguration(-1ll, lowestValid);
changeConfiguration(-1LL, lowestValid);
return true;
}
}
@ -2370,7 +2370,7 @@ bool LiveSession::switchBandwidthIfNeeded(bool bufferHigh, bool bufferLow) {
// if not yet prepared, just restart again with new bw index.
// this is faster and playback experience is cleaner.
changeConfiguration(
mInPreparationPhase ? 0 : -1ll, bandwidthIndex);
mInPreparationPhase ? 0 : -1LL, bandwidthIndex);
return true;
}
}

@ -258,7 +258,7 @@ M3UParser::M3UParser(
mIsEvent(false),
mFirstSeqNumber(-1),
mLastSeqNumber(-1),
mTargetDurationUs(-1ll),
mTargetDurationUs(-1LL),
mDiscontinuitySeq(0),
mDiscontinuityCount(0),
mSelectedIndex(-1) {
@ -716,7 +716,7 @@ status_t M3UParser::parse(const void *_data, size_t size) {
ALOGE("Media playlist missing #EXT-X-TARGETDURATION");
return ERROR_MALFORMED;
}
mTargetDurationUs = targetDurationSecs * 1000000ll;
mTargetDurationUs = targetDurationSecs * 1000000LL;
mFirstSeqNumber = 0;
if (mMeta != NULL) {

@ -50,8 +50,8 @@
namespace android {
// static
const int64_t PlaylistFetcher::kMinBufferedDurationUs = 30000000ll;
const int64_t PlaylistFetcher::kMaxMonitorDelayUs = 3000000ll;
const int64_t PlaylistFetcher::kMinBufferedDurationUs = 30000000LL;
const int64_t PlaylistFetcher::kMaxMonitorDelayUs = 3000000LL;
// LCM of 188 (size of a TS packet) & 1k works well
const int32_t PlaylistFetcher::kDownloadBlockSize = 47 * 1024;
@ -152,25 +152,25 @@ PlaylistFetcher::PlaylistFetcher(
mURI(uri),
mFetcherID(id),
mStreamTypeMask(0),
mStartTimeUs(-1ll),
mSegmentStartTimeUs(-1ll),
mDiscontinuitySeq(-1ll),
mStartTimeUs(-1LL),
mSegmentStartTimeUs(-1LL),
mDiscontinuitySeq(-1LL),
mStartTimeUsRelative(false),
mLastPlaylistFetchTimeUs(-1ll),
mPlaylistTimeUs(-1ll),
mLastPlaylistFetchTimeUs(-1LL),
mPlaylistTimeUs(-1LL),
mSeqNumber(-1),
mNumRetries(0),
mStartup(true),
mIDRFound(false),
mSeekMode(LiveSession::kSeekModeExactPosition),
mTimeChangeSignaled(false),
mNextPTSTimeUs(-1ll),
mNextPTSTimeUs(-1LL),
mMonitorQueueGeneration(0),
mSubtitleGeneration(subtitleGeneration),
mLastDiscontinuitySeq(-1ll),
mLastDiscontinuitySeq(-1LL),
mRefreshState(INITIAL_MINIMUM_RELOAD_DELAY),
mFirstPTSValid(false),
mFirstTimeUs(-1ll),
mFirstTimeUs(-1LL),
mVideoBuffer(new AnotherPacketSource(NULL)),
mSampleAesKeyItemChanged(false),
mThresholdRatio(-1.0f),
@ -200,7 +200,7 @@ int64_t PlaylistFetcher::getSegmentStartTimeUs(int32_t seqNumber) const {
CHECK_GE(seqNumber, firstSeqNumberInPlaylist);
CHECK_LE(seqNumber, lastSeqNumberInPlaylist);
int64_t segmentStartUs = 0ll;
int64_t segmentStartUs = 0LL;
for (int32_t index = 0;
index < seqNumber - firstSeqNumberInPlaylist; ++index) {
sp<AMessage> itemMeta;
@ -240,13 +240,13 @@ int64_t PlaylistFetcher::getSegmentDurationUs(int32_t seqNumber) const {
int64_t PlaylistFetcher::delayUsToRefreshPlaylist() const {
int64_t nowUs = ALooper::GetNowUs();
if (mPlaylist == NULL || mLastPlaylistFetchTimeUs < 0ll) {
if (mPlaylist == NULL || mLastPlaylistFetchTimeUs < 0LL) {
CHECK_EQ((int)mRefreshState, (int)INITIAL_MINIMUM_RELOAD_DELAY);
return 0ll;
return 0LL;
}
if (mPlaylist->isComplete()) {
return (~0llu >> 1);
return (~0LLU >> 1);
}
int64_t targetDurationUs = mPlaylist->getTargetDuration();
@ -295,7 +295,7 @@ int64_t PlaylistFetcher::delayUsToRefreshPlaylist() const {
}
int64_t delayUs = mLastPlaylistFetchTimeUs + minPlaylistAgeUs - nowUs;
return delayUs > 0ll ? delayUs : 0ll;
return delayUs > 0LL ? delayUs : 0LL;
}
status_t PlaylistFetcher::decryptBuffer(
@ -857,7 +857,7 @@ void PlaylistFetcher::onMonitorQueue() {
targetDurationUs = mPlaylist->getTargetDuration();
}
int64_t bufferedDurationUs = 0ll;
int64_t bufferedDurationUs = 0LL;
status_t finalResult = OK;
if (mStreamTypeMask == LiveSession::STREAMTYPE_SUBTITLES) {
sp<AnotherPacketSource> packetSource =
@ -870,7 +870,7 @@ void PlaylistFetcher::onMonitorQueue() {
// enqueued to prevent us from waiting on a non-existent stream;
// when we cannot make out from the manifest what streams are included in
// a playlist we might assume extra streams.
bufferedDurationUs = -1ll;
bufferedDurationUs = -1LL;
for (size_t i = 0; i < mPacketSources.size(); ++i) {
if ((mStreamTypeMask & mPacketSources.keyAt(i)) == 0
|| mPacketSources[i]->getLatestEnqueuedMeta() == NULL) {
@ -882,13 +882,13 @@ void PlaylistFetcher::onMonitorQueue() {
FSLOGV(mPacketSources.keyAt(i), "buffered %lld", (long long)bufferedStreamDurationUs);
if (bufferedDurationUs == -1ll
if (bufferedDurationUs == -1LL
|| bufferedStreamDurationUs < bufferedDurationUs) {
bufferedDurationUs = bufferedStreamDurationUs;
}
}
if (bufferedDurationUs == -1ll) {
bufferedDurationUs = 0ll;
if (bufferedDurationUs == -1LL) {
bufferedDurationUs = 0LL;
}
}
@ -901,12 +901,12 @@ void PlaylistFetcher::onMonitorQueue() {
// onDownloadNext();
sp<AMessage> msg = new AMessage(kWhatDownloadNext, this);
msg->setInt32("generation", mMonitorQueueGeneration);
msg->post(1000l);
msg->post(1000L);
} else {
// We'd like to maintain buffering above durationToBufferUs, so try
// again when buffer just about to go below durationToBufferUs
// (or after targetDurationUs / 2, whichever is smaller).
int64_t delayUs = bufferedDurationUs - kMinBufferedDurationUs + 1000000ll;
int64_t delayUs = bufferedDurationUs - kMinBufferedDurationUs + 1000000LL;
if (delayUs > targetDurationUs / 2) {
delayUs = targetDurationUs / 2;
}
@ -1073,10 +1073,10 @@ bool PlaylistFetcher::initDownloadState(
}
}
mSegmentFirstPTS = -1ll;
mSegmentFirstPTS = -1LL;
if (mPlaylist != NULL && mSeqNumber < 0) {
CHECK_GE(mStartTimeUs, 0ll);
CHECK_GE(mStartTimeUs, 0LL);
if (mSegmentStartTimeUs < 0) {
if (!mPlaylist->isComplete() && !mPlaylist->isEvent()) {
@ -1379,7 +1379,7 @@ void PlaylistFetcher::onDownloadNext() {
& (LiveSession::STREAMTYPE_AUDIO
| LiveSession::STREAMTYPE_VIDEO))) {
mSession->addBandwidthMeasurement(bytesRead, delayUs);
if (delayUs > 2000000ll) {
if (delayUs > 2000000LL) {
FLOGV("bytesRead %zd took %.2f seconds - abnormal bandwidth dip",
bytesRead, (double)delayUs / 1.0e6);
}
@ -1553,7 +1553,7 @@ bool PlaylistFetcher::adjustSeqNumberWithAnchorTime(int64_t anchorTimeUs) {
// if the previous fetcher paused in the middle of a segment, we
// want to start at a segment that overlaps the last sample
minDiffUs = -mPlaylist->getTargetDuration();
maxDiffUs = 0ll;
maxDiffUs = 0LL;
} else {
// if the previous fetcher paused at the end of a segment, ideally
// we want to start at the segment that's roughly aligned with its
@ -1704,7 +1704,7 @@ status_t PlaylistFetcher::extractAndQueueAccessUnitsFromTs(const sp<ABuffer> &bu
mTSParser = new ATSParser(ATSParser::TS_TIMESTAMPS_ARE_ABSOLUTE);
}
if (mNextPTSTimeUs >= 0ll) {
if (mNextPTSTimeUs >= 0LL) {
sp<AMessage> extra = new AMessage;
// Since we are using absolute timestamps, signal an offset of 0 to prevent
// ATSParser from skewing the timestamps of access units.
@ -1719,7 +1719,7 @@ status_t PlaylistFetcher::extractAndQueueAccessUnitsFromTs(const sp<ABuffer> &bu
mTSParser->signalDiscontinuity(
ATSParser::DISCONTINUITY_TIME, extra);
mNextPTSTimeUs = -1ll;
mNextPTSTimeUs = -1LL;
}
if (mSampleAesKeyItemChanged) {
@ -1740,7 +1740,7 @@ status_t PlaylistFetcher::extractAndQueueAccessUnitsFromTs(const sp<ABuffer> &bu
// setRange to indicate consumed bytes.
buffer->setRange(buffer->offset() + offset, buffer->size() - offset);
if (mSegmentFirstPTS < 0ll) {
if (mSegmentFirstPTS < 0LL) {
// get the smallest first PTS from all streams present in this parser
for (size_t i = mPacketSources.size(); i > 0;) {
i--;
@ -1764,12 +1764,12 @@ status_t PlaylistFetcher::extractAndQueueAccessUnitsFromTs(const sp<ABuffer> &bu
if (meta != NULL) {
int64_t timeUs;
CHECK(meta->findInt64("timeUs", &timeUs));
if (mSegmentFirstPTS < 0ll || timeUs < mSegmentFirstPTS) {
if (mSegmentFirstPTS < 0LL || timeUs < mSegmentFirstPTS) {
mSegmentFirstPTS = timeUs;
}
}
}
if (mSegmentFirstPTS < 0ll) {
if (mSegmentFirstPTS < 0LL) {
// didn't find any TS packet, can return early
return OK;
}
@ -1988,8 +1988,8 @@ status_t PlaylistFetcher::extractAndQueueAccessUnits(
return OK;
}
if (mNextPTSTimeUs >= 0ll) {
mNextPTSTimeUs = -1ll;
if (mNextPTSTimeUs >= 0LL) {
mNextPTSTimeUs = -1LL;
}
// This better be an ISO 13818-7 (AAC) or ISO 13818-1 (MPEG) audio
@ -2088,17 +2088,17 @@ status_t PlaylistFetcher::extractAndQueueAccessUnits(
packetSource->setFormat(meta);
}
int64_t numSamples = 0ll;
int64_t numSamples = 0LL;
int32_t sampleRate;
CHECK(packetSource->getFormat()->findInt32(kKeySampleRate, &sampleRate));
int64_t timeUs = (PTS * 100ll) / 9ll;
int64_t timeUs = (PTS * 100LL) / 9LL;
if (mStartup && !mFirstPTSValid) {
mFirstPTSValid = true;
mFirstTimeUs = timeUs;
}
if (mSegmentFirstPTS < 0ll) {
if (mSegmentFirstPTS < 0LL) {
mSegmentFirstPTS = timeUs;
if (!mStartTimeUsRelative) {
// Duplicated logic from how we handle .ts playlists.
@ -2148,7 +2148,7 @@ status_t PlaylistFetcher::extractAndQueueAccessUnits(
CHECK_LE(offset + aac_frame_length, buffer->size());
int64_t unitTimeUs = timeUs + numSamples * 1000000ll / sampleRate;
int64_t unitTimeUs = timeUs + numSamples * 1000000LL / sampleRate;
offset += aac_frame_length;
// Each AAC frame encodes 1024 samples.
@ -2209,7 +2209,7 @@ status_t PlaylistFetcher::extractAndQueueAccessUnits(
}
void PlaylistFetcher::updateDuration() {
int64_t durationUs = 0ll;
int64_t durationUs = 0LL;
for (size_t index = 0; index < mPlaylist->size(); ++index) {
sp<AMessage> itemMeta;
CHECK(mPlaylist->itemAt(

@ -41,7 +41,7 @@ struct MemorySource : public DataSourceBase {
}
virtual ssize_t readAt(off64_t offset, void *data, size_t size) {
off64_t available = (offset >= (off64_t)mSize) ? 0ll : mSize - offset;
off64_t available = (offset >= (off64_t)mSize) ? 0LL : mSize - offset;
size_t copy = (available > (off64_t)size) ? size : available;
memcpy(data, mData + offset, copy);

@ -625,21 +625,21 @@ int64_t ATSParser::Program::recoverPTS(uint64_t PTS_33bit) {
// reasonable amount of time. To handle the wrap-around, use fancy math
// to get an extended PTS that is within [-0xffffffff, 0xffffffff]
// of the latest recovered PTS.
if (mLastRecoveredPTS < 0ll) {
if (mLastRecoveredPTS < 0LL) {
// Use the original 33bit number for 1st frame, the reason is that
// if 1st frame wraps to negative that's far away from 0, we could
// never start. Only start wrapping around from 2nd frame.
mLastRecoveredPTS = static_cast<int64_t>(PTS_33bit);
} else {
mLastRecoveredPTS = static_cast<int64_t>(
((mLastRecoveredPTS - static_cast<int64_t>(PTS_33bit) + 0x100000000ll)
((mLastRecoveredPTS - static_cast<int64_t>(PTS_33bit) + 0x100000000LL)
& 0xfffffffe00000000ull) | PTS_33bit);
// We start from 0, but recovered PTS could be slightly below 0.
// Clamp it to 0 as rest of the pipeline doesn't take negative pts.
// (eg. video is read first and starts at 0, but audio starts at 0xfffffff0)
if (mLastRecoveredPTS < 0ll) {
if (mLastRecoveredPTS < 0LL) {
ALOGI("Clamping negative recovered PTS (%" PRId64 ") to 0", mLastRecoveredPTS);
mLastRecoveredPTS = 0ll;
mLastRecoveredPTS = 0LL;
}
}
@ -689,7 +689,7 @@ int64_t ATSParser::Program::convertPTSToTimestamp(uint64_t PTS) {
int64_t timeUs = (PTS * 100) / 9;
if (mParser->mAbsoluteTimeAnchorUs >= 0ll) {
if (mParser->mAbsoluteTimeAnchorUs >= 0LL) {
timeUs += mParser->mAbsoluteTimeAnchorUs;
}
@ -1529,7 +1529,7 @@ void ATSParser::Stream::onPayloadData(
ALOGV("onPayloadData mStreamType=0x%02x size: %zu", mStreamType, size);
int64_t timeUs = 0ll; // no presentation timestamp available.
int64_t timeUs = 0LL; // no presentation timestamp available.
if (PTS_DTS_flags == 2 || PTS_DTS_flags == 3) {
timeUs = mProgram->convertPTSToTimestamp(PTS);
}
@ -1659,10 +1659,10 @@ void ATSParser::Stream::setCasInfo(
ATSParser::ATSParser(uint32_t flags)
: mFlags(flags),
mAbsoluteTimeAnchorUs(-1ll),
mAbsoluteTimeAnchorUs(-1LL),
mTimeOffsetValid(false),
mTimeOffsetUs(0ll),
mLastRecoveredPTS(-1ll),
mTimeOffsetUs(0LL),
mLastRecoveredPTS(-1LL),
mNumTSPacketsParsed(0),
mNumPCRs(0) {
mPSISections.add(0 /* PID */, new PSISection);
@ -1704,7 +1704,7 @@ void ATSParser::signalDiscontinuity(
if ((mFlags & TS_TIMESTAMPS_ARE_ABSOLUTE)
&& extra->findInt64(
kATSParserKeyRecentMediaTimeUs, &mediaTimeUs)) {
if (mAbsoluteTimeAnchorUs >= 0ll) {
if (mAbsoluteTimeAnchorUs >= 0LL) {
mediaTimeUs -= mAbsoluteTimeAnchorUs;
}
if (mTimeOffsetValid) {

@ -35,7 +35,7 @@
namespace android {
const int64_t kNearEOSMarkUs = 2000000ll; // 2 secs
const int64_t kNearEOSMarkUs = 2000000LL; // 2 secs
AnotherPacketSource::AnotherPacketSource(const sp<MetaData> &meta)
: mIsAudio(false),
@ -285,7 +285,7 @@ void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) {
if (buffer->meta()->findInt32("discontinuity", &discontinuity)){
ALOGV("queueing a discontinuity with queueAccessUnit");
mLastQueuedTimeUs = 0ll;
mLastQueuedTimeUs = 0LL;
mEOSResult = OK;
mLatestEnqueuedMeta = NULL;

@ -776,7 +776,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitPCMAudio() {
memcpy(accessUnit->data(), mBuffer->data() + 4, payloadSize);
int64_t timeUs = fetchTimestamp(payloadSize + 4);
if (timeUs < 0ll) {
if (timeUs < 0LL) {
ALOGE("Negative timeUs");
return NULL;
}
@ -812,7 +812,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitAAC() {
return NULL;
}
if (info.mTimestampUs < 0ll) {
if (info.mTimestampUs < 0LL) {
ALOGE("Negative info.mTimestampUs");
return NULL;
}
@ -996,7 +996,7 @@ int64_t ElementaryStreamQueue::fetchTimestamp(
}
if (timeUs == 0ll) {
if (timeUs == 0LL) {
ALOGV("Returning 0 timestamp");
}
@ -1160,7 +1160,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitH264() {
mBuffer->setRange(0, mBuffer->size() - nextScan);
int64_t timeUs = fetchTimestamp(nextScan);
if (timeUs < 0ll) {
if (timeUs < 0LL) {
ALOGE("Negative timeUs");
return NULL;
}
@ -1245,7 +1245,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitMPEGAudio() {
mBuffer->setRange(0, mBuffer->size() - frameSize);
int64_t timeUs = fetchTimestamp(frameSize);
if (timeUs < 0ll) {
if (timeUs < 0LL) {
ALOGE("Negative timeUs");
return NULL;
}
@ -1451,7 +1451,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitMPEGVideo() {
mBuffer->setRange(0, mBuffer->size() - offset);
int64_t timeUs = fetchTimestamp(offset);
if (timeUs < 0ll) {
if (timeUs < 0LL) {
ALOGE("Negative timeUs");
return NULL;
}
@ -1648,7 +1648,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitMPEG4Video() {
mBuffer->setRange(0, size);
int64_t timeUs = fetchTimestamp(offset);
if (timeUs < 0ll) {
if (timeUs < 0LL) {
ALOGE("Negative timeus");
return NULL;
}

@ -355,9 +355,9 @@ OMXNodeInstance::OMXNodeInstance(
mQuirks(0),
mBufferIDCount(0),
mRestorePtsFailed(false),
mMaxTimestampGapUs(0ll),
mPrevOriginalTimeUs(-1ll),
mPrevModifiedTimeUs(-1ll)
mMaxTimestampGapUs(0LL),
mPrevOriginalTimeUs(-1LL),
mPrevModifiedTimeUs(-1LL)
{
mName = ADebug::GetDebugName(name);
DEBUG = ADebug::GetDebugLevelFromProperty(name, "debug.stagefright.omx-debug");
@ -1948,7 +1948,7 @@ status_t OMXNodeInstance::setMaxPtsGapUs(const void *params, size_t size) {
int64_t OMXNodeInstance::getCodecTimestamp(OMX_TICKS timestamp) {
int64_t originalTimeUs = timestamp;
if (mMaxTimestampGapUs > 0ll) {
if (mMaxTimestampGapUs > 0LL) {
/* Cap timestamp gap between adjacent frames to specified max
*
* In the scenario of cast mirroring, encoding could be suspended for
@ -1956,7 +1956,7 @@ int64_t OMXNodeInstance::getCodecTimestamp(OMX_TICKS timestamp) {
* where encoder's rate control logic produces huge frames after a
* long period of suspension.
*/
if (mPrevOriginalTimeUs >= 0ll) {
if (mPrevOriginalTimeUs >= 0LL) {
int64_t timestampGapUs = originalTimeUs - mPrevOriginalTimeUs;
timestamp = (timestampGapUs < mMaxTimestampGapUs ?
timestampGapUs : mMaxTimestampGapUs) + mPrevModifiedTimeUs;
@ -1964,7 +1964,7 @@ int64_t OMXNodeInstance::getCodecTimestamp(OMX_TICKS timestamp) {
ALOGV("IN timestamp: %lld -> %lld",
static_cast<long long>(originalTimeUs),
static_cast<long long>(timestamp));
} else if (mMaxTimestampGapUs < 0ll) {
} else if (mMaxTimestampGapUs < 0LL) {
/*
* Apply a fixed timestamp gap between adjacent frames.
*
@ -1972,7 +1972,7 @@ int64_t OMXNodeInstance::getCodecTimestamp(OMX_TICKS timestamp) {
* on frames could go forward or backward. Some encoders may silently
* drop frames when it goes backward (or even stay unchanged).
*/
if (mPrevOriginalTimeUs >= 0ll) {
if (mPrevOriginalTimeUs >= 0LL) {
timestamp = mPrevModifiedTimeUs - mMaxTimestampGapUs;
}
ALOGV("IN timestamp: %lld -> %lld",
@ -1983,7 +1983,7 @@ int64_t OMXNodeInstance::getCodecTimestamp(OMX_TICKS timestamp) {
mPrevOriginalTimeUs = originalTimeUs;
mPrevModifiedTimeUs = timestamp;
if (mMaxTimestampGapUs != 0ll && !mRestorePtsFailed) {
if (mMaxTimestampGapUs != 0LL && !mRestorePtsFailed) {
mOriginalTimeUs.add(timestamp, originalTimeUs);
}
@ -2016,7 +2016,7 @@ status_t OMXNodeInstance::emptyNativeHandleBuffer_l(
void OMXNodeInstance::codecBufferFilled(omx_message &msg) {
Mutex::Autolock autoLock(mLock);
if (mMaxTimestampGapUs == 0ll || mRestorePtsFailed) {
if (mMaxTimestampGapUs == 0LL || mRestorePtsFailed) {
return;
}

@ -417,7 +417,7 @@ APacketSource::APacketSource(
if (sessionDesc->getDurationUs(&durationUs)) {
mFormat->setInt64(kKeyDuration, durationUs);
} else {
mFormat->setInt64(kKeyDuration, -1ll);
mFormat->setInt64(kKeyDuration, -1LL);
}
mInitCheck = OK;

@ -36,7 +36,7 @@ void ARTPAssembler::onPacketReceived(const sp<ARTPSource> &source) {
if (status == WRONG_SEQUENCE_NUMBER) {
if (mFirstFailureTimeUs >= 0) {
if (ALooper::GetNowUs() - mFirstFailureTimeUs > 10000ll) {
if (ALooper::GetNowUs() - mFirstFailureTimeUs > 10000LL) {
mFirstFailureTimeUs = -1;
// LOG(VERBOSE) << "waited too long for packet.";

@ -50,7 +50,7 @@ static uint64_t u64at(const uint8_t *data) {
}
// static
const int64_t ARTPConnection::kSelectTimeoutUs = 1000ll;
const int64_t ARTPConnection::kSelectTimeoutUs = 1000LL;
struct ARTPConnection::StreamInfo {
int mRTPSocket;
@ -118,7 +118,7 @@ void ARTPConnection::MakePortPair(
bumpSocketBufferSize(*rtcpSocket);
/* rand() * 1000 may overflow int type, use long long */
unsigned start = (unsigned)((rand()* 1000ll)/RAND_MAX) + 15550;
unsigned start = (unsigned)((rand()* 1000LL)/RAND_MAX) + 15550;
start &= ~1;
for (unsigned port = start; port < 65536; port += 2) {
@ -307,7 +307,7 @@ void ARTPConnection::onPollStreams() {
int64_t nowUs = ALooper::GetNowUs();
if (mLastReceiverReportTimeUs <= 0
|| mLastReceiverReportTimeUs + 5000000ll <= nowUs) {
|| mLastReceiverReportTimeUs + 5000000LL <= nowUs) {
sp<ABuffer> buffer = new ABuffer(kMaxUDPSize);
List<StreamInfo>::iterator it = mStreams.begin();
while (it != mStreams.end()) {

@ -180,7 +180,7 @@ void ARTPSource::addFIR(const sp<ABuffer> &buffer) {
}
int64_t nowUs = ALooper::GetNowUs();
if (mLastFIRRequestUs >= 0 && mLastFIRRequestUs + 5000000ll > nowUs) {
if (mLastFIRRequestUs >= 0 && mLastFIRRequestUs + 5000000LL > nowUs) {
// Send FIR requests at most every 5 secs.
return;
}

@ -420,10 +420,10 @@ void ARTPWriter::addSDES(const sp<ABuffer> &buffer) {
uint64_t ARTPWriter::GetNowNTP() {
uint64_t nowUs = ALooper::GetNowUs();
nowUs += ((70ll * 365 + 17) * 24) * 60 * 60 * 1000000ll;
nowUs += ((70LL * 365 + 17) * 24) * 60 * 60 * 1000000LL;
uint64_t hi = nowUs / 1000000ll;
uint64_t lo = ((1ll << 32) * (nowUs % 1000000ll)) / 1000000ll;
uint64_t hi = nowUs / 1000000LL;
uint64_t lo = ((1LL << 32) * (nowUs % 1000000LL)) / 1000000LL;
return (hi << 32) | lo;
}
@ -576,7 +576,7 @@ void ARTPWriter::sendAVCData(MediaBufferBase *mediaBuf) {
int64_t timeUs;
CHECK(mediaBuf->meta_data().findInt64(kKeyTime, &timeUs));
uint32_t rtpTime = mRTPTimeBase + (timeUs * 9 / 100ll);
uint32_t rtpTime = mRTPTimeBase + (timeUs * 9 / 100LL);
const uint8_t *mediaData =
(const uint8_t *)mediaBuf->data() + mediaBuf->range_offset();
@ -671,7 +671,7 @@ void ARTPWriter::sendH263Data(MediaBufferBase *mediaBuf) {
int64_t timeUs;
CHECK(mediaBuf->meta_data().findInt64(kKeyTime, &timeUs));
uint32_t rtpTime = mRTPTimeBase + (timeUs * 9 / 100ll);
uint32_t rtpTime = mRTPTimeBase + (timeUs * 9 / 100LL);
const uint8_t *mediaData =
(const uint8_t *)mediaBuf->data() + mediaBuf->range_offset();

@ -38,7 +38,7 @@
namespace android {
// static
const int64_t ARTSPConnection::kSelectTimeoutUs = 1000ll;
const int64_t ARTSPConnection::kSelectTimeoutUs = 1000LL;
// static
const AString ARTSPConnection::sUserAgent =

@ -364,14 +364,14 @@ void WebmFrameMediaSourceThread::run() {
// adjust time-stamps after pause/resume
if (mResumed) {
int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs;
CHECK_GE(durExcludingEarlierPausesUs, 0ll);
CHECK_GE(durExcludingEarlierPausesUs, 0LL);
int64_t pausedDurationUs = durExcludingEarlierPausesUs - mTrackDurationUs;
CHECK_GE(pausedDurationUs, lastDurationUs);
previousPausedDurationUs += pausedDurationUs - lastDurationUs;
mResumed = false;
}
timestampUs -= previousPausedDurationUs;
CHECK_GE(timestampUs, 0ll);
CHECK_GE(timestampUs, 0LL);
int32_t isSync = false;
md.findInt32(kKeyIsSyncFrame, &isSync);

Loading…
Cancel
Save