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 #ifndef WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ | 11 #ifndef WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ |
12 #define WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ | 12 #define WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ |
13 | 13 |
14 #include <android/log.h> | 14 #include <android/log.h> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "webrtc/base/thread.h" | 17 #include "webrtc/base/thread.h" |
18 #include "webrtc/api/java/jni/classreferenceholder.h" | 18 #include "webrtc/api/java/jni/classreferenceholder.h" |
19 #include "webrtc/api/java/jni/jni_helpers.h" | 19 #include "webrtc/api/java/jni/jni_helpers.h" |
20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
21 #include "webrtc/base/thread.h" | 21 #include "webrtc/base/thread.h" |
22 #include "webrtc/system_wrappers/include/tick_util.h" | |
23 | 22 |
24 namespace webrtc_jni { | 23 namespace webrtc_jni { |
25 | 24 |
26 // Uncomment this define to enable verbose logging for every encoded/decoded | 25 // Uncomment this define to enable verbose logging for every encoded/decoded |
27 // video frame. | 26 // video frame. |
28 //#define TRACK_BUFFER_TIMING | 27 //#define TRACK_BUFFER_TIMING |
29 | 28 |
30 #define TAG_COMMON "MediaCodecVideo" | 29 #define TAG_COMMON "MediaCodecVideo" |
31 | 30 |
32 // Color formats supported by encoder - should mirror supportedColorList | 31 // Color formats supported by encoder - should mirror supportedColorList |
(...skipping 19 matching lines...) Expand all Loading... |
52 enum { kMaxPendingFramesVp8 = 1 }; | 51 enum { kMaxPendingFramesVp8 = 1 }; |
53 // Maximum amount of pending frames for VP9 decoder. | 52 // Maximum amount of pending frames for VP9 decoder. |
54 enum { kMaxPendingFramesVp9 = 1 }; | 53 enum { kMaxPendingFramesVp9 = 1 }; |
55 // Maximum amount of pending frames for H.264 decoder. | 54 // Maximum amount of pending frames for H.264 decoder. |
56 enum { kMaxPendingFramesH264 = 8 }; | 55 enum { kMaxPendingFramesH264 = 8 }; |
57 // Maximum amount of decoded frames for which per-frame logging is enabled. | 56 // Maximum amount of decoded frames for which per-frame logging is enabled. |
58 enum { kMaxDecodedLogFrames = 10 }; | 57 enum { kMaxDecodedLogFrames = 10 }; |
59 // Maximum amount of encoded frames for which per-frame logging is enabled. | 58 // Maximum amount of encoded frames for which per-frame logging is enabled. |
60 enum { kMaxEncodedLogFrames = 10 }; | 59 enum { kMaxEncodedLogFrames = 10 }; |
61 | 60 |
62 static inline int64_t GetCurrentTimeMs() { | |
63 return webrtc::TickTime::Now().Ticks() / 1000000LL; | |
64 } | |
65 | |
66 static inline void AllowBlockingCalls() { | 61 static inline void AllowBlockingCalls() { |
67 rtc::Thread* current_thread = rtc::Thread::Current(); | 62 rtc::Thread* current_thread = rtc::Thread::Current(); |
68 if (current_thread != NULL) | 63 if (current_thread != NULL) |
69 current_thread->SetAllowBlockingCalls(true); | 64 current_thread->SetAllowBlockingCalls(true); |
70 } | 65 } |
71 | 66 |
72 // Return the (singleton) Java Enum object corresponding to |index|; | 67 // Return the (singleton) Java Enum object corresponding to |index|; |
73 // |state_class_fragment| is something like "MediaSource$State". | 68 // |state_class_fragment| is something like "MediaSource$State". |
74 static inline jobject JavaEnumFromIndexAndClassName( | 69 static inline jobject JavaEnumFromIndexAndClassName( |
75 JNIEnv* jni, const std::string& state_class_fragment, int index) { | 70 JNIEnv* jni, const std::string& state_class_fragment, int index) { |
(...skipping 10 matching lines...) Expand all Loading... |
86 jni->ExceptionDescribe(); | 81 jni->ExceptionDescribe(); |
87 jni->ExceptionClear(); | 82 jni->ExceptionClear(); |
88 return true; | 83 return true; |
89 } | 84 } |
90 return false; | 85 return false; |
91 } | 86 } |
92 | 87 |
93 } // namespace webrtc_jni | 88 } // namespace webrtc_jni |
94 | 89 |
95 #endif // WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ | 90 #endif // WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ |
OLD | NEW |