OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "talk/app/webrtc/peerconnectioninterface.h" | 65 #include "talk/app/webrtc/peerconnectioninterface.h" |
66 #include "talk/app/webrtc/videosourceinterface.h" | 66 #include "talk/app/webrtc/videosourceinterface.h" |
67 #include "talk/media/base/videocapturer.h" | 67 #include "talk/media/base/videocapturer.h" |
68 #include "talk/media/base/videorenderer.h" | 68 #include "talk/media/base/videorenderer.h" |
69 #include "talk/media/devices/videorendererfactory.h" | 69 #include "talk/media/devices/videorendererfactory.h" |
70 #include "talk/media/webrtc/webrtcvideodecoderfactory.h" | 70 #include "talk/media/webrtc/webrtcvideodecoderfactory.h" |
71 #include "talk/media/webrtc/webrtcvideoencoderfactory.h" | 71 #include "talk/media/webrtc/webrtcvideoencoderfactory.h" |
72 #include "webrtc/base/bind.h" | 72 #include "webrtc/base/bind.h" |
73 #include "webrtc/base/checks.h" | 73 #include "webrtc/base/checks.h" |
74 #include "webrtc/base/logging.h" | 74 #include "webrtc/base/logging.h" |
| 75 #include "webrtc/base/logsinks.h" |
75 #include "webrtc/base/messagequeue.h" | 76 #include "webrtc/base/messagequeue.h" |
76 #include "webrtc/base/ssladapter.h" | 77 #include "webrtc/base/ssladapter.h" |
77 #include "webrtc/base/stringutils.h" | 78 #include "webrtc/base/stringutils.h" |
78 #include "webrtc/system_wrappers/interface/field_trial_default.h" | 79 #include "webrtc/system_wrappers/interface/field_trial_default.h" |
79 #include "webrtc/system_wrappers/interface/trace.h" | 80 #include "webrtc/system_wrappers/interface/trace.h" |
80 #include "webrtc/voice_engine/include/voe_base.h" | 81 #include "webrtc/voice_engine/include/voe_base.h" |
81 | 82 |
82 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) | 83 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) |
83 #include "talk/app/webrtc/androidvideocapturer.h" | 84 #include "talk/app/webrtc/androidvideocapturer.h" |
84 #include "talk/app/webrtc/java/jni/androidmediadecoder_jni.h" | 85 #include "talk/app/webrtc/java/jni/androidmediadecoder_jni.h" |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 static LogcatTraceContext* g_trace_callback = new LogcatTraceContext(); | 916 static LogcatTraceContext* g_trace_callback = new LogcatTraceContext(); |
916 } | 917 } |
917 #endif | 918 #endif |
918 } | 919 } |
919 if (nativeSeverity >= rtc::LS_SENSITIVE && nativeSeverity <= rtc::LS_ERROR) { | 920 if (nativeSeverity >= rtc::LS_SENSITIVE && nativeSeverity <= rtc::LS_ERROR) { |
920 rtc::LogMessage::LogToDebug( | 921 rtc::LogMessage::LogToDebug( |
921 static_cast<rtc::LoggingSeverity>(nativeSeverity)); | 922 static_cast<rtc::LoggingSeverity>(nativeSeverity)); |
922 } | 923 } |
923 } | 924 } |
924 | 925 |
| 926 JOW(void, Logging_nativeEnableLogThreads)(JNIEnv* jni, jclass) { |
| 927 rtc::LogMessage::LogThreads(true); |
| 928 } |
| 929 |
| 930 JOW(void, Logging_nativeEnableLogTimeStamps)(JNIEnv* jni, jclass) { |
| 931 rtc::LogMessage::LogTimestamps(true); |
| 932 } |
| 933 |
| 934 JOW(void, Logging_nativeLog)( |
| 935 JNIEnv* jni, jclass, jint j_severity, jstring j_message) { |
| 936 std::string message = JavaToStdString(jni, j_message); |
| 937 LOG_V(static_cast<rtc::LoggingSeverity>(j_severity)) << message; |
| 938 } |
| 939 |
925 JOW(void, PeerConnection_freePeerConnection)(JNIEnv*, jclass, jlong j_p) { | 940 JOW(void, PeerConnection_freePeerConnection)(JNIEnv*, jclass, jlong j_p) { |
926 CHECK_RELEASE(reinterpret_cast<PeerConnectionInterface*>(j_p)); | 941 CHECK_RELEASE(reinterpret_cast<PeerConnectionInterface*>(j_p)); |
927 } | 942 } |
928 | 943 |
929 JOW(void, PeerConnection_freeObserver)(JNIEnv*, jclass, jlong j_p) { | 944 JOW(void, PeerConnection_freeObserver)(JNIEnv*, jclass, jlong j_p) { |
930 PCOJava* p = reinterpret_cast<PCOJava*>(j_p); | 945 PCOJava* p = reinterpret_cast<PCOJava*>(j_p); |
931 delete p; | 946 delete p; |
932 } | 947 } |
933 | 948 |
934 JOW(void, MediaSource_free)(JNIEnv*, jclass, jlong j_p) { | 949 JOW(void, MediaSource_free)(JNIEnv*, jclass, jlong j_p) { |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); | 1716 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); |
1702 } | 1717 } |
1703 | 1718 |
1704 JOW(void, VideoTrack_nativeRemoveRenderer)( | 1719 JOW(void, VideoTrack_nativeRemoveRenderer)( |
1705 JNIEnv* jni, jclass, | 1720 JNIEnv* jni, jclass, |
1706 jlong j_video_track_pointer, jlong j_renderer_pointer) { | 1721 jlong j_video_track_pointer, jlong j_renderer_pointer) { |
1707 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer( | 1722 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer( |
1708 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); | 1723 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); |
1709 } | 1724 } |
1710 | 1725 |
| 1726 JOW(jlong, CallSessionFileRotatingLogSink_nativeAddSink)( |
| 1727 JNIEnv* jni, jclass, |
| 1728 jstring j_dirPath, jint j_maxFileSize, jint j_severity) { |
| 1729 std::string dir_path = JavaToStdString(jni, j_dirPath); |
| 1730 rtc::CallSessionFileRotatingLogSink* sink = |
| 1731 new rtc::CallSessionFileRotatingLogSink(dir_path, j_maxFileSize); |
| 1732 if (!sink->Init()) { |
| 1733 LOG_V(rtc::LoggingSeverity::LS_WARNING) << |
| 1734 "Failed to init CallSessionFileRotatingLogSink for path " << dir_path; |
| 1735 delete sink; |
| 1736 return 0; |
| 1737 } |
| 1738 rtc::LogMessage::AddLogToStream( |
| 1739 sink, static_cast<rtc::LoggingSeverity>(j_severity)); |
| 1740 return (jlong) sink; |
| 1741 } |
| 1742 |
| 1743 JOW(void, CallSessionFileRotatingLogSink_nativeDeleteSink)( |
| 1744 JNIEnv* jni, jclass, jlong j_sink) { |
| 1745 rtc::CallSessionFileRotatingLogSink* sink = |
| 1746 reinterpret_cast<rtc::CallSessionFileRotatingLogSink*>(j_sink); |
| 1747 rtc::LogMessage::RemoveLogToStream(sink); |
| 1748 delete sink; |
| 1749 } |
| 1750 |
| 1751 JOW(jbyteArray, CallSessionFileRotatingLogSink_nativeGetLogData)( |
| 1752 JNIEnv* jni, jclass, jstring j_dirPath) { |
| 1753 std::string dir_path = JavaToStdString(jni, j_dirPath); |
| 1754 rtc::scoped_ptr<rtc::CallSessionFileRotatingStream> stream( |
| 1755 new rtc::CallSessionFileRotatingStream(dir_path)); |
| 1756 if (!stream->Open()) { |
| 1757 LOG_V(rtc::LoggingSeverity::LS_WARNING) << |
| 1758 "Failed to open CallSessionFileRotatingStream for path " << dir_path; |
| 1759 return jni->NewByteArray(0); |
| 1760 } |
| 1761 size_t log_size = 0; |
| 1762 if (!stream->GetSize(&log_size) || log_size == 0) { |
| 1763 LOG_V(rtc::LoggingSeverity::LS_WARNING) << |
| 1764 "CallSessionFileRotatingStream returns 0 size for path " << dir_path; |
| 1765 return jni->NewByteArray(0); |
| 1766 } |
| 1767 |
| 1768 size_t read = 0; |
| 1769 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); |
| 1770 stream->ReadAll(buffer.get(), log_size, &read, nullptr); |
| 1771 |
| 1772 jbyteArray result = jni->NewByteArray(read); |
| 1773 jni->SetByteArrayRegion(result, 0, read, buffer.get()); |
| 1774 |
| 1775 return result; |
| 1776 } |
| 1777 |
1711 } // namespace webrtc_jni | 1778 } // namespace webrtc_jni |
OLD | NEW |