| OLD | NEW | 
|---|
| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 243 | 243 | 
| 244 MediaCodecVideoEncoder::~MediaCodecVideoEncoder() { | 244 MediaCodecVideoEncoder::~MediaCodecVideoEncoder() { | 
| 245   // Call Release() to ensure no more callbacks to us after we are deleted. | 245   // Call Release() to ensure no more callbacks to us after we are deleted. | 
| 246   Release(); | 246   Release(); | 
| 247 } | 247 } | 
| 248 | 248 | 
| 249 MediaCodecVideoEncoder::MediaCodecVideoEncoder( | 249 MediaCodecVideoEncoder::MediaCodecVideoEncoder( | 
| 250     JNIEnv* jni, VideoCodecType codecType, jobject egl_context) : | 250     JNIEnv* jni, VideoCodecType codecType, jobject egl_context) : | 
| 251     codecType_(codecType), | 251     codecType_(codecType), | 
| 252     callback_(NULL), | 252     callback_(NULL), | 
| 253     inited_(false), |  | 
| 254     use_surface_(false), |  | 
| 255     picture_id_(0), |  | 
| 256     codec_thread_(new Thread()), | 253     codec_thread_(new Thread()), | 
| 257     j_media_codec_video_encoder_class_( | 254     j_media_codec_video_encoder_class_( | 
| 258         jni, | 255         jni, | 
| 259         FindClass(jni, "org/webrtc/MediaCodecVideoEncoder")), | 256         FindClass(jni, "org/webrtc/MediaCodecVideoEncoder")), | 
| 260     j_media_codec_video_encoder_( | 257     j_media_codec_video_encoder_( | 
| 261         jni, | 258         jni, | 
| 262         jni->NewObject(*j_media_codec_video_encoder_class_, | 259         jni->NewObject(*j_media_codec_video_encoder_class_, | 
| 263                        GetMethodID(jni, | 260                        GetMethodID(jni, | 
| 264                                    *j_media_codec_video_encoder_class_, | 261                                    *j_media_codec_video_encoder_class_, | 
| 265                                    "<init>", | 262                                    "<init>", | 
| 266                                    "()V"))), | 263                                    "()V"))), | 
|  | 264     inited_(false), | 
|  | 265     use_surface_(false), | 
|  | 266     picture_id_(0), | 
| 267     egl_context_(egl_context) { | 267     egl_context_(egl_context) { | 
| 268   ScopedLocalRefFrame local_ref_frame(jni); | 268   ScopedLocalRefFrame local_ref_frame(jni); | 
| 269   // It would be nice to avoid spinning up a new thread per MediaCodec, and | 269   // It would be nice to avoid spinning up a new thread per MediaCodec, and | 
| 270   // instead re-use e.g. the PeerConnectionFactory's |worker_thread_|, but bug | 270   // instead re-use e.g. the PeerConnectionFactory's |worker_thread_|, but bug | 
| 271   // 2732 means that deadlocks abound.  This class synchronously trampolines | 271   // 2732 means that deadlocks abound.  This class synchronously trampolines | 
| 272   // to |codec_thread_|, so if anything else can be coming to _us_ from | 272   // to |codec_thread_|, so if anything else can be coming to _us_ from | 
| 273   // |codec_thread_|, or from any thread holding the |_sendCritSect| described | 273   // |codec_thread_|, or from any thread holding the |_sendCritSect| described | 
| 274   // in the bug, we have a problem.  For now work around that with a dedicated | 274   // in the bug, we have a problem.  For now work around that with a dedicated | 
| 275   // thread. | 275   // thread. | 
| 276   codec_thread_->SetName("MediaCodecVideoEncoder", NULL); | 276   codec_thread_->SetName("MediaCodecVideoEncoder", NULL); | 
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1169 } | 1169 } | 
| 1170 | 1170 | 
| 1171 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1171 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 
| 1172     webrtc::VideoEncoder* encoder) { | 1172     webrtc::VideoEncoder* encoder) { | 
| 1173   ALOGD << "Destroy video encoder."; | 1173   ALOGD << "Destroy video encoder."; | 
| 1174   delete encoder; | 1174   delete encoder; | 
| 1175 } | 1175 } | 
| 1176 | 1176 | 
| 1177 }  // namespace webrtc_jni | 1177 }  // namespace webrtc_jni | 
| 1178 | 1178 | 
| OLD | NEW | 
|---|