mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
Trigger reconfiguration on newly obtained MediaCodecAdapters
Add the `needsReconfiguration` API on the `MediaCodecAdapter` interface so that `MediaCodecRenderer` can reconfigure the `MediaCodec` in case a `MediaCodecAdapter` needs to be reconfigured immediately after being obtained from the `MediaCodecAdapter.Factory`. PiperOrigin-RevId: 376944334
This commit is contained in:
parent
2fb61b8ab5
commit
08c882a6ae
6 changed files with 25 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
|||
* Fix gradle config to allow specifying a relative path for
|
||||
`exoplayerRoot` when [depending on ExoPlayer locally](README.md#locally)
|
||||
([#8927](https://github.com/google/ExoPlayer/issues/8927)).
|
||||
* Add `needsReconfiguration` API to the `MediaCodecAdapter` interface.
|
||||
* Update `MediaItem.Builder` javadoc to discourage calling setters that
|
||||
will be (currently) ignored if another setter is not also called.
|
||||
* Extractors:
|
||||
|
|
|
|||
|
|
@ -184,6 +184,11 @@ import java.nio.ByteBuffer;
|
|||
state = STATE_STARTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsReconfiguration() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueInputBuffer(
|
||||
int index, int offset, int size, long presentationTimeUs, int flags) {
|
||||
|
|
|
|||
|
|
@ -214,4 +214,7 @@ public interface MediaCodecAdapter {
|
|||
* @see MediaCodec#setVideoScalingMode(int)
|
||||
*/
|
||||
void setVideoScalingMode(@C.VideoScalingMode int scalingMode);
|
||||
|
||||
/** Whether the adapter needs to be reconfigured before it is used. */
|
||||
boolean needsReconfiguration();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1141,6 +1141,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||
codecNeedsMonoChannelCountWorkaround(codecName, codecInputFormat);
|
||||
codecNeedsEosPropagation =
|
||||
codecNeedsEosPropagationWorkaround(codecInfo) || getCodecNeedsEosPropagation();
|
||||
if (codecAdapter.needsReconfiguration()) {
|
||||
this.codecReconfigured = true;
|
||||
this.codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING;
|
||||
this.codecNeedsAdaptationWorkaroundBuffer =
|
||||
codecAdaptationWorkaroundMode != ADAPTATION_WORKAROUND_MODE_NEVER;
|
||||
}
|
||||
if ("c2.android.mp3.decoder".equals(codecInfo.name)) {
|
||||
c2Mp3TimestampTracker = new C2Mp3TimestampTracker();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,11 @@ public class SynchronousMediaCodecAdapter implements MediaCodecAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsReconfiguration() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dequeueInputBufferIndex() {
|
||||
return codec.dequeueInputBuffer(0);
|
||||
|
|
|
|||
|
|
@ -278,6 +278,11 @@ public class CapturingRenderersFactory implements RenderersFactory, Dumper.Dumpa
|
|||
dumper.endBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsReconfiguration() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static byte[] peekBytes(ByteBuffer buffer, int offset, int size) {
|
||||
int originalPosition = buffer.position();
|
||||
buffer.position(offset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue