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

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

Issue 2736603003: Android HW decoder: Don't check slice_height for texture output (Closed)
Patch Set: Created 3 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 if (IsNull(jni, j_decoder_output_buffer)) { 719 if (IsNull(jni, j_decoder_output_buffer)) {
720 // No decoded frame ready. 720 // No decoded frame ready.
721 return true; 721 return true;
722 } 722 }
723 723
724 // Get decoded video frame properties. 724 // Get decoded video frame properties.
725 int color_format = GetIntField(jni, *j_media_codec_video_decoder_, 725 int color_format = GetIntField(jni, *j_media_codec_video_decoder_,
726 j_color_format_field_); 726 j_color_format_field_);
727 int width = GetIntField(jni, *j_media_codec_video_decoder_, j_width_field_); 727 int width = GetIntField(jni, *j_media_codec_video_decoder_, j_width_field_);
728 int height = GetIntField(jni, *j_media_codec_video_decoder_, j_height_field_); 728 int height = GetIntField(jni, *j_media_codec_video_decoder_, j_height_field_);
729 int stride = GetIntField(jni, *j_media_codec_video_decoder_, j_stride_field_);
730 int slice_height = GetIntField(jni, *j_media_codec_video_decoder_,
731 j_slice_height_field_);
732 RTC_CHECK_GE(slice_height, height);
733 729
734 rtc::scoped_refptr<webrtc::VideoFrameBuffer> frame_buffer; 730 rtc::scoped_refptr<webrtc::VideoFrameBuffer> frame_buffer;
735 int64_t presentation_timestamps_ms = 0; 731 int64_t presentation_timestamps_ms = 0;
736 int64_t output_timestamps_ms = 0; 732 int64_t output_timestamps_ms = 0;
737 int64_t output_ntp_timestamps_ms = 0; 733 int64_t output_ntp_timestamps_ms = 0;
738 int decode_time_ms = 0; 734 int decode_time_ms = 0;
739 int64_t frame_delayed_ms = 0; 735 int64_t frame_delayed_ms = 0;
740 if (use_surface_) { 736 if (use_surface_) {
741 // Extract data from Java DecodedTextureBuffer. 737 // Extract data from Java DecodedTextureBuffer.
742 presentation_timestamps_ms = GetLongField( 738 presentation_timestamps_ms = GetLongField(
(...skipping 17 matching lines...) Expand all
760 756
761 // Create webrtc::VideoFrameBuffer with native texture handle. 757 // Create webrtc::VideoFrameBuffer with native texture handle.
762 frame_buffer = surface_texture_helper_->CreateTextureFrame( 758 frame_buffer = surface_texture_helper_->CreateTextureFrame(
763 width, height, NativeHandleImpl(jni, texture_id, j_transform_matrix)); 759 width, height, NativeHandleImpl(jni, texture_id, j_transform_matrix));
764 } else { 760 } else {
765 EnableFrameLogOnWarning(); 761 EnableFrameLogOnWarning();
766 } 762 }
767 } else { 763 } else {
768 // Extract data from Java ByteBuffer and create output yuv420 frame - 764 // Extract data from Java ByteBuffer and create output yuv420 frame -
769 // for non surface decoding only. 765 // for non surface decoding only.
766 int stride =
767 GetIntField(jni, *j_media_codec_video_decoder_, j_stride_field_);
768 const int slice_height =
769 GetIntField(jni, *j_media_codec_video_decoder_, j_slice_height_field_);
770 const int output_buffer_index = GetIntField( 770 const int output_buffer_index = GetIntField(
771 jni, j_decoder_output_buffer, j_info_index_field_); 771 jni, j_decoder_output_buffer, j_info_index_field_);
772 const int output_buffer_offset = GetIntField( 772 const int output_buffer_offset = GetIntField(
773 jni, j_decoder_output_buffer, j_info_offset_field_); 773 jni, j_decoder_output_buffer, j_info_offset_field_);
774 const int output_buffer_size = GetIntField( 774 const int output_buffer_size = GetIntField(
775 jni, j_decoder_output_buffer, j_info_size_field_); 775 jni, j_decoder_output_buffer, j_info_size_field_);
776 presentation_timestamps_ms = GetLongField( 776 presentation_timestamps_ms = GetLongField(
777 jni, j_decoder_output_buffer, j_presentation_timestamp_ms_field_); 777 jni, j_decoder_output_buffer, j_presentation_timestamp_ms_field_);
778 output_timestamps_ms = GetLongField( 778 output_timestamps_ms = GetLongField(
779 jni, j_decoder_output_buffer, j_timestamp_ms_field_); 779 jni, j_decoder_output_buffer, j_timestamp_ms_field_);
780 output_ntp_timestamps_ms = GetLongField( 780 output_ntp_timestamps_ms = GetLongField(
781 jni, j_decoder_output_buffer, j_ntp_timestamp_ms_field_); 781 jni, j_decoder_output_buffer, j_ntp_timestamp_ms_field_);
782 782
783 decode_time_ms = GetLongField(jni, j_decoder_output_buffer, 783 decode_time_ms = GetLongField(jni, j_decoder_output_buffer,
784 j_byte_buffer_decode_time_ms_field_); 784 j_byte_buffer_decode_time_ms_field_);
785 RTC_CHECK_GE(slice_height, height);
785 786
786 if (output_buffer_size < width * height * 3 / 2) { 787 if (output_buffer_size < width * height * 3 / 2) {
787 ALOGE << "Insufficient output buffer size: " << output_buffer_size; 788 ALOGE << "Insufficient output buffer size: " << output_buffer_size;
788 return false; 789 return false;
789 } 790 }
790 if (output_buffer_size < stride * height * 3 / 2 && 791 if (output_buffer_size < stride * height * 3 / 2 &&
791 slice_height == height && stride > width) { 792 slice_height == height && stride > width) {
792 // Some codecs (Exynos) incorrectly report stride information for 793 // Some codecs (Exynos) incorrectly report stride information for
793 // output byte buffer, so actual stride value need to be corrected. 794 // output byte buffer, so actual stride value need to be corrected.
794 stride = output_buffer_size * 2 / (height * 3); 795 stride = output_buffer_size * 2 / (height * 3);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 j_return_decoded_byte_buffer_method_, 864 j_return_decoded_byte_buffer_method_,
864 output_buffer_index); 865 output_buffer_index);
865 if (CheckException(jni)) { 866 if (CheckException(jni)) {
866 ALOGE << "returnDecodedOutputBuffer error"; 867 ALOGE << "returnDecodedOutputBuffer error";
867 return false; 868 return false;
868 } 869 }
869 } 870 }
870 if (frames_decoded_ < frames_decoded_logged_) { 871 if (frames_decoded_ < frames_decoded_logged_) {
871 ALOGD << "Decoder frame out # " << frames_decoded_ << 872 ALOGD << "Decoder frame out # " << frames_decoded_ <<
872 ". " << width << " x " << height << 873 ". " << width << " x " << height <<
873 ". " << stride << " x " << slice_height <<
sakal 2017/03/06 12:36:41 nit: Maybe add this log line back inside the else
874 ". Color: " << color_format << 874 ". Color: " << color_format <<
875 ". TS: " << presentation_timestamps_ms << 875 ". TS: " << presentation_timestamps_ms <<
876 ". DecTime: " << (int)decode_time_ms << 876 ". DecTime: " << (int)decode_time_ms <<
877 ". DelayTime: " << (int)frame_delayed_ms; 877 ". DelayTime: " << (int)frame_delayed_ms;
878 } 878 }
879 879
880 // Calculate and print decoding statistics - every 3 seconds. 880 // Calculate and print decoding statistics - every 3 seconds.
881 frames_decoded_++; 881 frames_decoded_++;
882 current_frames_++; 882 current_frames_++;
883 current_decoding_time_ms_ += decode_time_ms; 883 current_decoding_time_ms_ += decode_time_ms;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 webrtc::VideoDecoder* decoder) { 1026 webrtc::VideoDecoder* decoder) {
1027 ALOGD << "Destroy video decoder."; 1027 ALOGD << "Destroy video decoder.";
1028 delete decoder; 1028 delete decoder;
1029 } 1029 }
1030 1030
1031 const char* MediaCodecVideoDecoder::ImplementationName() const { 1031 const char* MediaCodecVideoDecoder::ImplementationName() const {
1032 return "MediaCodec"; 1032 return "MediaCodec";
1033 } 1033 }
1034 1034
1035 } // namespace webrtc_jni 1035 } // namespace webrtc_jni
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