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

Side by Side Diff: webrtc/api/android/jni/androidmediacodeccommon.h

Issue 2547483003: Move /webrtc/api/android files to /webrtc/sdk/android (Closed)
Patch Set: Move to api folder under Android instead of src Created 4 years 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_
12 #define WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_
13
14 #include <android/log.h>
15 #include <string>
16
17 #include "webrtc/base/thread.h"
18 #include "webrtc/api/android/jni/classreferenceholder.h"
19 #include "webrtc/api/android/jni/jni_helpers.h"
20 #include "webrtc/base/logging.h"
21 #include "webrtc/base/thread.h"
22
23 namespace webrtc_jni {
24
25 // Uncomment this define to enable verbose logging for every encoded/decoded
26 // video frame.
27 //#define TRACK_BUFFER_TIMING
28
29 #define TAG_COMMON "MediaCodecVideo"
30
31 // Color formats supported by encoder or decoder - should include all
32 // colors from supportedColorList in MediaCodecVideoEncoder.java and
33 // MediaCodecVideoDecoder.java. Supported color format set in encoder
34 // and decoder could be different.
35 enum COLOR_FORMATTYPE {
36 COLOR_FormatYUV420Planar = 0x13,
37 COLOR_FormatYUV420SemiPlanar = 0x15,
38 COLOR_QCOM_FormatYUV420SemiPlanar = 0x7FA30C00,
39 // NV12 color format supported by QCOM codec, but not declared in MediaCodec -
40 // see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h
41 // This format is presumably similar to COLOR_FormatYUV420SemiPlanar,
42 // but requires some (16, 32?) byte alignment.
43 COLOR_QCOM_FORMATYVU420PackedSemiPlanar32m4ka = 0x7FA30C01,
44 COLOR_QCOM_FORMATYVU420PackedSemiPlanar16m4ka = 0x7FA30C02,
45 COLOR_QCOM_FORMATYVU420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03,
46 COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m = 0x7FA30C04
47 };
48
49 // Arbitrary interval to poll the codec for new outputs.
50 enum { kMediaCodecPollMs = 10 };
51 // Arbitrary interval to poll at when there should be no more frames.
52 enum { kMediaCodecPollNoFramesMs = 100 };
53 // Media codec maximum output buffer ready timeout.
54 enum { kMediaCodecTimeoutMs = 1000 };
55 // Interval to print codec statistics (bitrate, fps, encoding/decoding time).
56 enum { kMediaCodecStatisticsIntervalMs = 3000 };
57 // Maximum amount of pending frames for VP8 decoder.
58 enum { kMaxPendingFramesVp8 = 1 };
59 // Maximum amount of pending frames for VP9 decoder.
60 enum { kMaxPendingFramesVp9 = 1 };
61 // Maximum amount of pending frames for H.264 decoder.
62 enum { kMaxPendingFramesH264 = 4 };
63 // Maximum amount of decoded frames for which per-frame logging is enabled.
64 enum { kMaxDecodedLogFrames = 10 };
65 // Maximum amount of encoded frames for which per-frame logging is enabled.
66 enum { kMaxEncodedLogFrames = 10 };
67
68 static inline void AllowBlockingCalls() {
69 rtc::Thread* current_thread = rtc::Thread::Current();
70 if (current_thread != NULL)
71 current_thread->SetAllowBlockingCalls(true);
72 }
73
74 // Return the (singleton) Java Enum object corresponding to |index|;
75 // |state_class_fragment| is something like "MediaSource$State".
76 static inline jobject JavaEnumFromIndexAndClassName(
77 JNIEnv* jni, const std::string& state_class_fragment, int index) {
78 const std::string state_class = "org/webrtc/" + state_class_fragment;
79 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()),
80 state_class, index);
81 }
82
83 // Checks for any Java exception, prints stack backtrace and clears
84 // currently thrown exception.
85 static inline bool CheckException(JNIEnv* jni) {
86 if (jni->ExceptionCheck()) {
87 LOG_TAG(rtc::LS_ERROR, TAG_COMMON) << "Java JNI exception.";
88 jni->ExceptionDescribe();
89 jni->ExceptionClear();
90 return true;
91 }
92 return false;
93 }
94
95 } // namespace webrtc_jni
96
97 #endif // WEBRTC_API_JAVA_JNI_ANDROIDMEDIACODECCOMMON_H_
OLDNEW
« no previous file with comments | « webrtc/api/android/jni/androidhistogram_jni.cc ('k') | webrtc/api/android/jni/androidmediadecoder_jni.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698