nRet = media_format_create(&hFormat);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_create API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_create API failed = %s \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
g_bIsMediaCodecValidHandle = false;
return;
}
nRet = media_format_set_audio_mime(hFormat, MEDIA_FORMAT_PCM);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_set_audio_mime API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_set_audio_mime API failed = %s\\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
return;
}
nRet = media_format_set_audio_samplerate(hFormat, 48000);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_set_audio_samplerate API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_set_audio_samplerate API failed = %s\\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
return;
}
nRet = media_format_set_audio_channel(hFormat, 2);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_set_audio_channel API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_set_audio_channel API failed = %s \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
return;
}
nRet = media_format_set_audio_bit(hFormat, 16);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_set_audio_bit API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_set_audio_bit API failed = %s\\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
return;
}
nRet = media_format_set_audio_avg_bps(hFormat,128000);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_set_audio_avg_bps API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_set_audio_avg_bps API failed = %s\\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
return;
}
nRet = media_packet_create_alloc(hFormat, NULL, NULL, &hInputBuff);
if (nRet != MEDIA_FORMAT_ERROR_NONE)
{
- FPRINTF("[Line : %d][%s] media_format_set_audio_alloc API failed \\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
+ FPRINTF("[Line : %d][%s] media_format_set_audio_alloc API failed = %s\\n", __LINE__, API_NAMESPACE, MediaCodecGetError(nRet));
return;
}
}
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0;
+ int i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
//Target API
int flags;
bool bEncoder = false; // checking encoder type
int nType = 0;
+ int i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
//Target API
- nRet = mediacodec_set_adec_info(g_mediacodec, 48000, 2, 16);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_adec_info(g_mediacodec, 48000, 2, bit_depth[i]);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_adec_info", MediaCodecGetError(nRet));
return 0;
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0;
+ int i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
//Target API
- nRet = mediacodec_set_aenc_info(g_mediacodec, 100, 64, 32, 0);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
return 0;
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0;
+ int i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
nRet = mediacodec_prepare(g_mediacodec);
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0, i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
nRet = mediacodec_set_output_buffer_available_cb(g_mediacodec, mediacodec_get_output_cb_p, NULL);
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0, i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
//Target API
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0, i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
//Target API
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0;
+ int bit_depth[] = { 16, 32 };
+ int i;
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
//Target API
int flags;
bool bEncoder = true; // checking encoder type
int nType = 0, i = 0;
+ int bit_depth[] = { 16, 32 };
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
//Target API
bool bEncoder = true; // checking encoder type
int nType = 0;
media_packet_pool_h hpacket_pool;
- int nsamplerate =48000;
- int nchannel =2;
- int nbit =16;
- int nbitrate = 128000;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
int nRet = mediacodec_get_supported_type(g_mediacodec, codec, bEncoder, &nType);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_get_supported_type", MediaCodecGetError(nRet));
nRet = mediacodec_set_codec(g_mediacodec, codec, flags);
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_codec", MediaCodecGetError(nRet));
- nRet = mediacodec_set_aenc_info(g_mediacodec, nsamplerate, nchannel, nbit, nbitrate);
+ for (i = 0; i < 2; i++) {
+ nRet = mediacodec_set_aenc_info(g_mediacodec, 48000, 2, bit_depth[i], 128000);
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_set_aenc_info", MediaCodecGetError(nRet));
nRet = mediacodec_prepare(g_mediacodec);
int nRet = 0;
media_format_h audioDecoderformat = NULL;
media_format_h videoDecoderformat = NULL;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
nRet = media_format_create(&audioDecoderformat);
PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_create", MediaCodecGetError(nRet));
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_mime", MediaCodecGetError(nRet), media_format_unref(audioDecoderformat));
nRet = media_format_set_audio_channel(audioDecoderformat, 2);
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_channel", MediaCodecGetError(nRet), media_format_unref(audioDecoderformat));
- nRet = media_format_set_audio_bit(audioDecoderformat, 16);
- PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_bit", MediaCodecGetError(nRet), media_format_unref(audioDecoderformat));
nRet = media_format_set_audio_samplerate(audioDecoderformat, 48000);
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_samplerate", MediaCodecGetError(nRet), media_format_unref(audioDecoderformat));
- nRet = mediacodec_configure_from_media_format(g_mediacodec, audioDecoderformat, (MEDIACODEC_DECODER | MEDIACODEC_SUPPORT_TYPE_SW));
+ for (i = 0; i < 2; i++) {
+ nRet = media_format_set_audio_bit(audioDecoderformat, bit_depth[i]);
+ PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_bit", MediaCodecGetError(nRet), media_format_unref(audioDecoderformat));
+ nRet = mediacodec_configure_from_media_format(g_mediacodec, audioDecoderformat, (MEDIACODEC_DECODER | MEDIACODEC_SUPPORT_TYPE_SW));
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT_CLEANUP(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_configure_from_media_format", MediaCodecGetError(nRet), media_format_unref(audioDecoderformat));
nRet = media_format_unref(audioDecoderformat);
int nRet = 0;
media_format_h audioEncoderformat = NULL;
media_format_h videoEncoderformat = NULL;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
nRet = media_format_create(&audioEncoderformat);
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_create", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_samplerate", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
nRet = media_format_set_audio_channel(audioEncoderformat, 2);
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_channel", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
- nRet = media_format_set_audio_bit(audioEncoderformat, 16);
- PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_bit", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
nRet = media_format_set_audio_avg_bps(audioEncoderformat,128000);
PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_avg_bps", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
- nRet = mediacodec_configure_from_media_format(g_mediacodec, audioEncoderformat, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
+ for (i = 0; i < 2; i++) {
+ nRet = media_format_set_audio_bit(audioEncoderformat, bit_depth[i]);
+ PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_bit", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
+ nRet = mediacodec_configure_from_media_format(g_mediacodec, audioEncoderformat, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
+ if (nRet == MEDIACODEC_ERROR_NONE)
+ break;
+ }
PRINT_RESULT_CLEANUP(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_configure_from_media_format", MediaCodecGetError(nRet), media_format_unref(audioEncoderformat));
nRet = media_format_unref(audioEncoderformat);
if ((buffer[0] == 0xff) && ((buffer[1] & 0xf6) == 0xf0)) {
readsize = ((buffer[3] & 0x03) << 11) | (buffer[4] << 3) | ((buffer[5] & 0xe0) >> 5);
result = fread(buffer + hader_size, 1,(readsize - hader_size), fd);
+ if (result != (readsize - hader_size))
+ return 0;
memcpy(aacdata, buffer, readsize);
} else {
readsize = 0;
static bool _mediacodec_empty_buffer_cb(media_packet_h pkt, void *user_data)
{
+ int ret = 0;
_emptybufferCB_called = true;
if (!_use_pool)
media_packet_destroy(pkt);
- else
- media_packet_pool_release_packet(pool, pkt);
+ else {
+ ret = media_packet_pool_release_packet(pool, pkt);
+ if (ret != MEDIA_PACKET_ERROR_NONE) {
+ fprintf(stderr, "media_packet_pool_release_packet failed");
+ return false;
+ }
+ }
return true;
}
int size_of_path = 0;
size_of_path = strlen(pszValue) + strlen(vdec_file) + 6;
vdec_path = (char*)malloc(size_of_path);
+
+ if (!vdec_path) {
+ _is_broken = true;
+ return;
+ }
snprintf(vdec_path, size_of_path, "%s/res/%s", pszValue, vdec_file);
size_of_path = strlen(pszValue) + strlen(venc_file) + 6;
venc_path = (char*)malloc(size_of_path);
+
+ if (!venc_path) {
+ _is_broken = true;
+ return;
+ }
snprintf(venc_path, size_of_path, "%s/res/%s", pszValue, venc_file);
size_of_path = strlen(pszValue) + strlen(aenc_file) + 6;
aenc_path = (char*)malloc(size_of_path);
+
+ if (!aenc_path) {
+ _is_broken = true;
+ return;
+ }
snprintf(aenc_path, size_of_path, "%s/res/%s", pszValue, aenc_file);
size_of_path = strlen(pszValue) + strlen(adec_file) + 6;
adec_path = (char*)malloc(size_of_path);
+ if (!adec_path) {
+ _is_broken = true;
+ return;
+ }
+
snprintf(adec_path, size_of_path, "%s/res/%s", pszValue, adec_file);
}
else
void utc_media_mediacodec_cleanup(void)
{
int i;
+ int ret;
if (aenc_fmt)
media_format_unref(aenc_fmt);
}
if (_use_pool) {
- media_packet_pool_deallocate(pool);
- media_packet_pool_destroy(pool);
+ ret = media_packet_pool_deallocate(pool);
+ if (ret != MEDIA_PACKET_ERROR_NONE) {
+ _is_broken = true;
+ fprintf(stderr, "media_packet_pool_deallocate failed");
+ return;
+ }
+ ret = media_packet_pool_destroy(pool);
+ if (ret != MEDIA_PACKET_ERROR_NONE) {
+ _is_broken = true;
+ fprintf(stderr, "media_packet_pool_deallocate failed");
+ return;
+ }
_use_pool = FALSE;
}
if (fp_vdec) {
+ if (vdec_path)
+ free(vdec_path);
fclose(fp_vdec);
fp_vdec = NULL;
}
if (fp_venc) {
+ if (venc_path)
+ free(venc_path);
fclose(fp_venc);
fp_venc = NULL;
}
if (fp_aenc) {
+ if (aenc_path)
+ free(aenc_path);
fclose(fp_aenc);
fp_aenc = NULL;
}
if (fp_adec) {
+ if (adec_path)
+ free(adec_path);
fclose(fp_adec);
fp_adec = NULL;
}
int ret = MEDIACODEC_ERROR_NONE;
if (!_mediacodec_supported) {
- ret = mediacodec_set_venc_info(g_media_codec, 640, 480, 30, 1000000);
+ ret = mediacodec_set_venc_info(g_media_codec, 352, 288, 30, 10000);
assert_eq(ret, MEDIACODEC_ERROR_NOT_SUPPORTED_ON_DEVICE);
return 0;
}
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_H263, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_venc_info(g_media_codec, 640, 480, 30, 1000000);
+ ret = mediacodec_set_venc_info(g_media_codec, 352, 288, 30, 10000);
assert_eq(ret, MEDIACODEC_ERROR_NONE);
return 0;
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
return 0;
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_set_adec_info(g_media_codec, 48000, 2, 16);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_DECODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_adec_info(g_media_codec, 48000, 2, 16);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_adec_info(g_media_codec, 48000, 2, bit_depth[i]);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
return 0;
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_prepare(g_media_codec);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
ret = mediacodec_prepare(g_media_codec);
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_prepare(NULL);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
ret = mediacodec_prepare(NULL);
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_unprepare(g_media_codec);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
ret = mediacodec_prepare(g_media_codec);
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_unprepare(NULL);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
ret = mediacodec_prepare(g_media_codec);
void *data = NULL;
void *input_data = NULL;
unsigned int data_size = 0;
- int i;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_get_output(g_media_codec, NULL, NULL);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
mediacodec_set_input_buffer_used_cb(g_media_codec,
void *data = NULL;
void *input_data = NULL;
unsigned int data_size = 0;
- int i;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_get_output(NULL, NULL, NULL);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
mediacodec_set_input_buffer_used_cb(g_media_codec,
void *data = NULL;
void *input_data = NULL;
unsigned int data_size = 0;
- int i;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_flush_buffers(g_media_codec);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_DECODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_adec_info(g_media_codec, 48000, 2, 16);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_adec_info(g_media_codec, 48000, 2, bit_depth[i]);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
mediacodec_set_input_buffer_used_cb(g_media_codec,
{
assert(!_is_broken);
int ret = MEDIACODEC_ERROR_NONE;
+ int bit_depth[] = { 16, 32 };
+ int i = 0;
if (!_mediacodec_supported) {
ret = mediacodec_flush_buffers(NULL);
ret = mediacodec_set_codec(g_media_codec, MEDIACODEC_AAC, (MEDIACODEC_ENCODER | MEDIACODEC_SUPPORT_TYPE_SW));
assert_eq(ret, MEDIACODEC_ERROR_NONE);
- ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, 16, 128000);
+ for (i = 0; i < 2; i++) {
+ ret = mediacodec_set_aenc_info(g_media_codec, 48000, 2, bit_depth[i], 128000);
+ if (ret == MEDIACODEC_ERROR_NONE)
+ break;
+ }
assert_eq(ret, MEDIACODEC_ERROR_NONE);
ret = mediacodec_prepare(g_media_codec);