Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: talk/app/webrtc/java/jni/androidmediaencoder_jni.cc

Issue 1461083002: Use EGL14 if supported on Android (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed tests Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 codec_thread_->SetName("MediaCodecVideoEncoder", NULL); 271 codec_thread_->SetName("MediaCodecVideoEncoder", NULL);
272 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoEncoder"; 272 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoEncoder";
273 codec_thread_checker_.DetachFromThread(); 273 codec_thread_checker_.DetachFromThread();
274 jclass j_output_buffer_info_class = 274 jclass j_output_buffer_info_class =
275 FindClass(jni, "org/webrtc/MediaCodecVideoEncoder$OutputBufferInfo"); 275 FindClass(jni, "org/webrtc/MediaCodecVideoEncoder$OutputBufferInfo");
276 j_init_encode_method_ = GetMethodID( 276 j_init_encode_method_ = GetMethodID(
277 jni, 277 jni,
278 *j_media_codec_video_encoder_class_, 278 *j_media_codec_video_encoder_class_,
279 "initEncode", 279 "initEncode",
280 "(Lorg/webrtc/MediaCodecVideoEncoder$VideoCodecType;" 280 "(Lorg/webrtc/MediaCodecVideoEncoder$VideoCodecType;"
281 "IIIILjavax/microedition/khronos/egl/EGLContext;)Z"); 281 "IIIILorg/webrtc/Egl$Context;)Z");
282 j_get_input_buffers_method_ = GetMethodID( 282 j_get_input_buffers_method_ = GetMethodID(
283 jni, 283 jni,
284 *j_media_codec_video_encoder_class_, 284 *j_media_codec_video_encoder_class_,
285 "getInputBuffers", 285 "getInputBuffers",
286 "()[Ljava/nio/ByteBuffer;"); 286 "()[Ljava/nio/ByteBuffer;");
287 j_dequeue_input_buffer_method_ = GetMethodID( 287 j_dequeue_input_buffer_method_ = GetMethodID(
288 jni, *j_media_codec_video_encoder_class_, "dequeueInputBuffer", "()I"); 288 jni, *j_media_codec_video_encoder_class_, "dequeueInputBuffer", "()I");
289 j_encode_buffer_method_ = GetMethodID( 289 j_encode_buffer_method_ = GetMethodID(
290 jni, *j_media_codec_video_encoder_class_, "encodeBuffer", "(ZIIJ)Z"); 290 jni, *j_media_codec_video_encoder_class_, "encodeBuffer", "(ZIIJ)Z");
291 j_encode_texture_method_ = GetMethodID( 291 j_encode_texture_method_ = GetMethodID(
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 jni->DeleteGlobalRef(egl_context_); 1101 jni->DeleteGlobalRef(egl_context_);
1102 egl_context_ = NULL; 1102 egl_context_ = NULL;
1103 } 1103 }
1104 if (!IsNull(jni, render_egl_context)) { 1104 if (!IsNull(jni, render_egl_context)) {
1105 egl_context_ = jni->NewGlobalRef(render_egl_context); 1105 egl_context_ = jni->NewGlobalRef(render_egl_context);
1106 if (CheckException(jni)) { 1106 if (CheckException(jni)) {
1107 ALOGE << "error calling NewGlobalRef for EGL Context."; 1107 ALOGE << "error calling NewGlobalRef for EGL Context.";
1108 egl_context_ = NULL; 1108 egl_context_ = NULL;
1109 } else { 1109 } else {
1110 jclass j_egl_context_class = 1110 jclass j_egl_context_class =
1111 FindClass(jni, "javax/microedition/khronos/egl/EGLContext"); 1111 FindClass(jni, "org/webrtc/Egl$Context");
1112 if (!jni->IsInstanceOf(egl_context_, j_egl_context_class)) { 1112 if (!jni->IsInstanceOf(egl_context_, j_egl_context_class)) {
1113 ALOGE << "Wrong EGL Context."; 1113 ALOGE << "Wrong EGL Context.";
1114 jni->DeleteGlobalRef(egl_context_); 1114 jni->DeleteGlobalRef(egl_context_);
1115 egl_context_ = NULL; 1115 egl_context_ = NULL;
1116 } 1116 }
1117 } 1117 }
1118 } 1118 }
1119 if (egl_context_ == NULL) { 1119 if (egl_context_ == NULL) {
1120 ALOGW << "NULL VideoDecoder EGL context - HW surface encoding is disabled."; 1120 ALOGW << "NULL VideoDecoder EGL context - HW surface encoding is disabled.";
1121 } 1121 }
(...skipping 24 matching lines...) Expand all
1146 } 1146 }
1147 1147
1148 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1148 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1149 webrtc::VideoEncoder* encoder) { 1149 webrtc::VideoEncoder* encoder) {
1150 ALOGD << "Destroy video encoder."; 1150 ALOGD << "Destroy video encoder.";
1151 delete encoder; 1151 delete encoder;
1152 } 1152 }
1153 1153
1154 } // namespace webrtc_jni 1154 } // namespace webrtc_jni
1155 1155
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698