| OLD | NEW |
| 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 RTC_CHECK_EQ(0, stride % 2); | 787 RTC_CHECK_EQ(0, stride % 2); |
| 788 RTC_CHECK_EQ(0, slice_height % 2); | 788 RTC_CHECK_EQ(0, slice_height % 2); |
| 789 const int uv_stride = stride / 2; | 789 const int uv_stride = stride / 2; |
| 790 const int u_slice_height = slice_height / 2; | 790 const int u_slice_height = slice_height / 2; |
| 791 const uint8_t* y_ptr = payload; | 791 const uint8_t* y_ptr = payload; |
| 792 const uint8_t* u_ptr = y_ptr + stride * slice_height; | 792 const uint8_t* u_ptr = y_ptr + stride * slice_height; |
| 793 const uint8_t* v_ptr = u_ptr + uv_stride * u_slice_height; | 793 const uint8_t* v_ptr = u_ptr + uv_stride * u_slice_height; |
| 794 libyuv::I420Copy(y_ptr, stride, | 794 libyuv::I420Copy(y_ptr, stride, |
| 795 u_ptr, uv_stride, | 795 u_ptr, uv_stride, |
| 796 v_ptr, uv_stride, | 796 v_ptr, uv_stride, |
| 797 frame_buffer->MutableData(webrtc::kYPlane), | 797 frame_buffer->MutableDataY(), |
| 798 frame_buffer->stride(webrtc::kYPlane), | 798 frame_buffer->StrideY(), |
| 799 frame_buffer->MutableData(webrtc::kUPlane), | 799 frame_buffer->MutableDataU(), |
| 800 frame_buffer->stride(webrtc::kUPlane), | 800 frame_buffer->StrideU(), |
| 801 frame_buffer->MutableData(webrtc::kVPlane), | 801 frame_buffer->MutableDataV(), |
| 802 frame_buffer->stride(webrtc::kVPlane), | 802 frame_buffer->StrideV(), |
| 803 width, height); | 803 width, height); |
| 804 } else { | 804 } else { |
| 805 // All other supported formats are nv12. | 805 // All other supported formats are nv12. |
| 806 const uint8_t* y_ptr = payload; | 806 const uint8_t* y_ptr = payload; |
| 807 const uint8_t* uv_ptr = y_ptr + stride * slice_height; | 807 const uint8_t* uv_ptr = y_ptr + stride * slice_height; |
| 808 libyuv::NV12ToI420( | 808 libyuv::NV12ToI420( |
| 809 y_ptr, stride, | 809 y_ptr, stride, |
| 810 uv_ptr, stride, | 810 uv_ptr, stride, |
| 811 frame_buffer->MutableData(webrtc::kYPlane), | 811 frame_buffer->MutableDataY(), |
| 812 frame_buffer->stride(webrtc::kYPlane), | 812 frame_buffer->StrideY(), |
| 813 frame_buffer->MutableData(webrtc::kUPlane), | 813 frame_buffer->MutableDataU(), |
| 814 frame_buffer->stride(webrtc::kUPlane), | 814 frame_buffer->StrideU(), |
| 815 frame_buffer->MutableData(webrtc::kVPlane), | 815 frame_buffer->MutableDataV(), |
| 816 frame_buffer->stride(webrtc::kVPlane), | 816 frame_buffer->StrideV(), |
| 817 width, height); | 817 width, height); |
| 818 } | 818 } |
| 819 // Return output byte buffer back to codec. | 819 // Return output byte buffer back to codec. |
| 820 jni->CallVoidMethod( | 820 jni->CallVoidMethod( |
| 821 *j_media_codec_video_decoder_, | 821 *j_media_codec_video_decoder_, |
| 822 j_return_decoded_byte_buffer_method_, | 822 j_return_decoded_byte_buffer_method_, |
| 823 output_buffer_index); | 823 output_buffer_index); |
| 824 if (CheckException(jni)) { | 824 if (CheckException(jni)) { |
| 825 ALOGE << "returnDecodedOutputBuffer error"; | 825 ALOGE << "returnDecodedOutputBuffer error"; |
| 826 return false; | 826 return false; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 webrtc::VideoDecoder* decoder) { | 986 webrtc::VideoDecoder* decoder) { |
| 987 ALOGD << "Destroy video decoder."; | 987 ALOGD << "Destroy video decoder."; |
| 988 delete decoder; | 988 delete decoder; |
| 989 } | 989 } |
| 990 | 990 |
| 991 const char* MediaCodecVideoDecoder::ImplementationName() const { | 991 const char* MediaCodecVideoDecoder::ImplementationName() const { |
| 992 return "MediaCodec"; | 992 return "MediaCodec"; |
| 993 } | 993 } |
| 994 | 994 |
| 995 } // namespace webrtc_jni | 995 } // namespace webrtc_jni |
| OLD | NEW |