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/api/mediastreaminterface.h" | 11 #include "webrtc/api/mediastreaminterface.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(jboolean, | 17 JNI_FUNCTION_DECLARATION(jboolean, |
17 MediaStream_nativeAddAudioTrack, | 18 MediaStream_nativeAddAudioTrack, |
18 JNIEnv* jni, | 19 JNIEnv* jni, |
19 jclass, | 20 jclass, |
20 jlong pointer, | 21 jlong pointer, |
21 jlong j_audio_track_pointer) { | 22 jlong j_audio_track_pointer) { |
22 return reinterpret_cast<webrtc::MediaStreamInterface*>(pointer)->AddTrack( | 23 return reinterpret_cast<MediaStreamInterface*>(pointer)->AddTrack( |
23 reinterpret_cast<webrtc::AudioTrackInterface*>(j_audio_track_pointer)); | 24 reinterpret_cast<AudioTrackInterface*>(j_audio_track_pointer)); |
24 } | 25 } |
25 | 26 |
26 JNI_FUNCTION_DECLARATION(jboolean, | 27 JNI_FUNCTION_DECLARATION(jboolean, |
27 MediaStream_nativeAddVideoTrack, | 28 MediaStream_nativeAddVideoTrack, |
28 JNIEnv* jni, | 29 JNIEnv* jni, |
29 jclass, | 30 jclass, |
30 jlong pointer, | 31 jlong pointer, |
31 jlong j_video_track_pointer) { | 32 jlong j_video_track_pointer) { |
32 return reinterpret_cast<webrtc::MediaStreamInterface*>(pointer)->AddTrack( | 33 return reinterpret_cast<MediaStreamInterface*>(pointer)->AddTrack( |
33 reinterpret_cast<webrtc::VideoTrackInterface*>(j_video_track_pointer)); | 34 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)); |
34 } | 35 } |
35 | 36 |
36 JNI_FUNCTION_DECLARATION(jboolean, | 37 JNI_FUNCTION_DECLARATION(jboolean, |
37 MediaStream_nativeRemoveAudioTrack, | 38 MediaStream_nativeRemoveAudioTrack, |
38 JNIEnv* jni, | 39 JNIEnv* jni, |
39 jclass, | 40 jclass, |
40 jlong pointer, | 41 jlong pointer, |
41 jlong j_audio_track_pointer) { | 42 jlong j_audio_track_pointer) { |
42 return reinterpret_cast<webrtc::MediaStreamInterface*>(pointer)->RemoveTrack( | 43 return reinterpret_cast<MediaStreamInterface*>(pointer)->RemoveTrack( |
43 reinterpret_cast<webrtc::AudioTrackInterface*>(j_audio_track_pointer)); | 44 reinterpret_cast<AudioTrackInterface*>(j_audio_track_pointer)); |
44 } | 45 } |
45 | 46 |
46 JNI_FUNCTION_DECLARATION(jboolean, | 47 JNI_FUNCTION_DECLARATION(jboolean, |
47 MediaStream_nativeRemoveVideoTrack, | 48 MediaStream_nativeRemoveVideoTrack, |
48 JNIEnv* jni, | 49 JNIEnv* jni, |
49 jclass, | 50 jclass, |
50 jlong pointer, | 51 jlong pointer, |
51 jlong j_video_track_pointer) { | 52 jlong j_video_track_pointer) { |
52 return reinterpret_cast<webrtc::MediaStreamInterface*>(pointer)->RemoveTrack( | 53 return reinterpret_cast<MediaStreamInterface*>(pointer)->RemoveTrack( |
53 reinterpret_cast<webrtc::VideoTrackInterface*>(j_video_track_pointer)); | 54 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)); |
54 } | 55 } |
55 | 56 |
56 JNI_FUNCTION_DECLARATION(jstring, | 57 JNI_FUNCTION_DECLARATION(jstring, |
57 MediaStream_nativeLabel, | 58 MediaStream_nativeLabel, |
58 JNIEnv* jni, | 59 JNIEnv* jni, |
59 jclass, | 60 jclass, |
60 jlong j_p) { | 61 jlong j_p) { |
61 return JavaStringFromStdString( | 62 return JavaStringFromStdString( |
62 jni, reinterpret_cast<webrtc::MediaStreamInterface*>(j_p)->label()); | 63 jni, reinterpret_cast<MediaStreamInterface*>(j_p)->label()); |
63 } | 64 } |
64 | 65 |
65 JNI_FUNCTION_DECLARATION(void, MediaStream_free, JNIEnv*, jclass, jlong j_p) { | 66 JNI_FUNCTION_DECLARATION(void, MediaStream_free, JNIEnv*, jclass, jlong j_p) { |
66 CHECK_RELEASE(reinterpret_cast<webrtc::MediaStreamInterface*>(j_p)); | 67 CHECK_RELEASE(reinterpret_cast<MediaStreamInterface*>(j_p)); |
67 } | 68 } |
68 | 69 |
69 } // namespace webrtc_jni | 70 } // namespace jni |
| 71 } // namespace webrtc |
OLD | NEW |