| 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 // Return output byte buffer back to codec. | 816 // Return output byte buffer back to codec. |
| 817 jni->CallVoidMethod( | 817 jni->CallVoidMethod( |
| 818 *j_media_codec_video_decoder_, | 818 *j_media_codec_video_decoder_, |
| 819 j_return_decoded_byte_buffer_method_, | 819 j_return_decoded_byte_buffer_method_, |
| 820 output_buffer_index); | 820 output_buffer_index); |
| 821 if (CheckException(jni)) { | 821 if (CheckException(jni)) { |
| 822 ALOGE << "returnDecodedOutputBuffer error"; | 822 ALOGE << "returnDecodedOutputBuffer error"; |
| 823 return false; | 823 return false; |
| 824 } | 824 } |
| 825 } | 825 } |
| 826 VideoFrame decoded_frame(frame_buffer, 0, 0, webrtc::kVideoRotation_0); | |
| 827 decoded_frame.set_timestamp(output_timestamps_ms); | |
| 828 decoded_frame.set_ntp_time_ms(output_ntp_timestamps_ms); | |
| 829 | |
| 830 if (frames_decoded_ < frames_decoded_logged_) { | 826 if (frames_decoded_ < frames_decoded_logged_) { |
| 831 ALOGD << "Decoder frame out # " << frames_decoded_ << | 827 ALOGD << "Decoder frame out # " << frames_decoded_ << |
| 832 ". " << width << " x " << height << | 828 ". " << width << " x " << height << |
| 833 ". " << stride << " x " << slice_height << | 829 ". " << stride << " x " << slice_height << |
| 834 ". Color: " << color_format << | 830 ". Color: " << color_format << |
| 835 ". TS: " << presentation_timestamps_ms << | 831 ". TS: " << presentation_timestamps_ms << |
| 836 ". DecTime: " << (int)decode_time_ms << | 832 ". DecTime: " << (int)decode_time_ms << |
| 837 ". DelayTime: " << (int)frame_delayed_ms; | 833 ". DelayTime: " << (int)frame_delayed_ms; |
| 838 } | 834 } |
| 839 | 835 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 855 ". DecTime: " << (current_decoding_time_ms_ / current_frames_) << | 851 ". DecTime: " << (current_decoding_time_ms_ / current_frames_) << |
| 856 ". DelayTime: " << (current_delay_time_ms_ / current_frames_) << | 852 ". DelayTime: " << (current_delay_time_ms_ / current_frames_) << |
| 857 " for last " << statistic_time_ms << " ms."; | 853 " for last " << statistic_time_ms << " ms."; |
| 858 start_time_ms_ = rtc::TimeMillis(); | 854 start_time_ms_ = rtc::TimeMillis(); |
| 859 current_frames_ = 0; | 855 current_frames_ = 0; |
| 860 current_bytes_ = 0; | 856 current_bytes_ = 0; |
| 861 current_decoding_time_ms_ = 0; | 857 current_decoding_time_ms_ = 0; |
| 862 current_delay_time_ms_ = 0; | 858 current_delay_time_ms_ = 0; |
| 863 } | 859 } |
| 864 | 860 |
| 865 // |.IsZeroSize())| returns true when a frame has been dropped. | 861 // If the frame was dropped, frame_buffer is left as nullptr. |
| 866 if (!decoded_frame.IsZeroSize()) { | 862 if (frame_buffer) { |
| 867 // Callback - output decoded frame. | 863 VideoFrame decoded_frame(frame_buffer, 0, 0, webrtc::kVideoRotation_0); |
| 864 decoded_frame.set_timestamp(output_timestamps_ms); |
| 865 decoded_frame.set_ntp_time_ms(output_ntp_timestamps_ms); |
| 866 |
| 868 const int32_t callback_status = | 867 const int32_t callback_status = |
| 869 callback_->Decoded(decoded_frame, decode_time_ms); | 868 callback_->Decoded(decoded_frame, decode_time_ms); |
| 870 if (callback_status > 0) { | 869 if (callback_status > 0) { |
| 871 ALOGE << "callback error"; | 870 ALOGE << "callback error"; |
| 872 } | 871 } |
| 873 } | 872 } |
| 874 return true; | 873 return true; |
| 875 } | 874 } |
| 876 | 875 |
| 877 int32_t MediaCodecVideoDecoder::RegisterDecodeCompleteCallback( | 876 int32_t MediaCodecVideoDecoder::RegisterDecodeCompleteCallback( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 webrtc::VideoDecoder* decoder) { | 983 webrtc::VideoDecoder* decoder) { |
| 985 ALOGD << "Destroy video decoder."; | 984 ALOGD << "Destroy video decoder."; |
| 986 delete decoder; | 985 delete decoder; |
| 987 } | 986 } |
| 988 | 987 |
| 989 const char* MediaCodecVideoDecoder::ImplementationName() const { | 988 const char* MediaCodecVideoDecoder::ImplementationName() const { |
| 990 return "MediaCodec"; | 989 return "MediaCodec"; |
| 991 } | 990 } |
| 992 | 991 |
| 993 } // namespace webrtc_jni | 992 } // namespace webrtc_jni |
| OLD | NEW |