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

Side by Side Diff: webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc

Issue 2979963002: Revert of Make the default ctor of rtc::Thread, protected (Closed)
Patch Set: Created 3 years, 5 months 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
« no previous file with comments | « webrtc/rtc_base/timeutils_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 using webrtc::VideoCodecType; 48 using webrtc::VideoCodecType;
49 using webrtc::kVideoCodecH264; 49 using webrtc::kVideoCodecH264;
50 using webrtc::kVideoCodecVP8; 50 using webrtc::kVideoCodecVP8;
51 using webrtc::kVideoCodecVP9; 51 using webrtc::kVideoCodecVP9;
52 52
53 namespace webrtc_jni { 53 namespace webrtc_jni {
54 54
55 // Logging macros. 55 // Logging macros.
56 #define TAG_DECODER "MediaCodecVideoDecoder" 56 #define TAG_DECODER "MediaCodecVideoDecoder"
57 #ifdef TRACK_BUFFER_TIMING 57 #ifdef TRACK_BUFFER_TIMING
58 #define ALOGV(...) \ 58 #define ALOGV(...)
59 __android_log_print(ANDROID_LOG_VERBOSE, TAG_DECODER, __VA_ARGS__) 59 __android_log_print(ANDROID_LOG_VERBOSE, TAG_DECODER, __VA_ARGS__)
60 #else 60 #else
61 #define ALOGV(...) 61 #define ALOGV(...)
62 #endif 62 #endif
63 #define ALOGD LOG_TAG(rtc::LS_INFO, TAG_DECODER) 63 #define ALOGD LOG_TAG(rtc::LS_INFO, TAG_DECODER)
64 #define ALOGW LOG_TAG(rtc::LS_WARNING, TAG_DECODER) 64 #define ALOGW LOG_TAG(rtc::LS_WARNING, TAG_DECODER)
65 #define ALOGE LOG_TAG(rtc::LS_ERROR, TAG_DECODER) 65 #define ALOGE LOG_TAG(rtc::LS_ERROR, TAG_DECODER)
66 66
67 enum { kMaxWarningLogFrames = 2 }; 67 enum { kMaxWarningLogFrames = 2 };
68 68
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 jfieldID j_info_size_field_; 173 jfieldID j_info_size_field_;
174 jfieldID j_presentation_timestamp_ms_field_; 174 jfieldID j_presentation_timestamp_ms_field_;
175 jfieldID j_timestamp_ms_field_; 175 jfieldID j_timestamp_ms_field_;
176 jfieldID j_ntp_timestamp_ms_field_; 176 jfieldID j_ntp_timestamp_ms_field_;
177 jfieldID j_byte_buffer_decode_time_ms_field_; 177 jfieldID j_byte_buffer_decode_time_ms_field_;
178 178
179 // Global references; must be deleted in Release(). 179 // Global references; must be deleted in Release().
180 std::vector<jobject> input_buffers_; 180 std::vector<jobject> input_buffers_;
181 }; 181 };
182 182
183 MediaCodecVideoDecoder::MediaCodecVideoDecoder(JNIEnv* jni, 183 MediaCodecVideoDecoder::MediaCodecVideoDecoder(
184 VideoCodecType codecType, 184 JNIEnv* jni, VideoCodecType codecType, jobject render_egl_context) :
185 jobject render_egl_context) 185 codecType_(codecType),
186 : codecType_(codecType), 186 render_egl_context_(render_egl_context),
187 render_egl_context_(render_egl_context), 187 key_frame_required_(true),
188 key_frame_required_(true), 188 inited_(false),
189 inited_(false), 189 sw_fallback_required_(false),
190 sw_fallback_required_(false), 190 codec_thread_(new Thread()),
191 codec_thread_(Thread::Create()), 191 j_media_codec_video_decoder_class_(
192 j_media_codec_video_decoder_class_( 192 jni,
193 jni, 193 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")),
194 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")), 194 j_media_codec_video_decoder_(
195 j_media_codec_video_decoder_( 195 jni,
196 jni, 196 jni->NewObject(*j_media_codec_video_decoder_class_,
197 jni->NewObject(*j_media_codec_video_decoder_class_, 197 GetMethodID(jni,
198 GetMethodID(jni, 198 *j_media_codec_video_decoder_class_,
199 *j_media_codec_video_decoder_class_, 199 "<init>",
200 "<init>", 200 "()V"))) {
201 "()V"))) {
202 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); 201 codec_thread_->SetName("MediaCodecVideoDecoder", NULL);
203 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; 202 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder";
204 203
205 j_init_decode_method_ = GetMethodID( 204 j_init_decode_method_ = GetMethodID(
206 jni, *j_media_codec_video_decoder_class_, "initDecode", 205 jni, *j_media_codec_video_decoder_class_, "initDecode",
207 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" 206 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;"
208 "IILorg/webrtc/SurfaceTextureHelper;)Z"); 207 "IILorg/webrtc/SurfaceTextureHelper;)Z");
209 j_reset_method_ = 208 j_reset_method_ =
210 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V"); 209 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V");
211 j_release_method_ = 210 j_release_method_ =
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 webrtc::VideoDecoder* decoder) { 1025 webrtc::VideoDecoder* decoder) {
1027 ALOGD << "Destroy video decoder."; 1026 ALOGD << "Destroy video decoder.";
1028 delete decoder; 1027 delete decoder;
1029 } 1028 }
1030 1029
1031 const char* MediaCodecVideoDecoder::ImplementationName() const { 1030 const char* MediaCodecVideoDecoder::ImplementationName() const {
1032 return "MediaCodec"; 1031 return "MediaCodec";
1033 } 1032 }
1034 1033
1035 } // namespace webrtc_jni 1034 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/rtc_base/timeutils_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698