Commit 387720d1 by olly Committed by Oliver Woodman

Allow module registrations + log player release

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162223981
parent da79dec6
......@@ -20,6 +20,7 @@ import android.os.ConditionVariable;
import android.text.TextUtils;
import android.util.Log;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.upstream.DataSourceException;
import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.HttpDataSource;
......@@ -74,6 +75,10 @@ public class CronetDataSource extends UrlRequest.Callback implements HttpDataSou
}
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.cronet");
}
/**
* The default connection timeout, in milliseconds.
*/
......
......@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.ext.ffmpeg;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader;
import com.google.android.exoplayer2.util.MimeTypes;
......@@ -23,6 +24,10 @@ import com.google.android.exoplayer2.util.MimeTypes;
*/
public final class FfmpegLibrary {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.ffmpeg");
}
private static final LibraryLoader LOADER =
new LibraryLoader("avutil", "avresample", "avcodec", "ffmpeg");
......
......@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.ext.flac;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader;
/**
......@@ -22,6 +23,10 @@ import com.google.android.exoplayer2.util.LibraryLoader;
*/
public final class FlacLibrary {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.flac");
}
private static final LibraryLoader LOADER = new LibraryLoader("flacJNI");
private FlacLibrary() {}
......
......@@ -16,6 +16,7 @@
package com.google.android.exoplayer2.ext.gvr;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.audio.AudioProcessor;
import com.google.vr.sdk.audio.GvrAudioSurround;
......@@ -28,6 +29,10 @@ import java.nio.ByteOrder;
*/
public final class GvrAudioProcessor implements AudioProcessor {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.gvr");
}
private static final int FRAMES_PER_OUTPUT_BUFFER = 1024;
private static final int OUTPUT_CHANNEL_COUNT = 2;
private static final int OUTPUT_FRAME_SIZE = OUTPUT_CHANNEL_COUNT * 2; // 16-bit stereo output.
......
......@@ -57,9 +57,6 @@ import java.util.List;
public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlayer,
ContentProgressProvider, AdErrorListener, AdsLoadedListener, AdEventListener {
private static final boolean DEBUG = false;
private static final String TAG = "ImaAdsLoader";
/**
* Listener for ad loader events. All methods are called on the main thread.
*/
......@@ -81,6 +78,13 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye
}
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.ima");
}
private static final boolean DEBUG = false;
private static final String TAG = "ImaAdsLoader";
/**
* Whether to enable preloading of ads in {@link AdsRenderingSettings}.
*/
......
......@@ -19,6 +19,7 @@ import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.upstream.DataSourceException;
import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.HttpDataSource;
......@@ -45,6 +46,10 @@ import okhttp3.Response;
*/
public class OkHttpDataSource implements HttpDataSource {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.okhttp");
}
private static final AtomicReference<byte[]> skipBufferReference = new AtomicReference<>();
@NonNull private final Call.Factory callFactory;
......
......@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.ext.opus;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader;
/**
......@@ -22,6 +23,10 @@ import com.google.android.exoplayer2.util.LibraryLoader;
*/
public final class OpusLibrary {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.opus");
}
private static final LibraryLoader LOADER = new LibraryLoader("opus", "opusJNI");
private OpusLibrary() {}
......
......@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.ext.rtmp;
import android.net.Uri;
import android.support.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.TransferListener;
......@@ -30,6 +31,10 @@ import net.butterflytv.rtmp_client.RtmpClient.RtmpIOException;
*/
public final class RtmpDataSource implements DataSource {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.rtmp");
}
@Nullable private final TransferListener<? super RtmpDataSource> listener;
private RtmpClient rtmpClient;
......
......@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.ext.vp9;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader;
/**
......@@ -22,6 +23,10 @@ import com.google.android.exoplayer2.util.LibraryLoader;
*/
public final class VpxLibrary {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.vpx");
}
private static final LibraryLoader LOADER = new LibraryLoader("vpx", "vpxJNI");
private VpxLibrary() {}
......@@ -70,4 +75,5 @@ public final class VpxLibrary {
private static native String vpxGetVersion();
private static native String vpxGetBuildConfig();
public static native boolean vpxIsSecureDecodeSupported();
}
......@@ -80,7 +80,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
*/
@SuppressLint("HandlerLeak")
public ExoPlayerImpl(Renderer[] renderers, TrackSelector trackSelector, LoadControl loadControl) {
Log.i(TAG, "Init " + ExoPlayerLibraryInfo.VERSION_SLASHY + " [" + Util.DEVICE_DEBUG_INFO + "]");
Log.i(TAG, "Init " + Integer.toHexString(System.identityHashCode(this)) + " ["
+ ExoPlayerLibraryInfo.VERSION_SLASHY + "] [" + Util.DEVICE_DEBUG_INFO + "]");
Assertions.checkState(renderers.length > 0);
this.renderers = Assertions.checkNotNull(renderers);
this.trackSelector = Assertions.checkNotNull(trackSelector);
......@@ -263,6 +264,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Override
public void release() {
Log.i(TAG, "Release " + Integer.toHexString(System.identityHashCode(this)) + " ["
+ ExoPlayerLibraryInfo.VERSION_SLASHY + "] [" + Util.DEVICE_DEBUG_INFO + "] ["
+ ExoPlayerLibraryInfo.registeredModules() + "]");
internalPlayer.release();
eventHandler.removeCallbacksAndMessages(null);
}
......
......@@ -15,22 +15,29 @@
*/
package com.google.android.exoplayer2;
import java.util.HashSet;
/**
* Information about the ExoPlayer library.
*/
public interface ExoPlayerLibraryInfo {
public final class ExoPlayerLibraryInfo {
/**
* A tag to use when logging library information.
*/
public static final String TAG = "ExoPlayer";
/**
* The version of the library expressed as a string, for example "1.2.3".
*/
// Intentionally hardcoded. Do not derive from other constants (e.g. VERSION_INT) or vice versa.
String VERSION = "2.4.3";
public static final String VERSION = "2.4.3";
/**
* The version of the library expressed as {@code "ExoPlayerLib/" + VERSION}.
*/
// Intentionally hardcoded. Do not derive from other constants (e.g. VERSION) or vice versa.
String VERSION_SLASHY = "ExoPlayerLib/2.4.3";
public static final String VERSION_SLASHY = "ExoPlayerLib/2.4.3";
/**
* The version of the library expressed as an integer, for example 1002003.
......@@ -40,18 +47,41 @@ public interface ExoPlayerLibraryInfo {
* integer version 123045006 (123-045-006).
*/
// Intentionally hardcoded. Do not derive from other constants (e.g. VERSION) or vice versa.
int VERSION_INT = 2004003;
public static final int VERSION_INT = 2004003;
/**
* Whether the library was compiled with {@link com.google.android.exoplayer2.util.Assertions}
* checks enabled.
*/
boolean ASSERTIONS_ENABLED = true;
public static final boolean ASSERTIONS_ENABLED = true;
/**
* Whether the library was compiled with {@link com.google.android.exoplayer2.util.TraceUtil}
* trace enabled.
*/
boolean TRACE_ENABLED = true;
public static final boolean TRACE_ENABLED = true;
private static final HashSet<String> registeredModules = new HashSet<>();
private static String registeredModulesString = "goog.exo.core";
private ExoPlayerLibraryInfo() {} // Prevents instantiation.
/**
* Returns a string consisting of registered module names separated by ", ".
*/
public static synchronized String registeredModules() {
return registeredModulesString;
}
/**
* Registers a module to be returned in the {@link #registeredModules()} string.
*
* @param name The name of the module being registered.
*/
public static synchronized void registerModule(String name) {
if (registeredModules.add(name)) {
registeredModulesString = registeredModulesString + ", " + name;
}
}
}
......@@ -22,6 +22,7 @@ import android.util.Log;
import android.util.SparseArray;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
......@@ -52,6 +53,10 @@ import java.util.TimeZone;
*/
public final class DashMediaSource implements MediaSource {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.dash");
}
/**
* The default minimum number of times to retry loading data prior to failing.
*/
......
......@@ -19,6 +19,7 @@ import android.net.Uri;
import android.os.Handler;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.EventDispatcher;
import com.google.android.exoplayer2.source.MediaPeriod;
......@@ -38,6 +39,10 @@ import java.util.List;
public final class HlsMediaSource implements MediaSource,
HlsPlaylistTracker.PrimaryPlaylistListener {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.hls");
}
/**
* The default minimum number of times to retry loading data prior to failing.
*/
......
......@@ -20,6 +20,7 @@ import android.os.Handler;
import android.os.SystemClock;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
......@@ -46,6 +47,10 @@ import java.util.ArrayList;
public final class SsMediaSource implements MediaSource,
Loader.Callback<ParsingLoadable<SsManifest>> {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.smoothstreaming");
}
/**
* The default minimum number of times to retry loading data prior to failing.
*/
......
......@@ -33,6 +33,7 @@ import android.widget.TextView;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.TrackGroupArray;
......@@ -165,6 +166,10 @@ import java.util.Locale;
*/
public class PlaybackControlView extends FrameLayout {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.ui");
}
/**
* Listener to be notified about changes of the visibility of the UI control.
*/
......
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