Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webrtc/api/android/jni/androidvideotracksource_jni.cc

Issue 2127893002: AndroidVideoTrackSource implementation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@magjed-init
Patch Set: Change videoSourceStopped to videoCapturerStopped. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/api/android/jni/classreferenceholder.h"
12 #include "webrtc/api/androidvideotracksource.h"
13 #include "webrtc/api/videosourceproxy.h"
14
15 namespace webrtc_jni {
16
17 JOW(void,
18 VideoCapturer_00024AndroidVideoTrackSourceObserver_nativeOnByteBufferFrameCa ptured)
19 (JNIEnv* jni,
20 jclass,
21 jlong j_source,
22 jbyteArray j_frame,
23 jint length,
24 jint width,
25 jint height,
26 jint rotation,
27 jlong timestamp) {
28 auto proxy_source =
magjed_webrtc 2016/07/19 12:57:46 Add a static helper method in this file for conver
sakal 2016/07/19 13:46:23 Done.
29 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(j_source);
30 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>(
31 proxy_source->internal());
32 jboolean is_copy = true;
33 jbyte* bytes = jni->GetByteArrayElements(j_frame, &is_copy);
magjed_webrtc 2016/07/19 12:57:46 Remove is_copy and pass nullptr instead.
sakal 2016/07/19 13:46:23 Done.
34 source->OnByteBufferFrameCaptured(bytes, length, width, height, rotation,
35 timestamp);
36 jni->ReleaseByteArrayElements(j_frame, bytes, JNI_ABORT);
37 }
38
39 JOW(void,
40 VideoCapturer_00024AndroidVideoTrackSourceObserver_nativeOnTextureFrameCaptu red)
41 (JNIEnv* jni,
42 jclass,
43 jlong j_source,
44 jint j_width,
45 jint j_height,
46 jint j_oes_texture_id,
47 jfloatArray j_transform_matrix,
48 jint j_rotation,
49 jlong j_timestamp) {
50 auto proxy_source =
51 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(j_source);
52 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>(
53 proxy_source->internal());
54 source->OnTextureFrameCaptured(
55 j_width, j_height, j_rotation, j_timestamp,
56 NativeHandleImpl(jni, j_oes_texture_id, j_transform_matrix));
57 }
58
59 JOW(void,
60 VideoCapturer_00024AndroidVideoTrackSourceObserver_nativeCapturerStarted)
61 (JNIEnv* jni, jclass, jlong j_source, jboolean j_success) {
62 LOG(LS_INFO) << "AndroidVideoTrackSourceObserve_nativeCapturerStarted";
63 auto proxy_source =
64 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(j_source);
65 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>(
66 proxy_source->internal());
67 source->SetState(webrtc::AndroidVideoTrackSource::SourceState::kLive);
68 }
69
70 JOW(void,
71 VideoCapturer_00024AndroidVideoTrackSourceObserver_nativeCapturerStopped)
72 (JNIEnv* jni, jclass, jlong j_source) {
73 LOG(LS_INFO) << "AndroidVideoTrackSourceObserve_nativeCapturerStopped";
74 auto proxy_source =
75 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(j_source);
76 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>(
77 proxy_source->internal());
78 source->SetState(webrtc::AndroidVideoTrackSource::SourceState::kEnded);
79 }
80
81 JOW(void,
82 VideoCapturer_00024AndroidVideoTrackSourceObserver_nativeOnOutputFormatReque st)
83 (JNIEnv* jni, jclass, jlong j_source, jint j_width, jint j_height, jint j_fps) {
84 LOG(LS_INFO) << "AndroidVideoTrackSourceObserve_nativeOnOutputFormatRequest";
85 auto proxy_source =
86 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(j_source);
87 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>(
88 proxy_source->internal());
89 source->OnOutputFormatRequest(j_width, j_height, j_fps);
90 }
91
92 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698