@@ -72,10 +72,6 @@ class MediaCodecBridge {
7272 private int mFps = 30 ;
7373 private final boolean mIsTunnelingPlayback ;
7474
75- // TODO: (b/423927047) Once the Starboard Extension for Chromium Features
76- // lands, replace this macro with a starboard features.
77- private boolean mBufferFlagDecodeOnlyExperiment = false ;
78-
7975 private MediaCodec .OnFrameRenderedListener mFrameRendererListener ;
8076 private MediaCodec .OnFirstTunnelFrameReadyListener mFirstTunnelFrameReadyListener ;
8177
@@ -402,10 +398,10 @@ public static boolean isFrameRenderedCallbackEnabled() {
402398 return Build .VERSION .SDK_INT >= 34 ;
403399 }
404400
405- private boolean isDecodeOnly (long presentationTimeUs ) {
401+ private boolean isDecodeOnly (long presentationTimeUs , boolean decodeOnlyExperiment ) {
406402 // Starting with Android 14, we can use BUFFER_FLAG_DECODE_ONLY to explicitly skip video frames
407403 // before the seek time so that they won't be rendered.
408- return Build .VERSION .SDK_INT >= 34 && ( mBufferFlagDecodeOnlyExperiment ) && (presentationTimeUs < mSeekToTime );
404+ return Build .VERSION .SDK_INT >= 34 && decodeOnlyExperiment && (presentationTimeUs < mSeekToTime );
409405 }
410406
411407 @ CalledByNative
@@ -752,10 +748,10 @@ private ByteBuffer getOutputBuffer(int index) {
752748
753749 @ CalledByNative
754750 private int queueInputBuffer (
755- int index , int offset , int size , long presentationTimeUs , int flags ) {
751+ int index , int offset , int size , long presentationTimeUs , int flags , boolean decodeOnlyExperiment ) {
756752 resetLastPresentationTimeIfNeeded (presentationTimeUs );
757753 try {
758- if (isDecodeOnly (presentationTimeUs )) {
754+ if (isDecodeOnly (presentationTimeUs , decodeOnlyExperiment )) {
759755 flags |= MediaCodec .BUFFER_FLAG_DECODE_ONLY ;
760756 }
761757 mMediaCodec .get ().queueInputBuffer (index , offset , size , presentationTimeUs , flags );
@@ -778,7 +774,8 @@ private int queueSecureInputBuffer(
778774 int cipherMode ,
779775 int blocksToEncrypt ,
780776 int blocksToSkip ,
781- long presentationTimeUs ) {
777+ long presentationTimeUs ,
778+ boolean decodeOnlyExperiment ) {
782779 resetLastPresentationTimeIfNeeded (presentationTimeUs );
783780 try {
784781 CryptoInfo cryptoInfo = new CryptoInfo ();
@@ -792,10 +789,9 @@ private int queueSecureInputBuffer(
792789 return MediaCodecStatus .ERROR ;
793790 }
794791
795- int flags = 0 ;
796- if (isDecodeOnly (presentationTimeUs )) {
797- flags |= MediaCodec .BUFFER_FLAG_DECODE_ONLY ;
798- }
792+ int flags = isDecodeOnly (presentationTimeUs , decodeOnlyExperiment )
793+ ? MediaCodec .BUFFER_FLAG_DECODE_ONLY
794+ : 0 ;
799795 mMediaCodec .get ().queueSecureInputBuffer (index , offset , cryptoInfo , presentationTimeUs , flags );
800796 } catch (MediaCodec .CryptoException e ) {
801797 int errorCode = e .getErrorCode ();
0 commit comments