Merge "Support 8 channel IEC61937." into sc-dev
This commit is contained in:
@@ -273,8 +273,8 @@ public final class AudioFormat implements Parcelable {
|
||||
|
||||
/** Audio data format: compressed audio wrapped in PCM for HDMI
|
||||
* or S/PDIF passthrough.
|
||||
* IEC61937 uses a stereo stream of 16-bit samples as the wrapper.
|
||||
* So the channel mask for the track must be {@link #CHANNEL_OUT_STEREO}.
|
||||
* For devices whose SDK version is less than {@link android.os.Build.VERSION_CODES#S}, the
|
||||
* channel mask of IEC61937 track must be {@link #CHANNEL_OUT_STEREO}.
|
||||
* Data should be written to the stream in a short[] array.
|
||||
* If the data is written in a byte[] array then there may be endian problems
|
||||
* on some platforms when converting to short internally.
|
||||
|
||||
@@ -1676,13 +1676,11 @@ public class AudioTrack extends PlayerBase
|
||||
}
|
||||
mSampleRate = sampleRateInHz;
|
||||
|
||||
// IEC61937 is based on stereo. We could coerce it to stereo.
|
||||
// But the application needs to know the stream is stereo so that
|
||||
// it is encoded and played correctly. So better to just reject it.
|
||||
if (audioFormat == AudioFormat.ENCODING_IEC61937
|
||||
&& channelConfig != AudioFormat.CHANNEL_OUT_STEREO) {
|
||||
throw new IllegalArgumentException(
|
||||
"ENCODING_IEC61937 must be configured as CHANNEL_OUT_STEREO");
|
||||
&& channelConfig != AudioFormat.CHANNEL_OUT_STEREO
|
||||
&& AudioFormat.channelCountFromOutChannelMask(channelConfig) != 8) {
|
||||
Log.w(TAG, "ENCODING_IEC61937 is configured with channel mask as " + channelConfig
|
||||
+ ", which is not 2 or 8 channels");
|
||||
}
|
||||
|
||||
//--------------
|
||||
|
||||
Reference in New Issue
Block a user