Merge "Add PlaybackComponent interface"
This commit is contained in:
committed by
Android (Google) Code Review
commit
e277b9a53d
@@ -25,6 +25,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.hardware.HardwareBuffer;
|
||||
import android.media.MediaCodecInfo.CodecCapabilities;
|
||||
import android.media.metrics.PlaybackComponent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -1538,7 +1539,8 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
</tbody>
|
||||
</table>
|
||||
*/
|
||||
final public class MediaCodec {
|
||||
final public class MediaCodec implements PlaybackComponent {
|
||||
|
||||
/**
|
||||
* Per buffer metadata includes an offset and size specifying
|
||||
* the range of valid data in the associated codec (output) buffer.
|
||||
@@ -1680,6 +1682,7 @@ final public class MediaCodec {
|
||||
private MediaCodecInfo mCodecInfo;
|
||||
private final Object mCodecInfoLock = new Object();
|
||||
private MediaCrypto mCrypto;
|
||||
private String mPlaybackId;
|
||||
|
||||
private static final int EVENT_CALLBACK = 1;
|
||||
private static final int EVENT_SET_CALLBACK = 2;
|
||||
@@ -1690,6 +1693,23 @@ final public class MediaCodec {
|
||||
private static final int CB_ERROR = 3;
|
||||
private static final int CB_OUTPUT_FORMAT_CHANGE = 4;
|
||||
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@Override
|
||||
public void setPlaybackId(@NonNull String playbackId) {
|
||||
// TODO: add a native method to pass the ID to the native code for logging.
|
||||
mPlaybackId = playbackId;
|
||||
}
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@Override
|
||||
public String getPlaybackId() {
|
||||
return mPlaybackId;
|
||||
}
|
||||
|
||||
private class EventHandler extends Handler {
|
||||
private MediaCodec mCodec;
|
||||
|
||||
|
||||
36
media/java/android/media/metrics/PlaybackComponent.java
Normal file
36
media/java/android/media/metrics/PlaybackComponent.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.media.metrics;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Interface for playback related components used by playback metrics.
|
||||
* @hide
|
||||
*/
|
||||
public interface PlaybackComponent {
|
||||
|
||||
/**
|
||||
* Sets the playback ID of the component.
|
||||
*/
|
||||
void setPlaybackId(@NonNull String playbackId);
|
||||
|
||||
/**
|
||||
* Gets playback ID.
|
||||
*/
|
||||
@NonNull String getPlaybackId();
|
||||
}
|
||||
Reference in New Issue
Block a user