diff options
4 files changed, 6 insertions, 5 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index acff958..e600a3f 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -535,8 +535,8 @@ void MediaPlayerService::Client::disconnect() { Mutex::Autolock l(mLock); p = mPlayer; + mClient.clear(); } - mClient.clear(); mPlayer.clear(); diff --git a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp index 8bc0275..e02af90 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp +++ b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp @@ -748,10 +748,10 @@ void SoftMPEG4Encoder::onQueueFilled(OMX_U32 portIndex) { outQueue.erase(outQueue.begin()); CHECK(!mInputBufferInfoVec.empty()); InputBufferInfo *inputBufInfo = mInputBufferInfoVec.begin(); - mInputBufferInfoVec.erase(mInputBufferInfoVec.begin()); outHeader->nTimeStamp = inputBufInfo->mTimeUs; outHeader->nFlags |= (inputBufInfo->mFlags | OMX_BUFFERFLAG_ENDOFFRAME); outHeader->nFilledLen = dataLength; + mInputBufferInfoVec.erase(mInputBufferInfoVec.begin()); outInfo->mOwnedByUs = false; notifyFillBufferDone(outHeader); } diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp index 501a970..af369b5 100644 --- a/media/libstagefright/rtsp/ARTPConnection.cpp +++ b/media/libstagefright/rtsp/ARTPConnection.cpp @@ -117,7 +117,8 @@ void ARTPConnection::MakePortPair( bumpSocketBufferSize(*rtcpSocket); - unsigned start = (rand() * 1000)/ RAND_MAX + 15550; + /* rand() * 1000 may overflow int type, use long long */ + unsigned start = (unsigned)((rand()* 1000ll)/RAND_MAX) + 15550; start &= ~1; for (unsigned port = start; port < 65536; port += 2) { diff --git a/services/audioflinger/test-resample.cpp b/services/audioflinger/test-resample.cpp index b082e8c..7a314cf 100644 --- a/services/audioflinger/test-resample.cpp +++ b/services/audioflinger/test-resample.cpp @@ -219,12 +219,12 @@ int main(int argc, char* argv[]) { memset(output_vaddr, 0, output_size); timespec start, end; - clock_gettime(CLOCK_MONOTONIC_HR, &start); + clock_gettime(CLOCK_MONOTONIC, &start); resampler->resample((int*) output_vaddr, out_frames, &provider); resampler->resample((int*) output_vaddr, out_frames, &provider); resampler->resample((int*) output_vaddr, out_frames, &provider); resampler->resample((int*) output_vaddr, out_frames, &provider); - clock_gettime(CLOCK_MONOTONIC_HR, &end); + clock_gettime(CLOCK_MONOTONIC, &end); int64_t start_ns = start.tv_sec * 1000000000LL + start.tv_nsec; int64_t end_ns = end.tv_sec * 1000000000LL + end.tv_nsec; int64_t time = (end_ns - start_ns)/4; |