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

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

Issue 2977953002: Partial Reland of Make the default ctor of rtc::Thread, protected (Closed)
Patch Set: Fix the same error elsewhere 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( 183 MediaCodecVideoDecoder::MediaCodecVideoDecoder(JNIEnv* jni,
184 JNIEnv* jni, VideoCodecType codecType, jobject render_egl_context) : 184 VideoCodecType codecType,
185 codecType_(codecType), 185 jobject render_egl_context)
186 render_egl_context_(render_egl_context), 186 : codecType_(codecType),
187 key_frame_required_(true), 187 render_egl_context_(render_egl_context),
188 inited_(false), 188 key_frame_required_(true),
189 sw_fallback_required_(false), 189 inited_(false),
190 codec_thread_(new Thread()), 190 sw_fallback_required_(false),
191 j_media_codec_video_decoder_class_( 191 codec_thread_(Thread::Create()),
192 jni, 192 j_media_codec_video_decoder_class_(
193 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")), 193 jni,
194 j_media_codec_video_decoder_( 194 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")),
195 jni, 195 j_media_codec_video_decoder_(
196 jni->NewObject(*j_media_codec_video_decoder_class_, 196 jni,
197 GetMethodID(jni, 197 jni->NewObject(*j_media_codec_video_decoder_class_,
198 *j_media_codec_video_decoder_class_, 198 GetMethodID(jni,
199 "<init>", 199 *j_media_codec_video_decoder_class_,
200 "()V"))) { 200 "<init>",
201 "()V"))) {
201 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); 202 codec_thread_->SetName("MediaCodecVideoDecoder", NULL);
202 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; 203 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder";
203 204
204 j_init_decode_method_ = GetMethodID( 205 j_init_decode_method_ = GetMethodID(
205 jni, *j_media_codec_video_decoder_class_, "initDecode", 206 jni, *j_media_codec_video_decoder_class_, "initDecode",
206 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" 207 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;"
207 "IILorg/webrtc/SurfaceTextureHelper;)Z"); 208 "IILorg/webrtc/SurfaceTextureHelper;)Z");
208 j_reset_method_ = 209 j_reset_method_ =
209 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V"); 210 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V");
210 j_release_method_ = 211 j_release_method_ =
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 webrtc::VideoDecoder* decoder) { 1026 webrtc::VideoDecoder* decoder) {
1026 ALOGD << "Destroy video decoder."; 1027 ALOGD << "Destroy video decoder.";
1027 delete decoder; 1028 delete decoder;
1028 } 1029 }
1029 1030
1030 const char* MediaCodecVideoDecoder::ImplementationName() const { 1031 const char* MediaCodecVideoDecoder::ImplementationName() const {
1031 return "MediaCodec"; 1032 return "MediaCodec";
1032 } 1033 }
1033 1034
1034 } // namespace webrtc_jni 1035 } // 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