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

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: Changed VideoRendererGui to return an EglBase.Context. 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/EglBase$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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 jni->DeleteGlobalRef(egl_context_); 1116 jni->DeleteGlobalRef(egl_context_);
1117 egl_context_ = NULL; 1117 egl_context_ = NULL;
1118 } 1118 }
1119 if (!IsNull(jni, render_egl_context)) { 1119 if (!IsNull(jni, render_egl_context)) {
1120 egl_context_ = jni->NewGlobalRef(render_egl_context); 1120 egl_context_ = jni->NewGlobalRef(render_egl_context);
1121 if (CheckException(jni)) { 1121 if (CheckException(jni)) {
1122 ALOGE << "error calling NewGlobalRef for EGL Context."; 1122 ALOGE << "error calling NewGlobalRef for EGL Context.";
1123 egl_context_ = NULL; 1123 egl_context_ = NULL;
1124 } else { 1124 } else {
1125 jclass j_egl_context_class = 1125 jclass j_egl_context_class =
1126 FindClass(jni, "javax/microedition/khronos/egl/EGLContext"); 1126 FindClass(jni, "org/webrtc/EglBase$Context");
1127 if (!jni->IsInstanceOf(egl_context_, j_egl_context_class)) { 1127 if (!jni->IsInstanceOf(egl_context_, j_egl_context_class)) {
1128 ALOGE << "Wrong EGL Context."; 1128 ALOGE << "Wrong EGL Context.";
1129 jni->DeleteGlobalRef(egl_context_); 1129 jni->DeleteGlobalRef(egl_context_);
1130 egl_context_ = NULL; 1130 egl_context_ = NULL;
1131 } 1131 }
1132 } 1132 }
1133 } 1133 }
1134 if (egl_context_ == NULL) { 1134 if (egl_context_ == NULL) {
1135 ALOGW << "NULL VideoDecoder EGL context - HW surface encoding is disabled."; 1135 ALOGW << "NULL VideoDecoder EGL context - HW surface encoding is disabled.";
1136 } 1136 }
(...skipping 24 matching lines...) Expand all
1161 } 1161 }
1162 1162
1163 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1163 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1164 webrtc::VideoEncoder* encoder) { 1164 webrtc::VideoEncoder* encoder) {
1165 ALOGD << "Destroy video encoder."; 1165 ALOGD << "Destroy video encoder.";
1166 delete encoder; 1166 delete encoder;
1167 } 1167 }
1168 1168
1169 } // namespace webrtc_jni 1169 } // namespace webrtc_jni
1170 1170
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/androidmediadecoder_jni.cc ('k') | talk/app/webrtc/java/jni/classreferenceholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698