media: retain codec name for MediaCodec.getCodecInfo

Bug: 123962331
Change-Id: I4d349d673fcb62888681c96e7df325fa9e4b3b37
This commit is contained in:
Lajos Molnar
2019-02-05 18:54:27 -08:00
parent dd6125c0d2
commit e7473877d5
2 changed files with 6 additions and 2 deletions

View File

@@ -153,8 +153,12 @@ JMediaCodec::JMediaCodec(
if (nameIsType) {
mCodec = MediaCodec::CreateByType(mLooper, name, encoder, &mInitStatus);
if (mCodec == nullptr || mCodec->getName(&mNameAtCreation) != OK) {
mNameAtCreation = "(null)";
}
} else {
mCodec = MediaCodec::CreateByComponentName(mLooper, name, &mInitStatus);
mNameAtCreation = name;
}
CHECK((mCodec != NULL) != (mInitStatus != OK));
}
@@ -699,9 +703,8 @@ status_t JMediaCodec::getCodecInfo(JNIEnv *env, jobject *codecInfoObject) const
return err;
}
// TODO: get alias
ScopedLocalRef<jstring> nameObject(env,
env->NewStringUTF(codecInfo->getCodecName()));
env->NewStringUTF(mNameAtCreation.c_str()));
ScopedLocalRef<jstring> canonicalNameObject(env,
env->NewStringUTF(codecInfo->getCodecName()));

View File

@@ -155,6 +155,7 @@ private:
sp<ALooper> mLooper;
sp<MediaCodec> mCodec;
AString mNameAtCreation;
sp<AMessage> mCallbackNotification;
sp<AMessage> mOnFrameRenderedNotification;