Skip to content

Commit

Permalink
Ensure DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION is always executed
Browse files Browse the repository at this point in the history
`codecDrainAction` is set to `DRAIN_ACTION_NONE` in 3 places in
`MediaCodecRenderer`:
* The constructor (so there's no prior state to worry about)
* `updateDrmSessionV23()`: Where `mediaCrypto` is reconfigured based
  on `sourceDrmSession` and `codecDrmSession` is also updated to
  `sourceDrmSession`.
* `resetCodecStateForFlush()`: Where (before this change) the action
  is unconditionally set back to `DRAIN_ACTION_NONE` and so any
  required updated implied by
  `DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` is not done.

This change ensures that `flushOrReleaseCodec()` handles
`DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` before calling .

This probably also resolves Issue: #10274

#minor-release

PiperOrigin-RevId: 454114428
(cherry picked from commit c736a72)
  • Loading branch information
icbaker authored and marcbaechinger committed Jun 13, 2022
1 parent 9a793da commit 31e6ba9
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -854,6 +854,19 @@ protected boolean flushOrReleaseCodec() {
releaseCodec();
return true;
}
if (codecDrainAction == DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION) {
checkState(Util.SDK_INT >= 23); // Implied by DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION
// Needed to keep lint happy (it doesn't understand the checkState call alone)
if (Util.SDK_INT >= 23) {
try {
updateDrmSessionV23();
} catch (ExoPlaybackException e) {
Log.w(TAG, "Failed to update the DRM session, releasing the codec instead.", e);
releaseCodec();
return true;
}
}
}
flushCodec();
return false;
}
Expand Down

0 comments on commit 31e6ba9

Please sign in to comment.