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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // Get input buffer. | 505 // Get input buffer. |
506 int j_input_buffer_index = jni->CallIntMethod(*j_media_codec_video_decoder_, | 506 int j_input_buffer_index = jni->CallIntMethod(*j_media_codec_video_decoder_, |
507 j_dequeue_input_buffer_method_); | 507 j_dequeue_input_buffer_method_); |
508 if (CheckException(jni) || j_input_buffer_index < 0) { | 508 if (CheckException(jni) || j_input_buffer_index < 0) { |
509 ALOGE("dequeueInputBuffer error"); | 509 ALOGE("dequeueInputBuffer error"); |
510 return ProcessHWErrorOnCodecThread(); | 510 return ProcessHWErrorOnCodecThread(); |
511 } | 511 } |
512 | 512 |
513 // Copy encoded data to Java ByteBuffer. | 513 // Copy encoded data to Java ByteBuffer. |
514 jobject j_input_buffer = input_buffers_[j_input_buffer_index]; | 514 jobject j_input_buffer = input_buffers_[j_input_buffer_index]; |
515 uint8* buffer = | 515 uint8_t* buffer = |
516 reinterpret_cast<uint8*>(jni->GetDirectBufferAddress(j_input_buffer)); | 516 reinterpret_cast<uint8_t*>(jni->GetDirectBufferAddress(j_input_buffer)); |
517 RTC_CHECK(buffer) << "Indirect buffer??"; | 517 RTC_CHECK(buffer) << "Indirect buffer??"; |
518 int64 buffer_capacity = jni->GetDirectBufferCapacity(j_input_buffer); | 518 int64_t buffer_capacity = jni->GetDirectBufferCapacity(j_input_buffer); |
519 if (CheckException(jni) || buffer_capacity < inputImage._length) { | 519 if (CheckException(jni) || buffer_capacity < inputImage._length) { |
520 ALOGE("Input frame size %d is bigger than buffer size %d.", | 520 ALOGE("Input frame size %d is bigger than buffer size %d.", |
521 inputImage._length, buffer_capacity); | 521 inputImage._length, buffer_capacity); |
522 return ProcessHWErrorOnCodecThread(); | 522 return ProcessHWErrorOnCodecThread(); |
523 } | 523 } |
524 jlong timestamp_us = (frames_received_ * 1000000) / codec_.maxFramerate; | 524 jlong timestamp_us = (frames_received_ * 1000000) / codec_.maxFramerate; |
525 ALOGV("Decoder frame in # %d. Type: %d. Buffer # %d. TS: %lld. Size: %d", | 525 ALOGV("Decoder frame in # %d. Type: %d. Buffer # %d. TS: %lld. Size: %d", |
526 frames_received_, inputImage._frameType, j_input_buffer_index, | 526 frames_received_, inputImage._frameType, j_input_buffer_index, |
527 timestamp_us / 1000, inputImage._length); | 527 timestamp_us / 1000, inputImage._length); |
528 memcpy(buffer, inputImage._buffer, inputImage._length); | 528 memcpy(buffer, inputImage._buffer, inputImage._length); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 return NULL; | 826 return NULL; |
827 } | 827 } |
828 | 828 |
829 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( | 829 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( |
830 webrtc::VideoDecoder* decoder) { | 830 webrtc::VideoDecoder* decoder) { |
831 delete decoder; | 831 delete decoder; |
832 } | 832 } |
833 | 833 |
834 } // namespace webrtc_jni | 834 } // namespace webrtc_jni |
835 | 835 |
OLD | NEW |