mirror of
https://github.com/samsonjs/media.git
synced 2026-04-06 11:25:46 +00:00
Make onInputFormatChanged methods in Renderers take FormatHolders
PiperOrigin-RevId: 257478434
This commit is contained in:
parent
972c6c2f5c
commit
6796b179a6
2 changed files with 15 additions and 15 deletions
|
|
@ -307,7 +307,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||
flagsOnlyBuffer.clear();
|
||||
int result = readSource(formatHolder, flagsOnlyBuffer, true);
|
||||
if (result == C.RESULT_FORMAT_READ) {
|
||||
onInputFormatChanged(formatHolder.format);
|
||||
onInputFormatChanged(formatHolder);
|
||||
} else if (result == C.RESULT_BUFFER_READ) {
|
||||
// End of stream read having not read a format.
|
||||
Assertions.checkState(flagsOnlyBuffer.isEndOfStream());
|
||||
|
|
@ -491,15 +491,15 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||
/**
|
||||
* Called when a new format is read from the upstream source.
|
||||
*
|
||||
* @param newFormat The new format.
|
||||
* @param formatHolder A {@link FormatHolder} that holds the new {@link Format}.
|
||||
* @throws ExoPlaybackException If an error occurs (re-)initializing the decoder.
|
||||
*/
|
||||
@CallSuper
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
|
||||
protected void onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
|
||||
Format oldFormat = format;
|
||||
format = newFormat;
|
||||
pendingFormat = newFormat;
|
||||
format = formatHolder.format;
|
||||
pendingFormat = format;
|
||||
|
||||
boolean drmInitDataChanged = !Util.areEqual(format.drmInitData, oldFormat == null ? null
|
||||
: oldFormat.drmInitData);
|
||||
|
|
@ -513,7 +513,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
||||
}
|
||||
DrmSession<ExoMediaCrypto> session =
|
||||
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
||||
drmSessionManager.acquireSession(Looper.myLooper(), format.drmInitData);
|
||||
if (sourceDrmSession != null) {
|
||||
sourceDrmSession.releaseReference();
|
||||
}
|
||||
|
|
@ -826,7 +826,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||
return false;
|
||||
}
|
||||
if (result == C.RESULT_FORMAT_READ) {
|
||||
onInputFormatChanged(formatHolder.format);
|
||||
onInputFormatChanged(formatHolder);
|
||||
return true;
|
||||
}
|
||||
if (inputBuffer.isEndOfStream()) {
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||
flagsOnlyBuffer.clear();
|
||||
int result = readSource(formatHolder, flagsOnlyBuffer, true);
|
||||
if (result == C.RESULT_FORMAT_READ) {
|
||||
onInputFormatChanged(formatHolder.format);
|
||||
onInputFormatChanged(formatHolder);
|
||||
} else if (result == C.RESULT_BUFFER_READ) {
|
||||
// End of stream read having not read a format.
|
||||
Assertions.checkState(flagsOnlyBuffer.isEndOfStream());
|
||||
|
|
@ -438,7 +438,7 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||
return false;
|
||||
}
|
||||
if (result == C.RESULT_FORMAT_READ) {
|
||||
onInputFormatChanged(formatHolder.format);
|
||||
onInputFormatChanged(formatHolder);
|
||||
return true;
|
||||
}
|
||||
if (inputBuffer.isEndOfStream()) {
|
||||
|
|
@ -656,9 +656,9 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
|
||||
private void onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
|
||||
Format oldFormat = inputFormat;
|
||||
inputFormat = newFormat;
|
||||
inputFormat = formatHolder.format;
|
||||
|
||||
boolean drmInitDataChanged = !Util.areEqual(inputFormat.drmInitData, oldFormat == null ? null
|
||||
: oldFormat.drmInitData);
|
||||
|
|
@ -673,7 +673,7 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
||||
}
|
||||
DrmSession<ExoMediaCrypto> session =
|
||||
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
||||
drmSessionManager.acquireSession(Looper.myLooper(), inputFormat.drmInitData);
|
||||
if (sourceDrmSession != null) {
|
||||
sourceDrmSession.releaseReference();
|
||||
}
|
||||
|
|
@ -694,10 +694,10 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||
audioTrackNeedsConfigure = true;
|
||||
}
|
||||
|
||||
encoderDelay = newFormat.encoderDelay;
|
||||
encoderPadding = newFormat.encoderPadding;
|
||||
encoderDelay = inputFormat.encoderDelay;
|
||||
encoderPadding = inputFormat.encoderPadding;
|
||||
|
||||
eventDispatcher.inputFormatChanged(newFormat);
|
||||
eventDispatcher.inputFormatChanged(inputFormat);
|
||||
}
|
||||
|
||||
private void onQueueInputBuffer(DecoderInputBuffer buffer) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue