summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/mediaplayer.cpp2
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.cpp4
-rw-r--r--media/libmediaplayerservice/nuplayer/RTSPSource.cpp4
-rw-r--r--media/libstagefright/AwesomePlayer.cpp2
-rw-r--r--media/libstagefright/MetaData.cpp1
-rw-r--r--media/libstagefright/chromium_http/support.cpp2
-rw-r--r--media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp2
-rw-r--r--media/libstagefright/rtsp/AAVCAssembler.cpp7
-rw-r--r--media/libstagefright/rtsp/ARTPConnection.cpp3
-rw-r--r--media/libstagefright/rtsp/ARTSPConnection.cpp3
-rw-r--r--media/libstagefright/rtsp/MyHandler.h13
11 files changed, 35 insertions, 8 deletions
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index 68cbdf5..963b04f 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -124,7 +124,7 @@ status_t MediaPlayer::attachNewPlayer(const sp<IMediaPlayer>& player)
mCurrentState = MEDIA_PLAYER_INITIALIZED;
err = NO_ERROR;
} else {
- ALOGE("Unable to to create media player");
+ ALOGE("Unable to create media player");
}
}
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index acff958..57ec7ea 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -321,7 +321,7 @@ status_t MediaPlayerService::AudioCache::dump(int fd, const Vector<String16>& ar
mHeap->getBase(), mHeap->getSize(), mHeap->getFlags(), mHeap->getDevice());
result.append(buffer);
}
- snprintf(buffer, 255, " msec per frame(%f), channel count(%d), format(%d), frame count(%ld)\n",
+ snprintf(buffer, 255, " msec per frame(%f), channel count(%d), format(%d), frame count(%zd)\n",
mMsecsPerFrame, mChannelCount, mFormat, mFrameCount);
result.append(buffer);
snprintf(buffer, 255, " sample rate(%d), size(%d), error(%d), command complete(%s)\n",
@@ -535,8 +535,8 @@ void MediaPlayerService::Client::disconnect()
{
Mutex::Autolock l(mLock);
p = mPlayer;
+ mClient.clear();
}
- mClient.clear();
mPlayer.clear();
diff --git a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
index 50ebf9c..3385a19 100644
--- a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
@@ -634,6 +634,10 @@ void NuPlayer::RTSPSource::onSDPLoaded(const sp<AMessage> &msg) {
}
void NuPlayer::RTSPSource::onDisconnected(const sp<AMessage> &msg) {
+ if (mState == DISCONNECTED) {
+ return;
+ }
+
status_t err;
CHECK(msg->findInt32("result", &err));
CHECK_NE(err, (status_t)OK);
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index f12f4d4..eecfb80 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -617,7 +617,7 @@ bool AwesomePlayer::getBitrate(int64_t *bitrate) {
bool AwesomePlayer::getCachedDuration_l(int64_t *durationUs, bool *eos) {
int64_t bitrate;
- if (mCachedSource != NULL && getBitrate(&bitrate)) {
+ if (mCachedSource != NULL && getBitrate(&bitrate) && (bitrate > 0)) {
status_t finalStatus;
size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
*durationUs = cachedDataRemaining * 8000000ll / bitrate;
diff --git a/media/libstagefright/MetaData.cpp b/media/libstagefright/MetaData.cpp
index a01ec97..ae6ae2d 100644
--- a/media/libstagefright/MetaData.cpp
+++ b/media/libstagefright/MetaData.cpp
@@ -282,6 +282,7 @@ void MetaData::typed_data::freeStorage() {
if (!usesReservoir()) {
if (u.ext_data) {
free(u.ext_data);
+ u.ext_data = NULL;
}
}
diff --git a/media/libstagefright/chromium_http/support.cpp b/media/libstagefright/chromium_http/support.cpp
index 741cb1d..0a8e3e3 100644
--- a/media/libstagefright/chromium_http/support.cpp
+++ b/media/libstagefright/chromium_http/support.cpp
@@ -150,7 +150,7 @@ uint32 SfNetLog::NextID() {
}
net::NetLog::LogLevel SfNetLog::GetLogLevel() const {
- return LOG_ALL;
+ return LOG_BASIC;
}
////////////////////////////////////////////////////////////////////////////////
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/AAVCAssembler.cpp b/media/libstagefright/rtsp/AAVCAssembler.cpp
index 7ea132e..a6825eb 100644
--- a/media/libstagefright/rtsp/AAVCAssembler.cpp
+++ b/media/libstagefright/rtsp/AAVCAssembler.cpp
@@ -106,6 +106,13 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit(
++mNextExpectedSeqNo;
return success ? OK : MALFORMED_PACKET;
+ } else if (nalType == 0) {
+ ALOGV("Ignoring undefined nal type.");
+
+ queue->erase(queue->begin());
+ ++mNextExpectedSeqNo;
+
+ return OK;
} else {
ALOGV("Ignoring unsupported buffer (nalType=%d)", nalType);
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/media/libstagefright/rtsp/ARTSPConnection.cpp b/media/libstagefright/rtsp/ARTSPConnection.cpp
index 3068541..8b209c4 100644
--- a/media/libstagefright/rtsp/ARTSPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTSPConnection.cpp
@@ -565,6 +565,9 @@ bool ARTSPConnection::receiveLine(AString *line) {
if (sawCR && c == '\n') {
line->erase(line->size() - 1, 1);
return true;
+ } else if (c == '\n') {
+ // some reponse line ended with '\n', instead of '\r\n'.
+ return true;
}
line->append(&c, 1);
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index e067e20..e51d9e3 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -127,7 +127,8 @@ struct MyHandler : public AHandler {
mKeepAliveTimeoutUs(kDefaultKeepAliveTimeoutUs),
mKeepAliveGeneration(0),
mPausing(false),
- mPauseGeneration(0) {
+ mPauseGeneration(0),
+ mPlayResponseParsed(false) {
mNetLooper->setName("rtsp net");
mNetLooper->start(false /* runOnCallingThread */,
false /* canCallJava */,
@@ -1371,6 +1372,7 @@ struct MyHandler : public AHandler {
}
void parsePlayResponse(const sp<ARTSPResponse> &response) {
+ mPlayResponseParsed = true;
if (mTracks.size() == 0) {
ALOGV("parsePlayResponse: late packets ignored.");
return;
@@ -1524,6 +1526,8 @@ private:
Vector<TrackInfo> mTracks;
+ bool mPlayResponseParsed;
+
void setupTrack(size_t index) {
sp<APacketSource> source =
new APacketSource(mSessionDesc, index);
@@ -1728,6 +1732,13 @@ private:
int32_t trackIndex, const sp<ABuffer> &accessUnit) {
ALOGV("onAccessUnitComplete track %d", trackIndex);
+ if(!mPlayResponseParsed){
+ ALOGI("play response is not parsed, storing accessunit");
+ TrackInfo *track = &mTracks.editItemAt(trackIndex);
+ track->mPackets.push_back(accessUnit);
+ return;
+ }
+
if (mFirstAccessUnit) {
sp<AMessage> msg = mNotify->dup();
msg->setInt32("what", kWhatConnected);