| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 |
| (...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 } | 2349 } |
| 2350 | 2350 |
| 2351 JOW(void, CallSessionFileRotatingLogSink_nativeDeleteSink)( | 2351 JOW(void, CallSessionFileRotatingLogSink_nativeDeleteSink)( |
| 2352 JNIEnv* jni, jclass, jlong j_sink) { | 2352 JNIEnv* jni, jclass, jlong j_sink) { |
| 2353 rtc::CallSessionFileRotatingLogSink* sink = | 2353 rtc::CallSessionFileRotatingLogSink* sink = |
| 2354 reinterpret_cast<rtc::CallSessionFileRotatingLogSink*>(j_sink); | 2354 reinterpret_cast<rtc::CallSessionFileRotatingLogSink*>(j_sink); |
| 2355 rtc::LogMessage::RemoveLogToStream(sink); | 2355 rtc::LogMessage::RemoveLogToStream(sink); |
| 2356 delete sink; | 2356 delete sink; |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 JOW(jbyteArray, CallSessionFileRotatingLogSink_nativeGetLogData)( | |
| 2360 JNIEnv* jni, jclass, jstring j_dirPath) { | |
| 2361 std::string dir_path = JavaToStdString(jni, j_dirPath); | |
| 2362 std::unique_ptr<rtc::CallSessionFileRotatingStream> stream( | |
| 2363 new rtc::CallSessionFileRotatingStream(dir_path)); | |
| 2364 if (!stream->Open()) { | |
| 2365 LOG_V(rtc::LoggingSeverity::LS_WARNING) << | |
| 2366 "Failed to open CallSessionFileRotatingStream for path " << dir_path; | |
| 2367 return jni->NewByteArray(0); | |
| 2368 } | |
| 2369 size_t log_size = 0; | |
| 2370 if (!stream->GetSize(&log_size) || log_size == 0) { | |
| 2371 LOG_V(rtc::LoggingSeverity::LS_WARNING) << | |
| 2372 "CallSessionFileRotatingStream returns 0 size for path " << dir_path; | |
| 2373 return jni->NewByteArray(0); | |
| 2374 } | |
| 2375 | |
| 2376 size_t read = 0; | |
| 2377 std::unique_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); | |
| 2378 stream->ReadAll(buffer.get(), log_size, &read, nullptr); | |
| 2379 | |
| 2380 jbyteArray result = jni->NewByteArray(read); | |
| 2381 jni->SetByteArrayRegion(result, 0, read, buffer.get()); | |
| 2382 | |
| 2383 return result; | |
| 2384 } | |
| 2385 | |
| 2386 JOW(jboolean, RtpSender_nativeSetTrack)(JNIEnv* jni, | 2359 JOW(jboolean, RtpSender_nativeSetTrack)(JNIEnv* jni, |
| 2387 jclass, | 2360 jclass, |
| 2388 jlong j_rtp_sender_pointer, | 2361 jlong j_rtp_sender_pointer, |
| 2389 jlong j_track_pointer) { | 2362 jlong j_track_pointer) { |
| 2390 return reinterpret_cast<RtpSenderInterface*>(j_rtp_sender_pointer) | 2363 return reinterpret_cast<RtpSenderInterface*>(j_rtp_sender_pointer) |
| 2391 ->SetTrack(reinterpret_cast<MediaStreamTrackInterface*>(j_track_pointer)); | 2364 ->SetTrack(reinterpret_cast<MediaStreamTrackInterface*>(j_track_pointer)); |
| 2392 } | 2365 } |
| 2393 | 2366 |
| 2394 JOW(jlong, RtpSender_nativeGetTrack) | 2367 JOW(jlong, RtpSender_nativeGetTrack) |
| 2395 (JNIEnv* jni, jclass, jlong j_rtp_sender_pointer) { | 2368 (JNIEnv* jni, jclass, jlong j_rtp_sender_pointer) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 return reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer) | 2690 return reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer) |
| 2718 ->inter_tone_gap(); | 2691 ->inter_tone_gap(); |
| 2719 } | 2692 } |
| 2720 | 2693 |
| 2721 JOW(void, DtmfSender_free) | 2694 JOW(void, DtmfSender_free) |
| 2722 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { | 2695 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
| 2723 reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)->Release(); | 2696 reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)->Release(); |
| 2724 } | 2697 } |
| 2725 | 2698 |
| 2726 } // namespace webrtc_jni | 2699 } // namespace webrtc_jni |
| OLD | NEW |