media: retain codec name for MediaCodec.getCodecInfo
Bug: 123962331 Change-Id: I4d349d673fcb62888681c96e7df325fa9e4b3b37
This commit is contained in:
@@ -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()));
|
||||
|
||||
@@ -155,6 +155,7 @@ private:
|
||||
|
||||
sp<ALooper> mLooper;
|
||||
sp<MediaCodec> mCodec;
|
||||
AString mNameAtCreation;
|
||||
|
||||
sp<AMessage> mCallbackNotification;
|
||||
sp<AMessage> mOnFrameRenderedNotification;
|
||||
|
||||
Reference in New Issue
Block a user