这是indexloc提供的服务,不要输入任何密码
Skip to content

Add MediaCodecInfo to MediaCodecRenderer::onReadyToInitializeCodec #1963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
* Enable sending `CmcdData` for manifest requests in adaptive streaming
formats DASH, HLS, and SmoothStreaming
([#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:
* Update parameters of `VideoFrameProcessor.registerInputStream` and
`VideoFrameProcessor.Listener.onInputStreamRegistered` to use `Format`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ private void initCodec(MediaCodecInfo codecInfo, @Nullable MediaCrypto crypto) t
if (codecOperatingRate <= assumedMinimumCodecOperatingRate) {
codecOperatingRate = CODEC_OPERATING_RATE_UNSET;
}
onReadyToInitializeCodec(inputFormat);
onReadyToInitializeCodec(codecInfo, inputFormat);
codecInitializingTimestamp = getClock().elapsedRealtime();
MediaCodecAdapter.Configuration configuration =
getMediaCodecConfiguration(codecInfo, inputFormat, crypto, codecOperatingRate);
Expand Down Expand Up @@ -1495,10 +1495,12 @@ private boolean feedInputBuffer() throws ExoPlaybackException {
*
* <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.
* @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.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,8 @@ protected float getCodecOperatingRateV23(

@CallSuper
@Override
protected void onReadyToInitializeCodec(Format format) throws ExoPlaybackException {
protected void onReadyToInitializeCodec(MediaCodecInfo codecInfo, Format format)
throws ExoPlaybackException {
if (videoSink != null && !videoSink.isInitialized()) {
try {
videoSink.initialize(format);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import androidx.media3.exoplayer.SeekParameters;
import androidx.media3.exoplayer.analytics.AnalyticsListener;
import androidx.media3.exoplayer.mediacodec.MediaCodecAdapter;
import androidx.media3.exoplayer.mediacodec.MediaCodecInfo;
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.video.MediaCodecVideoRenderer;
Expand Down Expand Up @@ -662,12 +663,13 @@ public void setVideoEffects(List<Effect> effects) {

@CallSuper
@Override
protected void onReadyToInitializeCodec(Format format) throws ExoPlaybackException {
protected void onReadyToInitializeCodec(MediaCodecInfo codecInfo, Format format)
throws ExoPlaybackException {
if (isTransferHdr(format.colorInfo) && toneMapHdrToSdr) {
// Setting the VideoSink format to SDR_BT709_LIMITED tone maps to SDR.
format = format.buildUpon().setColorInfo(SDR_BT709_LIMITED).build();
}
super.onReadyToInitializeCodec(format);
super.onReadyToInitializeCodec(codecInfo, format);
}

@Override
Expand Down