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" | |
AlexG
2015/09/01 22:31:23
Extra space?
jiayl2
2015/09/01 22:40:09
Done.
| |
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 delete sink; | |
AlexG
2015/09/01 22:31:23
Print warning message?
jiayl2
2015/09/01 22:40:09
Done.
| |
1734 return 0; | |
1735 } | |
1736 rtc::LogMessage::AddLogToStream( | |
1737 sink, static_cast<rtc::LoggingSeverity>(j_severity)); | |
1738 return (jlong) sink; | |
1739 } | |
1740 | |
1741 JOW(void, CallSessionFileRotatingLogSink_nativeDeleteSink)( | |
1742 JNIEnv* jni, jclass, jlong j_sink) { | |
1743 rtc::CallSessionFileRotatingLogSink* sink = | |
1744 reinterpret_cast<rtc::CallSessionFileRotatingLogSink*>(j_sink); | |
1745 rtc::LogMessage::RemoveLogToStream(sink); | |
1746 delete sink; | |
1747 } | |
1748 | |
1749 JOW(jbyteArray, CallSessionFileRotatingLogSink_nativeGetLogData)( | |
1750 JNIEnv* jni, jclass, jstring j_dirPath) { | |
1751 std::string dir_path = JavaToStdString(jni, j_dirPath); | |
1752 rtc::scoped_ptr<rtc::CallSessionFileRotatingStream> stream( | |
1753 new rtc::CallSessionFileRotatingStream(dir_path)); | |
1754 if (!stream->Open()) { | |
1755 return jni->NewByteArray(0); | |
1756 } | |
1757 size_t log_size = 0; | |
1758 if (!stream->GetSize(&log_size) || log_size == 0) { | |
1759 return jni->NewByteArray(0); | |
1760 } | |
1761 | |
1762 size_t read = 0; | |
1763 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); | |
1764 stream->ReadAll(buffer.get(), log_size, &read, nullptr); | |
1765 | |
1766 jbyteArray result = jni->NewByteArray(read); | |
1767 jni->SetByteArrayRegion(result, 0, read, buffer.get()); | |
1768 | |
1769 return result; | |
1770 } | |
1771 | |
1711 } // namespace webrtc_jni | 1772 } // namespace webrtc_jni |
OLD | NEW |