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

Side by Side Diff: talk/app/webrtc/java/jni/androidvideocapturer_jni.h

Issue 1460703002: Implement AndroidTextureBuffer::NativeToI420. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix comment nits. Created 5 years 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
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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 30 matching lines...) Expand all
41 41
42 class NativeHandleImpl; 42 class NativeHandleImpl;
43 43
44 // AndroidVideoCapturerJni implements AndroidVideoCapturerDelegate. 44 // AndroidVideoCapturerJni implements AndroidVideoCapturerDelegate.
45 // The purpose of the delegate is to hide the JNI specifics from the C++ only 45 // The purpose of the delegate is to hide the JNI specifics from the C++ only
46 // AndroidVideoCapturer. 46 // AndroidVideoCapturer.
47 class AndroidVideoCapturerJni : public webrtc::AndroidVideoCapturerDelegate { 47 class AndroidVideoCapturerJni : public webrtc::AndroidVideoCapturerDelegate {
48 public: 48 public:
49 static int SetAndroidObjects(JNIEnv* jni, jobject appliction_context); 49 static int SetAndroidObjects(JNIEnv* jni, jobject appliction_context);
50 50
51 AndroidVideoCapturerJni(JNIEnv* jni, jobject j_video_capturer); 51 AndroidVideoCapturerJni(JNIEnv* jni,
52 jobject j_video_capturer,
53 jobject j_surface_texture_helper);
52 54
53 void Start(int width, int height, int framerate, 55 void Start(int width, int height, int framerate,
54 webrtc::AndroidVideoCapturer* capturer) override; 56 webrtc::AndroidVideoCapturer* capturer) override;
55 void Stop() override; 57 void Stop() override;
56 58
57 std::string GetSupportedFormats() override; 59 std::string GetSupportedFormats() override;
58 60
59 // Called from VideoCapturerAndroid::NativeObserver on a Java thread. 61 // Called from VideoCapturerAndroid::NativeObserver on a Java thread.
60 void OnCapturerStarted(bool success); 62 void OnCapturerStarted(bool success);
61 void OnMemoryBufferFrame(void* video_frame, int length, int width, 63 void OnMemoryBufferFrame(void* video_frame, int length, int width,
(...skipping 16 matching lines...) Expand all
78 }; 80 };
79 81
80 // Helper function to make safe asynchronous calls to |capturer_|. The calls 82 // Helper function to make safe asynchronous calls to |capturer_|. The calls
81 // are not guaranteed to be delivered. 83 // are not guaranteed to be delivered.
82 template <typename... Args> 84 template <typename... Args>
83 void AsyncCapturerInvoke( 85 void AsyncCapturerInvoke(
84 const char* method_name, 86 const char* method_name,
85 void (webrtc::AndroidVideoCapturer::*method)(Args...), 87 void (webrtc::AndroidVideoCapturer::*method)(Args...),
86 typename Identity<Args>::type... args); 88 typename Identity<Args>::type... args);
87 89
88 const ScopedGlobalRef<jobject> j_capturer_global_; 90 const ScopedGlobalRef<jobject> j_video_capturer_;
91 const ScopedGlobalRef<jobject> j_surface_texture_helper_;
89 const ScopedGlobalRef<jclass> j_video_capturer_class_; 92 const ScopedGlobalRef<jclass> j_video_capturer_class_;
90 const ScopedGlobalRef<jclass> j_observer_class_; 93 const ScopedGlobalRef<jclass> j_observer_class_;
91 94
92 rtc::ThreadChecker thread_checker_; 95 rtc::ThreadChecker thread_checker_;
93 96
94 // |capturer| is a guaranteed to be a valid pointer between a call to 97 // |capturer| is a guaranteed to be a valid pointer between a call to
95 // AndroidVideoCapturerDelegate::Start 98 // AndroidVideoCapturerDelegate::Start
96 // until AndroidVideoCapturerDelegate::Stop. 99 // until AndroidVideoCapturerDelegate::Stop.
97 rtc::CriticalSection capturer_lock_; 100 rtc::CriticalSection capturer_lock_;
98 webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_); 101 webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_);
99 // |invoker_| is used to communicate with |capturer_| on the thread Start() is 102 // |invoker_| is used to communicate with |capturer_| on the thread Start() is
100 // called on. 103 // called on.
101 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); 104 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_);
102 105
103 static jobject application_context_; 106 static jobject application_context_;
104 107
105 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); 108 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni);
106 }; 109 };
107 110
108 } // namespace webrtc_jni 111 } // namespace webrtc_jni
109 112
110 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ 113 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698