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

Side by Side Diff: webrtc/api/java/jni/androidmediadecoder_jni.cc

Issue 1767733002: Fix incorrect stride information reported by some HW decoders. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 9 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 | « no previous file | 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 output_ntp_timestamps_ms = GetLongField( 703 output_ntp_timestamps_ms = GetLongField(
704 jni, j_decoder_output_buffer, j_ntp_timestamp_ms_field_); 704 jni, j_decoder_output_buffer, j_ntp_timestamp_ms_field_);
705 705
706 decode_time_ms = GetLongField(jni, j_decoder_output_buffer, 706 decode_time_ms = GetLongField(jni, j_decoder_output_buffer,
707 j_byte_buffer_decode_time_ms_field_); 707 j_byte_buffer_decode_time_ms_field_);
708 708
709 if (output_buffer_size < width * height * 3 / 2) { 709 if (output_buffer_size < width * height * 3 / 2) {
710 ALOGE << "Insufficient output buffer size: " << output_buffer_size; 710 ALOGE << "Insufficient output buffer size: " << output_buffer_size;
711 return false; 711 return false;
712 } 712 }
713 if (output_buffer_size < stride * height * 3 / 2 &&
714 slice_height == height && stride > width) {
715 // Some codecs (Exynos) incorrectly report stride information for
716 // output byte buffer, so actual stride value need to be corrected.
717 stride = output_buffer_size * 2 / (height * 3);
718 }
713 jobjectArray output_buffers = reinterpret_cast<jobjectArray>(GetObjectField( 719 jobjectArray output_buffers = reinterpret_cast<jobjectArray>(GetObjectField(
714 jni, *j_media_codec_video_decoder_, j_output_buffers_field_)); 720 jni, *j_media_codec_video_decoder_, j_output_buffers_field_));
715 jobject output_buffer = 721 jobject output_buffer =
716 jni->GetObjectArrayElement(output_buffers, output_buffer_index); 722 jni->GetObjectArrayElement(output_buffers, output_buffer_index);
717 uint8_t* payload = reinterpret_cast<uint8_t*>(jni->GetDirectBufferAddress( 723 uint8_t* payload = reinterpret_cast<uint8_t*>(jni->GetDirectBufferAddress(
718 output_buffer)); 724 output_buffer));
719 if (CheckException(jni)) { 725 if (CheckException(jni)) {
720 return false; 726 return false;
721 } 727 }
722 payload += output_buffer_offset; 728 payload += output_buffer_offset;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 ALOGD << "Destroy video decoder."; 934 ALOGD << "Destroy video decoder.";
929 delete decoder; 935 delete decoder;
930 } 936 }
931 937
932 const char* MediaCodecVideoDecoder::ImplementationName() const { 938 const char* MediaCodecVideoDecoder::ImplementationName() const {
933 return "MediaCodec"; 939 return "MediaCodec";
934 } 940 }
935 941
936 } // namespace webrtc_jni 942 } // namespace webrtc_jni
937 943
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698