OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 "webrtc/rtc_base/logsinks.h" | 11 #include "webrtc/rtc_base/logsinks.h" |
12 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | 12 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
13 | 13 |
14 namespace webrtc_jni { | 14 namespace webrtc { |
| 15 namespace jni { |
15 | 16 |
16 JNI_FUNCTION_DECLARATION(jlong, | 17 JNI_FUNCTION_DECLARATION(jlong, |
17 CallSessionFileRotatingLogSink_nativeAddSink, | 18 CallSessionFileRotatingLogSink_nativeAddSink, |
18 JNIEnv* jni, | 19 JNIEnv* jni, |
19 jclass, | 20 jclass, |
20 jstring j_dirPath, | 21 jstring j_dirPath, |
21 jint j_maxFileSize, | 22 jint j_maxFileSize, |
22 jint j_severity) { | 23 jint j_severity) { |
23 std::string dir_path = JavaToStdString(jni, j_dirPath); | 24 std::string dir_path = JavaToStdString(jni, j_dirPath); |
24 rtc::CallSessionFileRotatingLogSink* sink = | 25 rtc::CallSessionFileRotatingLogSink* sink = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 size_t read = 0; | 70 size_t read = 0; |
70 std::unique_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); | 71 std::unique_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); |
71 stream->ReadAll(buffer.get(), log_size, &read, nullptr); | 72 stream->ReadAll(buffer.get(), log_size, &read, nullptr); |
72 | 73 |
73 jbyteArray result = jni->NewByteArray(read); | 74 jbyteArray result = jni->NewByteArray(read); |
74 jni->SetByteArrayRegion(result, 0, read, buffer.get()); | 75 jni->SetByteArrayRegion(result, 0, read, buffer.get()); |
75 | 76 |
76 return result; | 77 return result; |
77 } | 78 } |
78 | 79 |
79 } // namespace webrtc_jni | 80 } // namespace jni |
| 81 } // namespace webrtc |
OLD | NEW |