mirror of
https://github.com/samsonjs/media.git
synced 2026-04-24 14:37:45 +00:00
Make explicit that Passthrough ∩ PCM = ∅
Previously that was implicit, it was the passthrough dance:
- MimeTypes.getEncoding(inputFormat) did not
implement RAW MIME, so it was returning INVALID_ENCODING for PCM
- and allowPassthrough was returning
MimeTypes.getEncoding() != INVALID_ENCODING
- which was setting codecInfo.passthrough, and passthroughEnabled.
Thus Util.isEncodingPcm(encoding) is the opposite of
(MimeTypes.getEncoding(inputFormat) != C.ENCODING_INVALID)
This was rather implicit and brittle as anyone
could add support for audio/RAW in
MimeTypes.getEncoding and break PCM playback.
As a result make it explicit that allowPassthrough
must always return false in PCM.
PiperOrigin-RevId: 295144013
This commit is contained in:
parent
ce3f981188
commit
5104548204
1 changed files with 4 additions and 2 deletions
|
|
@ -430,8 +430,6 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||
|
||||
/**
|
||||
* Returns whether encoded audio passthrough should be used for playing back the input format.
|
||||
* This implementation returns true if the {@link AudioSink} indicates that encoded audio output
|
||||
* is supported.
|
||||
*
|
||||
* @param channelCount The number of channels in the input media, or {@link Format#NO_VALUE} if
|
||||
* not known.
|
||||
|
|
@ -599,6 +597,10 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||
*/
|
||||
@C.Encoding
|
||||
protected int getPassthroughEncoding(int channelCount, String mimeType) {
|
||||
if (MimeTypes.AUDIO_RAW.equals(mimeType)) {
|
||||
// PCM passthrough is not supported.
|
||||
return C.ENCODING_INVALID;
|
||||
}
|
||||
if (MimeTypes.AUDIO_E_AC3_JOC.equals(mimeType)) {
|
||||
// E-AC3 JOC is object-based so the output channel count is arbitrary.
|
||||
if (audioSink.supportsOutput(/* channelCount= */ Format.NO_VALUE, C.ENCODING_E_AC3_JOC)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue