diff options
-rw-r--r-- | media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp | 11 | ||||
-rw-r--r-- | media/libstagefright/ACodec.cpp | 11 | ||||
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 3 |
3 files changed, 20 insertions, 5 deletions
diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp index d8b35d7..f1782cc 100644 --- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp +++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp @@ -201,7 +201,16 @@ void NuPlayer::HTTPLiveSource::onSessionNotify(const sp<AMessage> &msg) { switch (what) { case LiveSession::kWhatPrepared: { - notifyVideoSizeChanged(0, 0); + // notify the current size here if we have it, otherwise report an initial size of (0,0) + sp<AMessage> format = getFormat(false /* audio */); + int32_t width; + int32_t height; + if (format != NULL && + format->findInt32("width", &width) && format->findInt32("height", &height)) { + notifyVideoSizeChanged(width, height); + } else { + notifyVideoSizeChanged(0, 0); + } uint32_t flags = FLAG_CAN_PAUSE; if (mLiveSession->isSeekable()) { diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 1adab38..92a5361 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -3072,11 +3072,16 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { /* these are unfilled buffers returned by client */ CHECK(msg->findInt32("err", &err)); - ALOGV("[%s] saw error %d instead of an input buffer", - mCodec->mComponentName.c_str(), err); + if (err == OK) { + /* buffers with no errors are returned on MediaCodec.flush */ + mode = KEEP_BUFFERS; + } else { + ALOGV("[%s] saw error %d instead of an input buffer", + mCodec->mComponentName.c_str(), err); + eos = true; + } buffer.clear(); - mode = KEEP_BUFFERS; } int32_t tmp; diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index e0686be..c36dd7c 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -1500,7 +1500,8 @@ void MediaCodec::returnBuffersToCodecOnPort(int32_t portIndex) { info->mOwnedByClient = false; if (portIndex == kPortIndexInput) { - msg->setInt32("err", ERROR_END_OF_STREAM); + /* no error, just returning buffers */ + msg->setInt32("err", OK); } msg->post(); } |