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 #include "webrtc/sdk/android/src/jni/media_jni.h" | |
11 | 10 |
12 #include "webrtc/call/callfactoryinterface.h" | 11 #include "webrtc/api/dtmfsenderinterface.h" |
13 #include "webrtc/logging/rtc_event_log/rtc_event_log_factory_interface.h" | 12 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
14 #include "webrtc/media/engine/webrtcmediaengine.h" | |
15 #include "webrtc/modules/audio_processing/include/audio_processing.h" | |
16 | 13 |
17 namespace webrtc_jni { | 14 namespace webrtc_jni { |
18 | 15 |
19 webrtc::CallFactoryInterface* CreateCallFactory() { | 16 JOW(jboolean, DtmfSender_nativeCanInsertDtmf) |
20 return webrtc::CreateCallFactory().release(); | 17 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
| 18 return reinterpret_cast<webrtc::DtmfSenderInterface*>(j_dtmf_sender_pointer) |
| 19 ->CanInsertDtmf(); |
21 } | 20 } |
22 | 21 |
23 webrtc::RtcEventLogFactoryInterface* CreateRtcEventLogFactory() { | 22 JOW(jboolean, DtmfSender_nativeInsertDtmf) |
24 return webrtc::CreateRtcEventLogFactory().release(); | 23 (JNIEnv* jni, |
| 24 jclass, |
| 25 jlong j_dtmf_sender_pointer, |
| 26 jstring tones, |
| 27 jint duration, |
| 28 jint inter_tone_gap) { |
| 29 return reinterpret_cast<webrtc::DtmfSenderInterface*>(j_dtmf_sender_pointer) |
| 30 ->InsertDtmf(JavaToStdString(jni, tones), duration, inter_tone_gap); |
25 } | 31 } |
26 | 32 |
27 cricket::MediaEngineInterface* CreateMediaEngine( | 33 JOW(jstring, DtmfSender_nativeTones) |
28 webrtc::AudioDeviceModule* adm, | 34 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
29 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& | 35 return JavaStringFromStdString( |
30 audio_encoder_factory, | 36 jni, reinterpret_cast<webrtc::DtmfSenderInterface*>(j_dtmf_sender_pointer) |
31 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& | 37 ->tones()); |
32 audio_decoder_factory, | 38 } |
33 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 39 |
34 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, | 40 JOW(jint, DtmfSender_nativeDuration) |
35 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer) { | 41 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
36 return cricket::WebRtcMediaEngineFactory::Create( | 42 return reinterpret_cast<webrtc::DtmfSenderInterface*>(j_dtmf_sender_pointer) |
37 adm, audio_encoder_factory, audio_decoder_factory, video_encoder_factory, | 43 ->duration(); |
38 video_decoder_factory, audio_mixer, webrtc::AudioProcessing::Create()); | 44 } |
| 45 |
| 46 JOW(jint, DtmfSender_nativeInterToneGap) |
| 47 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
| 48 return reinterpret_cast<webrtc::DtmfSenderInterface*>(j_dtmf_sender_pointer) |
| 49 ->inter_tone_gap(); |
| 50 } |
| 51 |
| 52 JOW(void, DtmfSender_free) |
| 53 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
| 54 reinterpret_cast<webrtc::DtmfSenderInterface*>(j_dtmf_sender_pointer) |
| 55 ->Release(); |
39 } | 56 } |
40 | 57 |
41 } // namespace webrtc_jni | 58 } // namespace webrtc_jni |
OLD | NEW |