| | |
| | | jmd_encode_yuv = env->GetMethodID(clazz,"encodeYUV","([B)V"); |
| | | jmd_encode_pcm = env->GetMethodID(clazz,"encodePCM","([B)V"); |
| | | jmd_get_sps_pps = env->GetMethodID(clazz,"getSpsPpsData","()[B"); |
| | | jmd_get_audio_seq = env->GetMethodID(clazz,"getAudioSeqData","()[B"); |
| | | } |
| | | |
| | | void MediaEncoderCall::encodeYUV(uint8_t* yuvBuffer, int width, int height) { |
| | |
| | | } |
| | | |
| | | void MediaEncoderCall::getSpsPps(uint8_t **data,int *length){ |
| | | getJvmBytes(jmd_get_sps_pps,data,length); |
| | | } |
| | | |
| | | void MediaEncoderCall::getAudioSeqData(uint8_t **data,int *length){ |
| | | getJvmBytes(jmd_get_audio_seq,data,length); |
| | | } |
| | | |
| | | void MediaEncoderCall::getJvmBytes(jmethodID method,uint8_t **data,int *length){ |
| | | JNIEnv *env_child; |
| | | javaVM->AttachCurrentThread(&env_child, 0); |
| | | jbyteArray bytes = reinterpret_cast<jbyteArray> (env_child->CallObjectMethod(instance, jmd_get_sps_pps)); |
| | | jbyteArray bytes = reinterpret_cast<jbyteArray> (env_child->CallObjectMethod(instance, method)); |
| | | if (!bytes) { |
| | | LOGE("Java returned null byte array"); |
| | | return; |