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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // Get input buffer. | 512 // Get input buffer. |
513 int j_input_buffer_index = jni->CallIntMethod(*j_media_codec_video_decoder_, | 513 int j_input_buffer_index = jni->CallIntMethod(*j_media_codec_video_decoder_, |
514 j_dequeue_input_buffer_method_); | 514 j_dequeue_input_buffer_method_); |
515 if (CheckException(jni) || j_input_buffer_index < 0) { | 515 if (CheckException(jni) || j_input_buffer_index < 0) { |
516 ALOGE("dequeueInputBuffer error"); | 516 ALOGE("dequeueInputBuffer error"); |
517 return ProcessHWErrorOnCodecThread(); | 517 return ProcessHWErrorOnCodecThread(); |
518 } | 518 } |
519 | 519 |
520 // Copy encoded data to Java ByteBuffer. | 520 // Copy encoded data to Java ByteBuffer. |
521 jobject j_input_buffer = input_buffers_[j_input_buffer_index]; | 521 jobject j_input_buffer = input_buffers_[j_input_buffer_index]; |
522 uint8* buffer = | 522 uint8_t* buffer = |
523 reinterpret_cast<uint8*>(jni->GetDirectBufferAddress(j_input_buffer)); | 523 reinterpret_cast<uint8_t*>(jni->GetDirectBufferAddress(j_input_buffer)); |
524 RTC_CHECK(buffer) << "Indirect buffer??"; | 524 RTC_CHECK(buffer) << "Indirect buffer??"; |
525 int64 buffer_capacity = jni->GetDirectBufferCapacity(j_input_buffer); | 525 int64_t buffer_capacity = jni->GetDirectBufferCapacity(j_input_buffer); |
526 if (CheckException(jni) || buffer_capacity < inputImage._length) { | 526 if (CheckException(jni) || buffer_capacity < inputImage._length) { |
527 ALOGE("Input frame size %d is bigger than buffer size %d.", | 527 ALOGE("Input frame size %d is bigger than buffer size %d.", |
528 inputImage._length, buffer_capacity); | 528 inputImage._length, buffer_capacity); |
529 return ProcessHWErrorOnCodecThread(); | 529 return ProcessHWErrorOnCodecThread(); |
530 } | 530 } |
531 jlong timestamp_us = (frames_received_ * 1000000) / codec_.maxFramerate; | 531 jlong timestamp_us = (frames_received_ * 1000000) / codec_.maxFramerate; |
532 ALOGV("Decoder frame in # %d. Type: %d. Buffer # %d. TS: %lld. Size: %d", | 532 ALOGV("Decoder frame in # %d. Type: %d. Buffer # %d. TS: %lld. Size: %d", |
533 frames_received_, inputImage._frameType, j_input_buffer_index, | 533 frames_received_, inputImage._frameType, j_input_buffer_index, |
534 timestamp_us / 1000, inputImage._length); | 534 timestamp_us / 1000, inputImage._length); |
535 memcpy(buffer, inputImage._buffer, inputImage._length); | 535 memcpy(buffer, inputImage._buffer, inputImage._length); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 return NULL; | 840 return NULL; |
841 } | 841 } |
842 | 842 |
843 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( | 843 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( |
844 webrtc::VideoDecoder* decoder) { | 844 webrtc::VideoDecoder* decoder) { |
845 delete decoder; | 845 delete decoder; |
846 } | 846 } |
847 | 847 |
848 } // namespace webrtc_jni | 848 } // namespace webrtc_jni |
849 | 849 |
OLD | NEW |