OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 14 matching lines...) Expand all Loading... |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 * | 26 * |
27 */ | 27 */ |
28 | 28 |
29 #ifndef TALK_APP_WEBRTC_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ | 29 #ifndef TALK_APP_WEBRTC_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ |
30 #define TALK_APP_WEBRTC_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ | 30 #define TALK_APP_WEBRTC_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ |
31 | 31 |
32 #include <android/log.h> | 32 #include <android/log.h> |
33 #include "talk/app/webrtc/java/jni/classreferenceholder.h" | 33 #include "talk/app/webrtc/java/jni/classreferenceholder.h" |
34 #include "webrtc/base/thread.h" | 34 #include "webrtc/base/thread.h" |
| 35 #include "webrtc/base/logging.h" |
35 #include "webrtc/system_wrappers/interface/tick_util.h" | 36 #include "webrtc/system_wrappers/interface/tick_util.h" |
36 | 37 |
37 namespace webrtc_jni { | 38 namespace webrtc_jni { |
38 | 39 |
39 // Uncomment this define to enable verbose logging for every encoded/decoded | 40 // Uncomment this define to enable verbose logging for every encoded/decoded |
40 // video frame. | 41 // video frame. |
41 //#define TRACK_BUFFER_TIMING | 42 //#define TRACK_BUFFER_TIMING |
42 | 43 |
43 #define TAG "MediaCodecVideo" | 44 #define TAG "MediaCodecVideo" |
44 #ifdef TRACK_BUFFER_TIMING | 45 #ifdef TRACK_BUFFER_TIMING |
45 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) | 46 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) |
46 #else | 47 #else |
47 #define ALOGV(...) | 48 #define ALOGV(...) |
48 #endif | 49 #endif |
49 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) | 50 #define ALOGD LOG_TAG(rtc::LS_INFO, TAG) |
50 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) | 51 #define ALOGW LOG_TAG(rtc::LS_WARNING, TAG) |
51 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) | 52 #define ALOGE LOG_TAG(rtc::LS_ERROR, TAG) |
52 | 53 |
53 // Color formats supported by encoder - should mirror supportedColorList | 54 // Color formats supported by encoder - should mirror supportedColorList |
54 // from MediaCodecVideoEncoder.java | 55 // from MediaCodecVideoEncoder.java |
55 enum COLOR_FORMATTYPE { | 56 enum COLOR_FORMATTYPE { |
56 COLOR_FormatYUV420Planar = 0x13, | 57 COLOR_FormatYUV420Planar = 0x13, |
57 COLOR_FormatYUV420SemiPlanar = 0x15, | 58 COLOR_FormatYUV420SemiPlanar = 0x15, |
58 COLOR_QCOM_FormatYUV420SemiPlanar = 0x7FA30C00, | 59 COLOR_QCOM_FormatYUV420SemiPlanar = 0x7FA30C00, |
59 // NV12 color format supported by QCOM codec, but not declared in MediaCodec - | 60 // NV12 color format supported by QCOM codec, but not declared in MediaCodec - |
60 // see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h | 61 // see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h |
61 // This format is presumably similar to COLOR_FormatYUV420SemiPlanar, | 62 // This format is presumably similar to COLOR_FormatYUV420SemiPlanar, |
(...skipping 28 matching lines...) Expand all Loading... |
90 JNIEnv* jni, const std::string& state_class_fragment, int index) { | 91 JNIEnv* jni, const std::string& state_class_fragment, int index) { |
91 const std::string state_class = "org/webrtc/" + state_class_fragment; | 92 const std::string state_class = "org/webrtc/" + state_class_fragment; |
92 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), | 93 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), |
93 state_class, index); | 94 state_class, index); |
94 } | 95 } |
95 | 96 |
96 // Checks for any Java exception, prints stack backtrace and clears | 97 // Checks for any Java exception, prints stack backtrace and clears |
97 // currently thrown exception. | 98 // currently thrown exception. |
98 static inline bool CheckException(JNIEnv* jni) { | 99 static inline bool CheckException(JNIEnv* jni) { |
99 if (jni->ExceptionCheck()) { | 100 if (jni->ExceptionCheck()) { |
100 ALOGE("Java JNI exception."); | 101 ALOGE << "Java JNI exception."; |
101 jni->ExceptionDescribe(); | 102 jni->ExceptionDescribe(); |
102 jni->ExceptionClear(); | 103 jni->ExceptionClear(); |
103 return true; | 104 return true; |
104 } | 105 } |
105 return false; | 106 return false; |
106 } | 107 } |
107 | 108 |
108 } // namespace webrtc_jni | 109 } // namespace webrtc_jni |
109 | 110 |
110 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ | 111 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_ |
OLD | NEW |