Loading include/media/MediaResource.h +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ namespace android { extern const char kResourceSecureCodec[]; extern const char kResourceNonSecureCodec[]; extern const char kResourceAudioCodec[]; extern const char kResourceVideoCodec[]; extern const char kResourceGraphicMemory[]; class MediaResource { Loading include/media/stagefright/MediaCodec.h +1 −1 Original line number Diff line number Diff line Loading @@ -351,7 +351,7 @@ private: bool isExecuting() const; uint64_t getGraphicBufferSize(); void addResource(const char *type, uint64_t value); void addResource(const String8 &type, const String8 &subtype, uint64_t value); /* called to get the last codec error when the sticky flag is set. * if no such codec error is found, returns UNKNOWN_ERROR. Loading media/libmedia/MediaResource.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ namespace android { const char kResourceSecureCodec[] = "secure-codec"; const char kResourceNonSecureCodec[] = "non-secure-codec"; const char kResourceAudioCodec[] = "audio-codec"; const char kResourceVideoCodec[] = "video-codec"; const char kResourceGraphicMemory[] = "graphic-memory"; MediaResource::MediaResource() : mValue(0) {} Loading media/libstagefright/MediaCodec.cpp +16 −7 Original line number Diff line number Diff line Loading @@ -434,7 +434,8 @@ status_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) { status_t err; Vector<MediaResource> resources; const char *type = secureCodec ? kResourceSecureCodec : kResourceNonSecureCodec; resources.push_back(MediaResource(String8(type), 1)); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; resources.push_back(MediaResource(String8(type), String8(subtype), 1)); for (int i = 0; i <= kMaxRetry; ++i) { if (i > 0) { // Don't try to reclaim resource for the first time. Loading Loading @@ -492,7 +493,8 @@ status_t MediaCodec::configure( Vector<MediaResource> resources; const char *type = (mFlags & kFlagIsSecure) ? kResourceSecureCodec : kResourceNonSecureCodec; resources.push_back(MediaResource(String8(type), 1)); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; resources.push_back(MediaResource(String8(type), String8(subtype), 1)); // Don't know the buffer size at this point, but it's fine to use 1 because // the reclaimResource call doesn't consider the requester's buffer size for now. resources.push_back(MediaResource(String8(kResourceGraphicMemory), 1)); Loading Loading @@ -557,9 +559,9 @@ uint64_t MediaCodec::getGraphicBufferSize() { return size; } void MediaCodec::addResource(const char *type, uint64_t value) { void MediaCodec::addResource(const String8 &type, const String8 &subtype, uint64_t value) { Vector<MediaResource> resources; resources.push_back(MediaResource(String8(type), value)); resources.push_back(MediaResource(type, subtype, value)); mResourceManagerService->addResource( getCallingPid(), getId(mResourceManagerClient), mResourceManagerClient, resources); } Loading @@ -571,7 +573,8 @@ status_t MediaCodec::start() { Vector<MediaResource> resources; const char *type = (mFlags & kFlagIsSecure) ? kResourceSecureCodec : kResourceNonSecureCodec; resources.push_back(MediaResource(String8(type), 1)); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; resources.push_back(MediaResource(String8(type), String8(subtype), 1)); // Don't know the buffer size at this point, but it's fine to use 1 because // the reclaimResource call doesn't consider the requester's buffer size for now. resources.push_back(MediaResource(String8(kResourceGraphicMemory), 1)); Loading Loading @@ -1183,7 +1186,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { mFlags &= ~kFlagIsSecure; resourceType = String8(kResourceNonSecureCodec); } addResource(resourceType, 1); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; addResource(resourceType, String8(subtype), 1); (new AMessage)->postReply(mReplyID); break; Loading Loading @@ -1297,7 +1302,11 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // allocating input buffers, so this is a good // indication that now all buffers are allocated. if (mIsVideo) { addResource(kResourceGraphicMemory, getGraphicBufferSize()); String8 subtype; addResource( String8(kResourceGraphicMemory), subtype, getGraphicBufferSize()); } setState(STARTED); (new AMessage)->postReply(mReplyID); Loading Loading
include/media/MediaResource.h +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ namespace android { extern const char kResourceSecureCodec[]; extern const char kResourceNonSecureCodec[]; extern const char kResourceAudioCodec[]; extern const char kResourceVideoCodec[]; extern const char kResourceGraphicMemory[]; class MediaResource { Loading
include/media/stagefright/MediaCodec.h +1 −1 Original line number Diff line number Diff line Loading @@ -351,7 +351,7 @@ private: bool isExecuting() const; uint64_t getGraphicBufferSize(); void addResource(const char *type, uint64_t value); void addResource(const String8 &type, const String8 &subtype, uint64_t value); /* called to get the last codec error when the sticky flag is set. * if no such codec error is found, returns UNKNOWN_ERROR. Loading
media/libmedia/MediaResource.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ namespace android { const char kResourceSecureCodec[] = "secure-codec"; const char kResourceNonSecureCodec[] = "non-secure-codec"; const char kResourceAudioCodec[] = "audio-codec"; const char kResourceVideoCodec[] = "video-codec"; const char kResourceGraphicMemory[] = "graphic-memory"; MediaResource::MediaResource() : mValue(0) {} Loading
media/libstagefright/MediaCodec.cpp +16 −7 Original line number Diff line number Diff line Loading @@ -434,7 +434,8 @@ status_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) { status_t err; Vector<MediaResource> resources; const char *type = secureCodec ? kResourceSecureCodec : kResourceNonSecureCodec; resources.push_back(MediaResource(String8(type), 1)); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; resources.push_back(MediaResource(String8(type), String8(subtype), 1)); for (int i = 0; i <= kMaxRetry; ++i) { if (i > 0) { // Don't try to reclaim resource for the first time. Loading Loading @@ -492,7 +493,8 @@ status_t MediaCodec::configure( Vector<MediaResource> resources; const char *type = (mFlags & kFlagIsSecure) ? kResourceSecureCodec : kResourceNonSecureCodec; resources.push_back(MediaResource(String8(type), 1)); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; resources.push_back(MediaResource(String8(type), String8(subtype), 1)); // Don't know the buffer size at this point, but it's fine to use 1 because // the reclaimResource call doesn't consider the requester's buffer size for now. resources.push_back(MediaResource(String8(kResourceGraphicMemory), 1)); Loading Loading @@ -557,9 +559,9 @@ uint64_t MediaCodec::getGraphicBufferSize() { return size; } void MediaCodec::addResource(const char *type, uint64_t value) { void MediaCodec::addResource(const String8 &type, const String8 &subtype, uint64_t value) { Vector<MediaResource> resources; resources.push_back(MediaResource(String8(type), value)); resources.push_back(MediaResource(type, subtype, value)); mResourceManagerService->addResource( getCallingPid(), getId(mResourceManagerClient), mResourceManagerClient, resources); } Loading @@ -571,7 +573,8 @@ status_t MediaCodec::start() { Vector<MediaResource> resources; const char *type = (mFlags & kFlagIsSecure) ? kResourceSecureCodec : kResourceNonSecureCodec; resources.push_back(MediaResource(String8(type), 1)); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; resources.push_back(MediaResource(String8(type), String8(subtype), 1)); // Don't know the buffer size at this point, but it's fine to use 1 because // the reclaimResource call doesn't consider the requester's buffer size for now. resources.push_back(MediaResource(String8(kResourceGraphicMemory), 1)); Loading Loading @@ -1183,7 +1186,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { mFlags &= ~kFlagIsSecure; resourceType = String8(kResourceNonSecureCodec); } addResource(resourceType, 1); const char *subtype = mIsVideo ? kResourceVideoCodec : kResourceAudioCodec; addResource(resourceType, String8(subtype), 1); (new AMessage)->postReply(mReplyID); break; Loading Loading @@ -1297,7 +1302,11 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // allocating input buffers, so this is a good // indication that now all buffers are allocated. if (mIsVideo) { addResource(kResourceGraphicMemory, getGraphicBufferSize()); String8 subtype; addResource( String8(kResourceGraphicMemory), subtype, getGraphicBufferSize()); } setState(STARTED); (new AMessage)->postReply(mReplyID); Loading