Loading media/java/android/media/MediaCodec.java +21 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading Loading @@ -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; Loading @@ -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; Loading media/java/android/media/metrics/PlaybackComponent.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * 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(); } Loading
media/java/android/media/MediaCodec.java +21 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading Loading @@ -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; Loading @@ -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; Loading
media/java/android/media/metrics/PlaybackComponent.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * 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(); }