mirror of
https://github.com/samsonjs/media.git
synced 2026-03-28 09:55:48 +00:00
Log warnings when extension libraries can't be used
Issue: #5788 PiperOrigin-RevId: 245440858
This commit is contained in:
parent
b55e17588b
commit
f62fa434dd
3 changed files with 23 additions and 2 deletions
|
|
@ -115,6 +115,11 @@
|
|||
order when in shuffle mode.
|
||||
* Allow handling of custom commands via `registerCustomCommandReceiver`.
|
||||
* Add ability to include an extras `Bundle` when reporting a custom error.
|
||||
* LoadControl: Set minimum buffer for playbacks with video equal to maximum
|
||||
buffer ([#2083](https://github.com/google/ExoPlayer/issues/2083)).
|
||||
* Log warnings when extension native libraries can't be used, to help with
|
||||
diagnosing playback failures
|
||||
([#5788](https://github.com/google/ExoPlayer/issues/5788)).
|
||||
|
||||
### 2.9.6 ###
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
|
|||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||
import com.google.android.exoplayer2.util.LibraryLoader;
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +31,8 @@ public final class FfmpegLibrary {
|
|||
ExoPlayerLibraryInfo.registerModule("goog.exo.ffmpeg");
|
||||
}
|
||||
|
||||
private static final String TAG = "FfmpegLibrary";
|
||||
|
||||
private static final LibraryLoader LOADER =
|
||||
new LibraryLoader("avutil", "avresample", "avcodec", "ffmpeg");
|
||||
|
||||
|
|
@ -69,7 +72,14 @@ public final class FfmpegLibrary {
|
|||
return false;
|
||||
}
|
||||
String codecName = getCodecName(mimeType, encoding);
|
||||
return codecName != null && ffmpegHasDecoder(codecName);
|
||||
if (codecName == null) {
|
||||
return false;
|
||||
}
|
||||
if (!ffmpegHasDecoder(codecName)) {
|
||||
Log.w(TAG, "No " + codecName + " decoder available. Check the FFmpeg build configuration.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,11 +15,15 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Configurable loader for native libraries.
|
||||
*/
|
||||
public final class LibraryLoader {
|
||||
|
||||
private static final String TAG = "LibraryLoader";
|
||||
|
||||
private String[] nativeLibraries;
|
||||
private boolean loadAttempted;
|
||||
private boolean isAvailable;
|
||||
|
|
@ -54,7 +58,9 @@ public final class LibraryLoader {
|
|||
}
|
||||
isAvailable = true;
|
||||
} catch (UnsatisfiedLinkError exception) {
|
||||
// Do nothing.
|
||||
// Log a warning as an attempt to check for the library indicates that the app depends on an
|
||||
// extension and generally would expect its native libraries to be available.
|
||||
Log.w(TAG, "Failed to load " + Arrays.toString(nativeLibraries));
|
||||
}
|
||||
return isAvailable;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue