diff options
author | Lajos Molnar <lajos@google.com> | 2018-11-15 12:49:20 -0800 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2019-01-16 16:46:50 -0800 |
commit | d2a7f47b0d39fa9df967c9a2fba3856843f13ad6 (patch) | |
tree | f5e5fc5a7257e706bb83342de5b1b36e495fa367 /media/java/android/media/MediaCodec.java | |
parent | 104e03ed47af2f1ad24bdc6b4a1549a80a9e196f (diff) |
MediaCodecInfo: add codec attributes and performance points.
Bug: 112374531
Bug: 119631295
Bug: 112370870
Change-Id: Icf8db614a616bd5c815bc272093ce77d05eb4406
Diffstat (limited to 'media/java/android/media/MediaCodec.java')
-rw-r--r-- | media/java/android/media/MediaCodec.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index bc9500ddb3b7..f756658b4fa8 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -1829,9 +1829,14 @@ final public class MediaCodec { mBufferLock = new Object(); + // save name used at creation + mNameAtCreation = nameIsType ? null : name; + native_setup(name, nameIsType, encoder); } + private String mNameAtCreation; + @Override protected void finalize() { native_finalize(); @@ -3317,12 +3322,36 @@ final public class MediaCodec { private native void native_setAudioPresentation(int presentationId, int programId); /** - * Get the component name. If the codec was created by createDecoderByType - * or createEncoderByType, what component is chosen is not known beforehand. + * Retrieve the codec name. + * + * If the codec was created by createDecoderByType or createEncoderByType, what component is + * chosen is not known beforehand. This method returns the name of the codec that was + * selected by the platform. + * + * <strong>Note:</strong> Implementations may provide multiple aliases (codec + * names) for the same underlying codec, any of which can be used to instantiate the same + * underlying codec in {@link MediaCodec#createByCodecName}. This method returns the + * name used to create the codec in this case. + * + * @throws IllegalStateException if in the Released state. + */ + @NonNull + public final String getName() { + // get canonical name to handle exception + String canonicalName = getCanonicalName(); + return mNameAtCreation != null ? mNameAtCreation : canonicalName; + } + + /** + * Retrieve the underlying codec name. + * + * This method is similar to {@link #getName}, except that it returns the underlying component + * name even if an alias was used to create this MediaCodec object by name, + * * @throws IllegalStateException if in the Released state. */ @NonNull - public native final String getName(); + public native final String getCanonicalName(); /** * Return Metrics data about the current codec instance. |