Merge "AudioFormat: implement ENCODING_IEC61937" into nyc-dev
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#define ENCODING_AAC_LC 10
|
#define ENCODING_AAC_LC 10
|
||||||
#define ENCODING_AAC_HE_V1 11
|
#define ENCODING_AAC_HE_V1 11
|
||||||
#define ENCODING_AAC_HE_V2 12
|
#define ENCODING_AAC_HE_V2 12
|
||||||
|
#define ENCODING_IEC61937 13
|
||||||
#define ENCODING_INVALID 0
|
#define ENCODING_INVALID 0
|
||||||
#define ENCODING_DEFAULT 1
|
#define ENCODING_DEFAULT 1
|
||||||
|
|
||||||
@@ -64,6 +65,8 @@ static inline audio_format_t audioFormatToNative(int audioFormat)
|
|||||||
return AUDIO_FORMAT_AAC_HE_V1;
|
return AUDIO_FORMAT_AAC_HE_V1;
|
||||||
case ENCODING_AAC_HE_V2:
|
case ENCODING_AAC_HE_V2:
|
||||||
return AUDIO_FORMAT_AAC_HE_V2;
|
return AUDIO_FORMAT_AAC_HE_V2;
|
||||||
|
case ENCODING_IEC61937:
|
||||||
|
return AUDIO_FORMAT_IEC61937;
|
||||||
case ENCODING_DEFAULT:
|
case ENCODING_DEFAULT:
|
||||||
return AUDIO_FORMAT_DEFAULT;
|
return AUDIO_FORMAT_DEFAULT;
|
||||||
default:
|
default:
|
||||||
@@ -103,6 +106,8 @@ static inline int audioFormatFromNative(audio_format_t nativeFormat)
|
|||||||
return ENCODING_AAC_HE_V1;
|
return ENCODING_AAC_HE_V1;
|
||||||
case AUDIO_FORMAT_AAC_HE_V2:
|
case AUDIO_FORMAT_AAC_HE_V2:
|
||||||
return ENCODING_AAC_HE_V2;
|
return ENCODING_AAC_HE_V2;
|
||||||
|
case AUDIO_FORMAT_IEC61937:
|
||||||
|
return ENCODING_IEC61937;
|
||||||
case AUDIO_FORMAT_DEFAULT:
|
case AUDIO_FORMAT_DEFAULT:
|
||||||
return ENCODING_DEFAULT;
|
return ENCODING_DEFAULT;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
|||||||
|
|
||||||
// compute the frame count
|
// compute the frame count
|
||||||
size_t frameCount;
|
size_t frameCount;
|
||||||
if (audio_is_linear_pcm(format)) {
|
if (audio_has_proportional_frames(format)) {
|
||||||
const size_t bytesPerSample = audio_bytes_per_sample(format);
|
const size_t bytesPerSample = audio_bytes_per_sample(format);
|
||||||
frameCount = buffSizeInBytes / (channelCount * bytesPerSample);
|
frameCount = buffSizeInBytes / (channelCount * bytesPerSample);
|
||||||
} else {
|
} else {
|
||||||
@@ -1008,7 +1008,7 @@ static jint android_media_AudioTrack_get_min_buff_size(JNIEnv *env, jobject thi
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const audio_format_t format = audioFormatToNative(audioFormat);
|
const audio_format_t format = audioFormatToNative(audioFormat);
|
||||||
if (audio_is_linear_pcm(format)) {
|
if (audio_has_proportional_frames(format)) {
|
||||||
const size_t bytesPerSample = audio_bytes_per_sample(format);
|
const size_t bytesPerSample = audio_bytes_per_sample(format);
|
||||||
return frameCount * channelCount * bytesPerSample;
|
return frameCount * channelCount * bytesPerSample;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -885,10 +885,10 @@ public class AudioTrack implements AudioRouting
|
|||||||
// postcondition:
|
// postcondition:
|
||||||
// mNativeBufferSizeInBytes is valid (multiple of frame size, positive)
|
// mNativeBufferSizeInBytes is valid (multiple of frame size, positive)
|
||||||
private void audioBuffSizeCheck(int audioBufferSize) {
|
private void audioBuffSizeCheck(int audioBufferSize) {
|
||||||
// NB: this section is only valid with PCM data.
|
// NB: this section is only valid with PCM or IEC61937 data.
|
||||||
// To update when supporting compressed formats
|
// To update when supporting compressed formats
|
||||||
int frameSizeInBytes;
|
int frameSizeInBytes;
|
||||||
if (AudioFormat.isEncodingLinearPcm(mAudioFormat)) {
|
if (AudioFormat.isEncodingLinearFrames(mAudioFormat)) {
|
||||||
frameSizeInBytes = mChannelCount * AudioFormat.getBytesPerSample(mAudioFormat);
|
frameSizeInBytes = mChannelCount * AudioFormat.getBytesPerSample(mAudioFormat);
|
||||||
} else {
|
} else {
|
||||||
frameSizeInBytes = 1;
|
frameSizeInBytes = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user