mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Merge pull request #1963 from khouzam:codecInitialize
PiperOrigin-RevId: 705123773
This commit is contained in:
commit
893b3775d4
@ -30,6 +30,9 @@
|
|||||||
* Enable sending `CmcdData` for manifest requests in adaptive streaming
|
* Enable sending `CmcdData` for manifest requests in adaptive streaming
|
||||||
formats DASH, HLS, and SmoothStreaming
|
formats DASH, HLS, and SmoothStreaming
|
||||||
([#1951](https://github.com/androidx/media/issues/1951)).
|
([#1951](https://github.com/androidx/media/issues/1951)).
|
||||||
|
* Provide `MediaCodecInfo` of the codec that will be initialized in
|
||||||
|
`MediaCodecRenderer.onReadyToInitializeCodec`
|
||||||
|
([#1963](https://github.com/androidx/media/pull/1963)).
|
||||||
* Transformer:
|
* Transformer:
|
||||||
* Update parameters of `VideoFrameProcessor.registerInputStream` and
|
* Update parameters of `VideoFrameProcessor.registerInputStream` and
|
||||||
`VideoFrameProcessor.Listener.onInputStreamRegistered` to use `Format`.
|
`VideoFrameProcessor.Listener.onInputStreamRegistered` to use `Format`.
|
||||||
|
@ -1216,7 +1216,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
if (codecOperatingRate <= assumedMinimumCodecOperatingRate) {
|
if (codecOperatingRate <= assumedMinimumCodecOperatingRate) {
|
||||||
codecOperatingRate = CODEC_OPERATING_RATE_UNSET;
|
codecOperatingRate = CODEC_OPERATING_RATE_UNSET;
|
||||||
}
|
}
|
||||||
onReadyToInitializeCodec(inputFormat);
|
onReadyToInitializeCodec(codecInfo, inputFormat);
|
||||||
codecInitializingTimestamp = getClock().elapsedRealtime();
|
codecInitializingTimestamp = getClock().elapsedRealtime();
|
||||||
MediaCodecAdapter.Configuration configuration =
|
MediaCodecAdapter.Configuration configuration =
|
||||||
getMediaCodecConfiguration(codecInfo, inputFormat, crypto, codecOperatingRate);
|
getMediaCodecConfiguration(codecInfo, inputFormat, crypto, codecOperatingRate);
|
||||||
@ -1495,10 +1495,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
*
|
*
|
||||||
* <p>The default implementation is a no-op.
|
* <p>The default implementation is a no-op.
|
||||||
*
|
*
|
||||||
|
* @param codecInfo The {@link MediaCodecInfo} of the codec which will be initialized.
|
||||||
* @param format The {@link Format} for which the codec is being configured.
|
* @param format The {@link Format} for which the codec is being configured.
|
||||||
* @throws ExoPlaybackException If an error occurs preparing for initializing the codec.
|
* @throws ExoPlaybackException If an error occurs preparing for initializing the codec.
|
||||||
*/
|
*/
|
||||||
protected void onReadyToInitializeCodec(Format format) throws ExoPlaybackException {
|
protected void onReadyToInitializeCodec(MediaCodecInfo codecInfo, Format format)
|
||||||
|
throws ExoPlaybackException {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1214,7 +1214,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
|
|
||||||
@CallSuper
|
@CallSuper
|
||||||
@Override
|
@Override
|
||||||
protected void onReadyToInitializeCodec(Format format) throws ExoPlaybackException {
|
protected void onReadyToInitializeCodec(MediaCodecInfo codecInfo, Format format)
|
||||||
|
throws ExoPlaybackException {
|
||||||
if (videoSink != null && !videoSink.isInitialized()) {
|
if (videoSink != null && !videoSink.isInitialized()) {
|
||||||
try {
|
try {
|
||||||
videoSink.initialize(format);
|
videoSink.initialize(format);
|
||||||
|
@ -78,6 +78,7 @@ import androidx.media3.exoplayer.Renderer;
|
|||||||
import androidx.media3.exoplayer.SeekParameters;
|
import androidx.media3.exoplayer.SeekParameters;
|
||||||
import androidx.media3.exoplayer.analytics.AnalyticsListener;
|
import androidx.media3.exoplayer.analytics.AnalyticsListener;
|
||||||
import androidx.media3.exoplayer.mediacodec.MediaCodecAdapter;
|
import androidx.media3.exoplayer.mediacodec.MediaCodecAdapter;
|
||||||
|
import androidx.media3.exoplayer.mediacodec.MediaCodecInfo;
|
||||||
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector;
|
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector;
|
||||||
import androidx.media3.exoplayer.source.MediaSource;
|
import androidx.media3.exoplayer.source.MediaSource;
|
||||||
import androidx.media3.exoplayer.video.MediaCodecVideoRenderer;
|
import androidx.media3.exoplayer.video.MediaCodecVideoRenderer;
|
||||||
@ -662,12 +663,13 @@ public final class ExperimentalFrameExtractor {
|
|||||||
|
|
||||||
@CallSuper
|
@CallSuper
|
||||||
@Override
|
@Override
|
||||||
protected void onReadyToInitializeCodec(Format format) throws ExoPlaybackException {
|
protected void onReadyToInitializeCodec(MediaCodecInfo codecInfo, Format format)
|
||||||
|
throws ExoPlaybackException {
|
||||||
if (isTransferHdr(format.colorInfo) && toneMapHdrToSdr) {
|
if (isTransferHdr(format.colorInfo) && toneMapHdrToSdr) {
|
||||||
// Setting the VideoSink format to SDR_BT709_LIMITED tone maps to SDR.
|
// Setting the VideoSink format to SDR_BT709_LIMITED tone maps to SDR.
|
||||||
format = format.buildUpon().setColorInfo(SDR_BT709_LIMITED).build();
|
format = format.buildUpon().setColorInfo(SDR_BT709_LIMITED).build();
|
||||||
}
|
}
|
||||||
super.onReadyToInitializeCodec(format);
|
super.onReadyToInitializeCodec(codecInfo, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user