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

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

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 class MediaCodecVideoDecoder : public webrtc::VideoDecoder, 67 class MediaCodecVideoDecoder : public webrtc::VideoDecoder,
68 public rtc::MessageHandler { 68 public rtc::MessageHandler {
69 public: 69 public:
70 explicit MediaCodecVideoDecoder( 70 explicit MediaCodecVideoDecoder(
71 JNIEnv* jni, VideoCodecType codecType, jobject render_egl_context); 71 JNIEnv* jni, VideoCodecType codecType, jobject render_egl_context);
72 virtual ~MediaCodecVideoDecoder(); 72 virtual ~MediaCodecVideoDecoder();
73 73
74 int32_t InitDecode(const VideoCodec* codecSettings, int32_t numberOfCores) 74 int32_t InitDecode(const VideoCodec* codecSettings, int32_t numberOfCores)
75 override; 75 override;
76 76
77 int32_t Decode( 77 int32_t Decode(const EncodedImage& inputImage,
78 const EncodedImage& inputImage, bool missingFrames, 78 bool missingFrames,
79 const RTPFragmentationHeader* fragmentation, 79 const RTPFragmentationHeader* fragmentation,
80 const CodecSpecificInfo* codecSpecificInfo = NULL, 80 const CodecSpecificInfo* codecSpecificInfo = nullptr,
81 int64_t renderTimeMs = -1) override; 81 int64_t renderTimeMs = -1) override;
82 82
83 int32_t RegisterDecodeCompleteCallback(DecodedImageCallback* callback) 83 int32_t RegisterDecodeCompleteCallback(DecodedImageCallback* callback)
84 override; 84 override;
85 85
86 int32_t Release() override; 86 int32_t Release() override;
87 87
88 bool PrefersLateDecoding() const override { return true; } 88 bool PrefersLateDecoding() const override { return true; }
89 89
90 // rtc::MessageHandler implementation. 90 // rtc::MessageHandler implementation.
91 void OnMessage(rtc::Message* msg) override; 91 void OnMessage(rtc::Message* msg) override;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 jni, 188 jni,
189 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")), 189 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")),
190 j_media_codec_video_decoder_( 190 j_media_codec_video_decoder_(
191 jni, 191 jni,
192 jni->NewObject(*j_media_codec_video_decoder_class_, 192 jni->NewObject(*j_media_codec_video_decoder_class_,
193 GetMethodID(jni, 193 GetMethodID(jni,
194 *j_media_codec_video_decoder_class_, 194 *j_media_codec_video_decoder_class_,
195 "<init>", 195 "<init>",
196 "()V"))) { 196 "()V"))) {
197 ScopedLocalRefFrame local_ref_frame(jni); 197 ScopedLocalRefFrame local_ref_frame(jni);
198 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); 198 codec_thread_->SetName("MediaCodecVideoDecoder", nullptr);
199 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; 199 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder";
200 200
201 j_init_decode_method_ = GetMethodID( 201 j_init_decode_method_ = GetMethodID(
202 jni, *j_media_codec_video_decoder_class_, "initDecode", 202 jni, *j_media_codec_video_decoder_class_, "initDecode",
203 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" 203 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;"
204 "IILorg/webrtc/SurfaceTextureHelper;)Z"); 204 "IILorg/webrtc/SurfaceTextureHelper;)Z");
205 j_reset_method_ = 205 j_reset_method_ =
206 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V"); 206 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V");
207 j_release_method_ = 207 j_release_method_ =
208 GetMethodID(jni, *j_media_codec_video_decoder_class_, "release", "()V"); 208 GetMethodID(jni, *j_media_codec_video_decoder_class_, "release", "()V");
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 j_presentation_timestamp_ms_field_ = GetFieldID( 265 j_presentation_timestamp_ms_field_ = GetFieldID(
266 jni, j_decoded_output_buffer_class, "presentationTimeStampMs", "J"); 266 jni, j_decoded_output_buffer_class, "presentationTimeStampMs", "J");
267 j_timestamp_ms_field_ = GetFieldID( 267 j_timestamp_ms_field_ = GetFieldID(
268 jni, j_decoded_output_buffer_class, "timeStampMs", "J"); 268 jni, j_decoded_output_buffer_class, "timeStampMs", "J");
269 j_ntp_timestamp_ms_field_ = GetFieldID( 269 j_ntp_timestamp_ms_field_ = GetFieldID(
270 jni, j_decoded_output_buffer_class, "ntpTimeStampMs", "J"); 270 jni, j_decoded_output_buffer_class, "ntpTimeStampMs", "J");
271 j_byte_buffer_decode_time_ms_field_ = GetFieldID( 271 j_byte_buffer_decode_time_ms_field_ = GetFieldID(
272 jni, j_decoded_output_buffer_class, "decodeTimeMs", "J"); 272 jni, j_decoded_output_buffer_class, "decodeTimeMs", "J");
273 273
274 CHECK_EXCEPTION(jni) << "MediaCodecVideoDecoder ctor failed"; 274 CHECK_EXCEPTION(jni) << "MediaCodecVideoDecoder ctor failed";
275 use_surface_ = (render_egl_context_ != NULL); 275 use_surface_ = (render_egl_context_ != nullptr);
276 ALOGD << "MediaCodecVideoDecoder ctor. Use surface: " << use_surface_; 276 ALOGD << "MediaCodecVideoDecoder ctor. Use surface: " << use_surface_;
277 memset(&codec_, 0, sizeof(codec_)); 277 memset(&codec_, 0, sizeof(codec_));
278 AllowBlockingCalls(); 278 AllowBlockingCalls();
279 } 279 }
280 280
281 MediaCodecVideoDecoder::~MediaCodecVideoDecoder() { 281 MediaCodecVideoDecoder::~MediaCodecVideoDecoder() {
282 // Call Release() to ensure no more callbacks to us after we are deleted. 282 // Call Release() to ensure no more callbacks to us after we are deleted.
283 Release(); 283 Release();
284 } 284 }
285 285
286 int32_t MediaCodecVideoDecoder::InitDecode(const VideoCodec* inst, 286 int32_t MediaCodecVideoDecoder::InitDecode(const VideoCodec* inst,
287 int32_t numberOfCores) { 287 int32_t numberOfCores) {
288 ALOGD << "InitDecode."; 288 ALOGD << "InitDecode.";
289 if (inst == NULL) { 289 if (inst == nullptr) {
290 ALOGE << "NULL VideoCodec instance"; 290 ALOGE << "null VideoCodec instance";
291 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 291 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
292 } 292 }
293 // Factory should guard against other codecs being used with us. 293 // Factory should guard against other codecs being used with us.
294 RTC_CHECK(inst->codecType == codecType_) 294 RTC_CHECK(inst->codecType == codecType_)
295 << "Unsupported codec " << inst->codecType << " for " << codecType_; 295 << "Unsupported codec " << inst->codecType << " for " << codecType_;
296 296
297 if (sw_fallback_required_) { 297 if (sw_fallback_required_) {
298 ALOGE << "InitDecode() - fallback to SW decoder"; 298 ALOGE << "InitDecode() - fallback to SW decoder";
299 return WEBRTC_VIDEO_CODEC_OK; 299 return WEBRTC_VIDEO_CODEC_OK;
300 } 300 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 int32_t MediaCodecVideoDecoder::Decode( 507 int32_t MediaCodecVideoDecoder::Decode(
508 const EncodedImage& inputImage, 508 const EncodedImage& inputImage,
509 bool missingFrames, 509 bool missingFrames,
510 const RTPFragmentationHeader* fragmentation, 510 const RTPFragmentationHeader* fragmentation,
511 const CodecSpecificInfo* codecSpecificInfo, 511 const CodecSpecificInfo* codecSpecificInfo,
512 int64_t renderTimeMs) { 512 int64_t renderTimeMs) {
513 if (sw_fallback_required_) { 513 if (sw_fallback_required_) {
514 ALOGE << "Decode() - fallback to SW codec"; 514 ALOGE << "Decode() - fallback to SW codec";
515 return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; 515 return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
516 } 516 }
517 if (callback_ == NULL) { 517 if (callback_ == nullptr) {
518 ALOGE << "Decode() - callback_ is NULL"; 518 ALOGE << "Decode() - callback_ is null";
519 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; 519 return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
520 } 520 }
521 if (inputImage._buffer == NULL && inputImage._length > 0) { 521 if (inputImage._buffer == nullptr && inputImage._length > 0) {
522 ALOGE << "Decode() - inputImage is incorrect"; 522 ALOGE << "Decode() - inputImage is incorrect";
523 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 523 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
524 } 524 }
525 if (!inited_) { 525 if (!inited_) {
526 ALOGE << "Decode() - decoder is not initialized"; 526 ALOGE << "Decode() - decoder is not initialized";
527 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; 527 return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
528 } 528 }
529 529
530 // Check if encoded frame dimension has changed. 530 // Check if encoded frame dimension has changed.
531 if ((inputImage._encodedWidth * inputImage._encodedHeight > 0) && 531 if ((inputImage._encodedWidth * inputImage._encodedHeight > 0) &&
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 webrtc::VideoDecoder* decoder) { 980 webrtc::VideoDecoder* decoder) {
981 ALOGD << "Destroy video decoder."; 981 ALOGD << "Destroy video decoder.";
982 delete decoder; 982 delete decoder;
983 } 983 }
984 984
985 const char* MediaCodecVideoDecoder::ImplementationName() const { 985 const char* MediaCodecVideoDecoder::ImplementationName() const {
986 return "MediaCodec"; 986 return "MediaCodec";
987 } 987 }
988 988
989 } // namespace webrtc_jni 989 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698