Commit f62fa434 by andrewlewis Committed by Oliver Woodman

Log warnings when extension libraries can't be used

Issue: #5788
PiperOrigin-RevId: 245440858
parent b55e1758
...@@ -115,6 +115,11 @@ ...@@ -115,6 +115,11 @@
order when in shuffle mode. order when in shuffle mode.
* Allow handling of custom commands via `registerCustomCommandReceiver`. * Allow handling of custom commands via `registerCustomCommandReceiver`.
* Add ability to include an extras `Bundle` when reporting a custom error. * 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 ### ### 2.9.6 ###
......
...@@ -19,6 +19,7 @@ import androidx.annotation.Nullable; ...@@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo; import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader; import com.google.android.exoplayer2.util.LibraryLoader;
import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
/** /**
...@@ -30,6 +31,8 @@ public final class FfmpegLibrary { ...@@ -30,6 +31,8 @@ public final class FfmpegLibrary {
ExoPlayerLibraryInfo.registerModule("goog.exo.ffmpeg"); ExoPlayerLibraryInfo.registerModule("goog.exo.ffmpeg");
} }
private static final String TAG = "FfmpegLibrary";
private static final LibraryLoader LOADER = private static final LibraryLoader LOADER =
new LibraryLoader("avutil", "avresample", "avcodec", "ffmpeg"); new LibraryLoader("avutil", "avresample", "avcodec", "ffmpeg");
...@@ -69,7 +72,14 @@ public final class FfmpegLibrary { ...@@ -69,7 +72,14 @@ public final class FfmpegLibrary {
return false; return false;
} }
String codecName = getCodecName(mimeType, encoding); 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 @@ ...@@ -15,11 +15,15 @@
*/ */
package com.google.android.exoplayer2.util; package com.google.android.exoplayer2.util;
import java.util.Arrays;
/** /**
* Configurable loader for native libraries. * Configurable loader for native libraries.
*/ */
public final class LibraryLoader { public final class LibraryLoader {
private static final String TAG = "LibraryLoader";
private String[] nativeLibraries; private String[] nativeLibraries;
private boolean loadAttempted; private boolean loadAttempted;
private boolean isAvailable; private boolean isAvailable;
...@@ -54,7 +58,9 @@ public final class LibraryLoader { ...@@ -54,7 +58,9 @@ public final class LibraryLoader {
} }
isAvailable = true; isAvailable = true;
} catch (UnsatisfiedLinkError exception) { } 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; return isAvailable;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment