Merge "media: avoid NPE in CodecCapabilities.createFromProfileLevel" into nyc-dev
am: 9061b26f1e
* commit '9061b26f1ecba936f6f912398a9238c21dfa789c':
media: avoid NPE in CodecCapabilities.createFromProfileLevel
Change-Id: I04a42c8f40c8802eeba3ca9e2acc9ef87d4be403
This commit is contained in:
@@ -750,6 +750,9 @@ public final class MediaCodecInfo {
|
|||||||
* Retrieve the codec capabilities for a certain {@code mime type}, {@code
|
* Retrieve the codec capabilities for a certain {@code mime type}, {@code
|
||||||
* profile} and {@code level}. If the type, or profile-level combination
|
* profile} and {@code level}. If the type, or profile-level combination
|
||||||
* is not understood by the framework, it returns null.
|
* is not understood by the framework, it returns null.
|
||||||
|
* <p class=note> In {@link android.os.Build.VERSION_CODES#M}, calling this
|
||||||
|
* method without calling any method of the {@link MediaCodecList} class beforehand
|
||||||
|
* results in a {@link NullPointerException}.</p>
|
||||||
*/
|
*/
|
||||||
public static CodecCapabilities createFromProfileLevel(
|
public static CodecCapabilities createFromProfileLevel(
|
||||||
String mime, int profile, int level) {
|
String mime, int profile, int level) {
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ final public class MediaCodecList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* package private */ static final Map<String, Object> getGlobalSettings() {
|
/* package private */ static final Map<String, Object> getGlobalSettings() {
|
||||||
|
synchronized (sInitLock) {
|
||||||
|
if (sGlobalSettings == null) {
|
||||||
|
sGlobalSettings = native_getGlobalSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
return sGlobalSettings;
|
return sGlobalSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +79,6 @@ final public class MediaCodecList {
|
|||||||
private static final void initCodecList() {
|
private static final void initCodecList() {
|
||||||
synchronized (sInitLock) {
|
synchronized (sInitLock) {
|
||||||
if (sRegularCodecInfos == null) {
|
if (sRegularCodecInfos == null) {
|
||||||
sGlobalSettings = native_getGlobalSettings();
|
|
||||||
int count = native_getCodecCount();
|
int count = native_getCodecCount();
|
||||||
ArrayList<MediaCodecInfo> regulars = new ArrayList<MediaCodecInfo>();
|
ArrayList<MediaCodecInfo> regulars = new ArrayList<MediaCodecInfo>();
|
||||||
ArrayList<MediaCodecInfo> all = new ArrayList<MediaCodecInfo>();
|
ArrayList<MediaCodecInfo> all = new ArrayList<MediaCodecInfo>();
|
||||||
|
|||||||
Reference in New Issue
Block a user