Unhide media metrics APIs part 2: playback metrics
Bug: 167036690 Test: mmm Change-Id: I333aa0d5de72f5c89813df40a7c9fcc59423d635
This commit is contained in:
@@ -20978,7 +20978,7 @@ package android.media {
|
||||
method @NonNull public String getDiagnosticInfo();
|
||||
}
|
||||
|
||||
public final class MediaCodec {
|
||||
public final class MediaCodec implements android.media.metrics.PlaybackComponent {
|
||||
method public void configure(@Nullable android.media.MediaFormat, @Nullable android.view.Surface, @Nullable android.media.MediaCrypto, int);
|
||||
method public void configure(@Nullable android.media.MediaFormat, @Nullable android.view.Surface, int, @Nullable android.media.MediaDescrambler);
|
||||
method @NonNull public static android.media.MediaCodec createByCodecName(@NonNull String) throws java.io.IOException;
|
||||
@@ -21004,6 +21004,7 @@ package android.media {
|
||||
method @NonNull public android.media.MediaFormat getOutputFormat(int);
|
||||
method @NonNull public android.media.MediaCodec.OutputFrame getOutputFrame(int);
|
||||
method @Nullable public android.media.Image getOutputImage(int);
|
||||
method public String getPlaybackId();
|
||||
method @NonNull public android.media.MediaCodec.QueueRequest getQueueRequest(int);
|
||||
method @Nullable public static android.media.Image mapHardwareBuffer(@NonNull android.hardware.HardwareBuffer);
|
||||
method public void queueInputBuffer(int, int, int, long, int) throws android.media.MediaCodec.CryptoException;
|
||||
@@ -21019,6 +21020,7 @@ package android.media {
|
||||
method public void setOnFrameRenderedListener(@Nullable android.media.MediaCodec.OnFrameRenderedListener, @Nullable android.os.Handler);
|
||||
method public void setOutputSurface(@NonNull android.view.Surface);
|
||||
method public void setParameters(@Nullable android.os.Bundle);
|
||||
method public void setPlaybackId(@NonNull String);
|
||||
method public void setVideoScalingMode(int);
|
||||
method public void signalEndOfInputStream();
|
||||
method public void start();
|
||||
@@ -24108,6 +24110,11 @@ package android.media.metrics {
|
||||
method @NonNull public android.media.metrics.NetworkEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
|
||||
}
|
||||
|
||||
public interface PlaybackComponent {
|
||||
method @NonNull public String getPlaybackId();
|
||||
method public void setPlaybackId(@NonNull String);
|
||||
}
|
||||
|
||||
public final class PlaybackErrorEvent extends android.media.metrics.Event implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public int getErrorCode();
|
||||
@@ -24128,11 +24135,76 @@ package android.media.metrics {
|
||||
method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
|
||||
}
|
||||
|
||||
public final class PlaybackMetrics implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getAudioUnderrunCount();
|
||||
method public int getContentType();
|
||||
method public int getDrmType();
|
||||
method @NonNull public long[] getExperimentIds();
|
||||
method @IntRange(from=0xffffffff) public long getLocalBytesRead();
|
||||
method @IntRange(from=0xffffffff) public long getMediaDurationMillis();
|
||||
method @IntRange(from=0xffffffff) public long getNetworkBytesRead();
|
||||
method @IntRange(from=0xffffffff) public long getNetworkTransferDurationMillis();
|
||||
method public int getPlaybackType();
|
||||
method @Nullable public String getPlayerName();
|
||||
method @Nullable public String getPlayerVersion();
|
||||
method public int getStreamSource();
|
||||
method public int getStreamType();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getVideoFramesDropped();
|
||||
method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getVideoFramesPlayed();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field public static final int CONTENT_TYPE_AD = 1; // 0x1
|
||||
field public static final int CONTENT_TYPE_MAIN = 0; // 0x0
|
||||
field public static final int CONTENT_TYPE_OTHER = 2; // 0x2
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.PlaybackMetrics> CREATOR;
|
||||
field public static final int DRM_TYPE_CLEARKEY = 6; // 0x6
|
||||
field public static final int DRM_TYPE_NONE = 0; // 0x0
|
||||
field public static final int DRM_TYPE_OTHER = 1; // 0x1
|
||||
field public static final int DRM_TYPE_PLAY_READY = 2; // 0x2
|
||||
field public static final int DRM_TYPE_WIDEVINE_L1 = 3; // 0x3
|
||||
field public static final int DRM_TYPE_WIDEVINE_L3 = 4; // 0x4
|
||||
field public static final int DRM_TYPE_WV_L3_FALLBACK = 5; // 0x5
|
||||
field public static final int PLAYBACK_TYPE_LIVE = 1; // 0x1
|
||||
field public static final int PLAYBACK_TYPE_OTHER = 2; // 0x2
|
||||
field public static final int PLAYBACK_TYPE_VOD = 0; // 0x0
|
||||
field public static final int STREAM_SOURCE_DEVICE = 2; // 0x2
|
||||
field public static final int STREAM_SOURCE_MIXED = 3; // 0x3
|
||||
field public static final int STREAM_SOURCE_NETWORK = 1; // 0x1
|
||||
field public static final int STREAM_SOURCE_UNKNOWN = 0; // 0x0
|
||||
field public static final int STREAM_TYPE_DASH = 3; // 0x3
|
||||
field public static final int STREAM_TYPE_HLS = 4; // 0x4
|
||||
field public static final int STREAM_TYPE_OTHER = 1; // 0x1
|
||||
field public static final int STREAM_TYPE_PROGRESSIVE = 2; // 0x2
|
||||
field public static final int STREAM_TYPE_SS = 5; // 0x5
|
||||
field public static final int STREAM_TYPE_UNKNOWN = 0; // 0x0
|
||||
}
|
||||
|
||||
public static final class PlaybackMetrics.Builder {
|
||||
ctor public PlaybackMetrics.Builder();
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder addExperimentId(long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics build();
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setAudioUnderrunCount(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setContentType(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setDrmType(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setLocalBytesRead(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setMediaDurationMillis(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setNetworkBytesRead(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setNetworkTransferDurationMillis(@IntRange(from=0xffffffff) long);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlaybackType(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlayerName(@NonNull String);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlayerVersion(@NonNull String);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setStreamSource(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setStreamType(int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setVideoFramesDropped(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
method @NonNull public android.media.metrics.PlaybackMetrics.Builder setVideoFramesPlayed(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
|
||||
}
|
||||
|
||||
public final class PlaybackSession implements java.lang.AutoCloseable {
|
||||
method public void close();
|
||||
method @NonNull public String getId();
|
||||
method public void reportNetworkEvent(@NonNull android.media.metrics.NetworkEvent);
|
||||
method public void reportPlaybackErrorEvent(@NonNull android.media.metrics.PlaybackErrorEvent);
|
||||
method public void reportPlaybackMetrics(@NonNull android.media.metrics.PlaybackMetrics);
|
||||
method public void reportPlaybackStateEvent(@NonNull android.media.metrics.PlaybackStateEvent);
|
||||
method public void reportTrackChangeEvent(@NonNull android.media.metrics.TrackChangeEvent);
|
||||
}
|
||||
|
||||
@@ -1232,11 +1232,6 @@ package android.media {
|
||||
method public void forceResourceLost();
|
||||
}
|
||||
|
||||
public final class MediaCodec implements android.media.metrics.PlaybackComponent {
|
||||
method public String getPlaybackId();
|
||||
method public void setPlaybackId(@NonNull String);
|
||||
}
|
||||
|
||||
public static final class MediaCodecInfo.VideoCapabilities.PerformancePoint {
|
||||
ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(int, int, int, int, @NonNull android.util.Size);
|
||||
ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(@NonNull android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint, @NonNull android.util.Size);
|
||||
@@ -1311,15 +1306,6 @@ package android.media.audiopolicy {
|
||||
|
||||
}
|
||||
|
||||
package android.media.metrics {
|
||||
|
||||
public interface PlaybackComponent {
|
||||
method @NonNull public String getPlaybackId();
|
||||
method public void setPlaybackId(@NonNull String);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media.tv {
|
||||
|
||||
public final class TvInputManager {
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
package android.media.metrics;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.TestApi;
|
||||
|
||||
/**
|
||||
* Interface for playback related components used by playback metrics.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public interface PlaybackComponent {
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.media.metrics;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.os.Parcel;
|
||||
@@ -33,35 +34,57 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This class is used to store playback data.
|
||||
* @hide
|
||||
*/
|
||||
public final class PlaybackMetrics implements Parcelable {
|
||||
// TODO(b/177209128): JavaDoc for the constants.
|
||||
/** Unknown stream source. */
|
||||
public static final int STREAM_SOURCE_UNKNOWN = 0;
|
||||
/** Stream from network. */
|
||||
public static final int STREAM_SOURCE_NETWORK = 1;
|
||||
/** Stream from device. */
|
||||
public static final int STREAM_SOURCE_DEVICE = 2;
|
||||
/** Stream from more than one sources. */
|
||||
public static final int STREAM_SOURCE_MIXED = 3;
|
||||
|
||||
/** Unknown stream type. */
|
||||
public static final int STREAM_TYPE_UNKNOWN = 0;
|
||||
/** Other stream type. */
|
||||
public static final int STREAM_TYPE_OTHER = 1;
|
||||
/** Progressive stream type. */
|
||||
public static final int STREAM_TYPE_PROGRESSIVE = 2;
|
||||
/** DASH (Dynamic Adaptive Streaming over HTTP) stream type. */
|
||||
public static final int STREAM_TYPE_DASH = 3;
|
||||
/** HLS (HTTP Live Streaming) stream type. */
|
||||
public static final int STREAM_TYPE_HLS = 4;
|
||||
/** SS (HTTP Smooth Streaming) stream type. */
|
||||
public static final int STREAM_TYPE_SS = 5;
|
||||
|
||||
/** VOD (Video on Demand) playback type. */
|
||||
public static final int PLAYBACK_TYPE_VOD = 0;
|
||||
/** Live playback type. */
|
||||
public static final int PLAYBACK_TYPE_LIVE = 1;
|
||||
/** Other playback type. */
|
||||
public static final int PLAYBACK_TYPE_OTHER = 2;
|
||||
|
||||
/** DRM is not used. */
|
||||
public static final int DRM_TYPE_NONE = 0;
|
||||
/** Other DRM type. */
|
||||
public static final int DRM_TYPE_OTHER = 1;
|
||||
/** Play ready DRM type. */
|
||||
public static final int DRM_TYPE_PLAY_READY = 2;
|
||||
/** Widevine L1 DRM type. */
|
||||
public static final int DRM_TYPE_WIDEVINE_L1 = 3;
|
||||
/** Widevine L3 DRM type. */
|
||||
public static final int DRM_TYPE_WIDEVINE_L3 = 4;
|
||||
// TODO: add DRM_TYPE_CLEARKEY
|
||||
/** Widevine L3 fallback DRM type. */
|
||||
public static final int DRM_TYPE_WV_L3_FALLBACK = 5;
|
||||
/** Clear key DRM type. */
|
||||
public static final int DRM_TYPE_CLEARKEY = 6;
|
||||
|
||||
/** Main contents. */
|
||||
public static final int CONTENT_TYPE_MAIN = 0;
|
||||
/** Advertisement contents. */
|
||||
public static final int CONTENT_TYPE_AD = 1;
|
||||
/** Other contents. */
|
||||
public static final int CONTENT_TYPE_OTHER = 2;
|
||||
|
||||
|
||||
@@ -102,7 +125,9 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
DRM_TYPE_OTHER,
|
||||
DRM_TYPE_PLAY_READY,
|
||||
DRM_TYPE_WIDEVINE_L1,
|
||||
DRM_TYPE_WIDEVINE_L3
|
||||
DRM_TYPE_WIDEVINE_L3,
|
||||
DRM_TYPE_WV_L3_FALLBACK,
|
||||
DRM_TYPE_CLEARKEY
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DrmType {}
|
||||
@@ -173,6 +198,11 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
this.mNetworkTransferDurationMillis = networkTransferDurationMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the media duration in milliseconds.
|
||||
* @return the media duration in milliseconds, or -1 if unknown.
|
||||
*/
|
||||
@IntRange(from = -1)
|
||||
public long getMediaDurationMillis() {
|
||||
return mMediaDurationMillis;
|
||||
}
|
||||
@@ -241,28 +271,36 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
|
||||
/**
|
||||
* Gets video frames played.
|
||||
* @return the video frames played, or -1 if unknown.
|
||||
*/
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE)
|
||||
public int getVideoFramesPlayed() {
|
||||
return mVideoFramesPlayed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets video frames dropped.
|
||||
* @return the video frames dropped, or -1 if unknown.
|
||||
*/
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE)
|
||||
public int getVideoFramesDropped() {
|
||||
return mVideoFramesDropped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets audio underrun count.
|
||||
* @return the audio underrun count, or -1 if unknown.
|
||||
*/
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE)
|
||||
public int getAudioUnderrunCount() {
|
||||
return mAudioUnderrunCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of network bytes read.
|
||||
* @return the number of network bytes read, or -1 if unknown.
|
||||
*/
|
||||
@IntRange(from = -1)
|
||||
public long getNetworkBytesRead() {
|
||||
return mNetworkBytesRead;
|
||||
}
|
||||
@@ -270,6 +308,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
/**
|
||||
* Gets number of local bytes read.
|
||||
*/
|
||||
@IntRange(from = -1)
|
||||
public long getLocalBytesRead() {
|
||||
return mLocalBytesRead;
|
||||
}
|
||||
@@ -277,6 +316,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
/**
|
||||
* Gets network transfer duration in milliseconds.
|
||||
*/
|
||||
@IntRange(from = -1)
|
||||
public long getNetworkTransferDurationMillis() {
|
||||
return mNetworkTransferDurationMillis;
|
||||
}
|
||||
@@ -415,34 +455,33 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private long mMediaDurationMillis;
|
||||
private int mStreamSource;
|
||||
private int mStreamType;
|
||||
private int mPlaybackType;
|
||||
private int mDrmType;
|
||||
private int mContentType;
|
||||
private long mMediaDurationMillis = -1;
|
||||
private int mStreamSource = STREAM_SOURCE_UNKNOWN;
|
||||
private int mStreamType = STREAM_TYPE_UNKNOWN;
|
||||
private int mPlaybackType = PLAYBACK_TYPE_OTHER;
|
||||
private int mDrmType = DRM_TYPE_NONE;
|
||||
private int mContentType = CONTENT_TYPE_OTHER;
|
||||
private @Nullable String mPlayerName;
|
||||
private @Nullable String mPlayerVersion;
|
||||
private @NonNull List<Long> mExperimentIds = new ArrayList<>();
|
||||
private int mVideoFramesPlayed;
|
||||
private int mVideoFramesDropped;
|
||||
private int mAudioUnderrunCount;
|
||||
private long mNetworkBytesRead;
|
||||
private long mLocalBytesRead;
|
||||
private long mNetworkTransferDurationMillis;
|
||||
private int mVideoFramesPlayed = -1;
|
||||
private int mVideoFramesDropped = -1;
|
||||
private int mAudioUnderrunCount = -1;
|
||||
private long mNetworkBytesRead = -1;
|
||||
private long mLocalBytesRead = -1;
|
||||
private long mNetworkTransferDurationMillis = -1;
|
||||
|
||||
/**
|
||||
* Creates a new Builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the media duration in milliseconds.
|
||||
* @param value the media duration in milliseconds. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setMediaDurationMillis(long value) {
|
||||
public @NonNull Builder setMediaDurationMillis(@IntRange(from = -1) long value) {
|
||||
mMediaDurationMillis = value;
|
||||
return this;
|
||||
}
|
||||
@@ -474,7 +513,7 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
/**
|
||||
* Sets the DRM type.
|
||||
*/
|
||||
public @NonNull Builder setDrmType(@StreamType int value) {
|
||||
public @NonNull Builder setDrmType(@DrmType int value) {
|
||||
mDrmType = value;
|
||||
return this;
|
||||
}
|
||||
@@ -513,48 +552,58 @@ public final class PlaybackMetrics implements Parcelable {
|
||||
|
||||
/**
|
||||
* Sets the video frames played.
|
||||
* @param value the video frames played. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setVideoFramesPlayed(int value) {
|
||||
public @NonNull Builder setVideoFramesPlayed(
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE) int value) {
|
||||
mVideoFramesPlayed = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the video frames dropped.
|
||||
* @param value the video frames dropped. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setVideoFramesDropped(int value) {
|
||||
public @NonNull Builder setVideoFramesDropped(
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE) int value) {
|
||||
mVideoFramesDropped = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the audio underrun count.
|
||||
* @param value the audio underrun count. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setAudioUnderrunCount(int value) {
|
||||
public @NonNull Builder setAudioUnderrunCount(
|
||||
@IntRange(from = -1, to = Integer.MAX_VALUE) int value) {
|
||||
mAudioUnderrunCount = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of network bytes read.
|
||||
* @param value the number of network bytes read. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setNetworkBytesRead(long value) {
|
||||
public @NonNull Builder setNetworkBytesRead(@IntRange(from = -1) long value) {
|
||||
mNetworkBytesRead = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of local bytes read.
|
||||
* @param value the number of local bytes read. -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setLocalBytesRead(long value) {
|
||||
public @NonNull Builder setLocalBytesRead(@IntRange(from = -1) long value) {
|
||||
mLocalBytesRead = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the network transfer duration in milliseconds.
|
||||
* @param value the network transfer duration in milliseconds.
|
||||
* -1 indicates the value is unknown.
|
||||
*/
|
||||
public @NonNull Builder setNetworkTransferDurationMillis(long value) {
|
||||
public @NonNull Builder setNetworkTransferDurationMillis(@IntRange(from = -1) long value) {
|
||||
mNetworkTransferDurationMillis = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ public final class PlaybackSession implements AutoCloseable {
|
||||
|
||||
/**
|
||||
* Reports playback metrics.
|
||||
* @hide
|
||||
*/
|
||||
public void reportPlaybackMetrics(@NonNull PlaybackMetrics metrics) {
|
||||
mManager.reportPlaybackMetrics(mId, metrics);
|
||||
|
||||
Reference in New Issue
Block a user