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 |
11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <memory> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 // NOTICE: androidmediadecoder_jni.h must be included before | 15 // NOTICE: androidmediadecoder_jni.h must be included before |
15 // androidmediacodeccommon.h to avoid build errors. | 16 // androidmediacodeccommon.h to avoid build errors. |
16 #include "webrtc/api/java/jni/androidmediadecoder_jni.h" | 17 #include "webrtc/api/java/jni/androidmediadecoder_jni.h" |
17 | 18 |
18 #include "third_party/libyuv/include/libyuv/convert.h" | 19 #include "third_party/libyuv/include/libyuv/convert.h" |
19 #include "third_party/libyuv/include/libyuv/convert_from.h" | 20 #include "third_party/libyuv/include/libyuv/convert_from.h" |
20 #include "third_party/libyuv/include/libyuv/video_common.h" | 21 #include "third_party/libyuv/include/libyuv/video_common.h" |
21 #include "webrtc/api/java/jni/androidmediacodeccommon.h" | 22 #include "webrtc/api/java/jni/androidmediacodeccommon.h" |
22 #include "webrtc/api/java/jni/classreferenceholder.h" | 23 #include "webrtc/api/java/jni/classreferenceholder.h" |
23 #include "webrtc/api/java/jni/native_handle_impl.h" | 24 #include "webrtc/api/java/jni/native_handle_impl.h" |
24 #include "webrtc/api/java/jni/surfacetexturehelper_jni.h" | 25 #include "webrtc/api/java/jni/surfacetexturehelper_jni.h" |
25 #include "webrtc/base/bind.h" | 26 #include "webrtc/base/bind.h" |
26 #include "webrtc/base/checks.h" | 27 #include "webrtc/base/checks.h" |
27 #include "webrtc/base/logging.h" | 28 #include "webrtc/base/logging.h" |
28 #include "webrtc/base/scoped_ref_ptr.h" | 29 #include "webrtc/base/scoped_ref_ptr.h" |
29 #include "webrtc/base/thread.h" | 30 #include "webrtc/base/thread.h" |
30 #include "webrtc/base/timeutils.h" | 31 #include "webrtc/base/timeutils.h" |
31 #include "webrtc/common_video/include/i420_buffer_pool.h" | 32 #include "webrtc/common_video/include/i420_buffer_pool.h" |
32 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 33 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
33 #include "webrtc/system_wrappers/include/logcat_trace_context.h" | 34 #include "webrtc/system_wrappers/include/logcat_trace_context.h" |
34 #include "webrtc/system_wrappers/include/tick_util.h" | 35 #include "webrtc/system_wrappers/include/tick_util.h" |
35 | 36 |
36 using rtc::Bind; | 37 using rtc::Bind; |
37 using rtc::Thread; | 38 using rtc::Thread; |
38 using rtc::ThreadManager; | 39 using rtc::ThreadManager; |
39 using rtc::scoped_ptr; | |
40 | 40 |
41 using webrtc::CodecSpecificInfo; | 41 using webrtc::CodecSpecificInfo; |
42 using webrtc::DecodedImageCallback; | 42 using webrtc::DecodedImageCallback; |
43 using webrtc::EncodedImage; | 43 using webrtc::EncodedImage; |
44 using webrtc::VideoFrame; | 44 using webrtc::VideoFrame; |
45 using webrtc::RTPFragmentationHeader; | 45 using webrtc::RTPFragmentationHeader; |
46 using webrtc::TickTime; | 46 using webrtc::TickTime; |
47 using webrtc::VideoCodec; | 47 using webrtc::VideoCodec; |
48 using webrtc::VideoCodecType; | 48 using webrtc::VideoCodecType; |
49 using webrtc::kVideoCodecH264; | 49 using webrtc::kVideoCodecH264; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 int frames_decoded_logged_; | 130 int frames_decoded_logged_; |
131 int64_t start_time_ms_; // Start time for statistics. | 131 int64_t start_time_ms_; // Start time for statistics. |
132 int current_frames_; // Number of frames in the current statistics interval. | 132 int current_frames_; // Number of frames in the current statistics interval. |
133 int current_bytes_; // Encoded bytes in the current statistics interval. | 133 int current_bytes_; // Encoded bytes in the current statistics interval. |
134 int current_decoding_time_ms_; // Overall decoding time in the current second | 134 int current_decoding_time_ms_; // Overall decoding time in the current second |
135 int current_delay_time_ms_; // Overall delay time in the current second. | 135 int current_delay_time_ms_; // Overall delay time in the current second. |
136 uint32_t max_pending_frames_; // Maximum number of pending input frames. | 136 uint32_t max_pending_frames_; // Maximum number of pending input frames. |
137 | 137 |
138 // State that is constant for the lifetime of this object once the ctor | 138 // State that is constant for the lifetime of this object once the ctor |
139 // returns. | 139 // returns. |
140 scoped_ptr<Thread> codec_thread_; // Thread on which to operate MediaCodec. | 140 std::unique_ptr<Thread> |
| 141 codec_thread_; // Thread on which to operate MediaCodec. |
141 ScopedGlobalRef<jclass> j_media_codec_video_decoder_class_; | 142 ScopedGlobalRef<jclass> j_media_codec_video_decoder_class_; |
142 ScopedGlobalRef<jobject> j_media_codec_video_decoder_; | 143 ScopedGlobalRef<jobject> j_media_codec_video_decoder_; |
143 jmethodID j_init_decode_method_; | 144 jmethodID j_init_decode_method_; |
144 jmethodID j_reset_method_; | 145 jmethodID j_reset_method_; |
145 jmethodID j_release_method_; | 146 jmethodID j_release_method_; |
146 jmethodID j_dequeue_input_buffer_method_; | 147 jmethodID j_dequeue_input_buffer_method_; |
147 jmethodID j_queue_input_buffer_method_; | 148 jmethodID j_queue_input_buffer_method_; |
148 jmethodID j_dequeue_byte_buffer_method_; | 149 jmethodID j_dequeue_byte_buffer_method_; |
149 jmethodID j_dequeue_texture_buffer_method_; | 150 jmethodID j_dequeue_texture_buffer_method_; |
150 jmethodID j_return_decoded_byte_buffer_method_; | 151 jmethodID j_return_decoded_byte_buffer_method_; |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 ALOGD << "Destroy video decoder."; | 982 ALOGD << "Destroy video decoder."; |
982 delete decoder; | 983 delete decoder; |
983 } | 984 } |
984 | 985 |
985 const char* MediaCodecVideoDecoder::ImplementationName() const { | 986 const char* MediaCodecVideoDecoder::ImplementationName() const { |
986 return "MediaCodec"; | 987 return "MediaCodec"; |
987 } | 988 } |
988 | 989 |
989 } // namespace webrtc_jni | 990 } // namespace webrtc_jni |
990 | 991 |
OLD | NEW |