OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 #include <string> | 32 #include <string> |
33 | 33 |
34 #include "talk/app/webrtc/androidvideocapturer.h" | 34 #include "talk/app/webrtc/androidvideocapturer.h" |
35 #include "talk/app/webrtc/java/jni/jni_helpers.h" | 35 #include "talk/app/webrtc/java/jni/jni_helpers.h" |
36 #include "webrtc/base/asyncinvoker.h" | 36 #include "webrtc/base/asyncinvoker.h" |
37 #include "webrtc/base/criticalsection.h" | 37 #include "webrtc/base/criticalsection.h" |
38 #include "webrtc/base/thread_checker.h" | 38 #include "webrtc/base/thread_checker.h" |
39 | 39 |
40 namespace webrtc_jni { | 40 namespace webrtc_jni { |
41 | 41 |
42 class NativeHandleImpl; | 42 class NativeTextureHandleImpl; |
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, jobject j_video_capturer); |
52 | 52 |
53 void Start(int width, int height, int framerate, | 53 void Start(int width, int height, int framerate, |
54 webrtc::AndroidVideoCapturer* capturer) override; | 54 webrtc::AndroidVideoCapturer* capturer) override; |
55 void Stop() override; | 55 void Stop() override; |
56 | 56 |
57 std::string GetSupportedFormats() override; | 57 std::string GetSupportedFormats() override; |
58 | 58 |
59 // Called from VideoCapturerAndroid::NativeObserver on a Java thread. | 59 // Called from VideoCapturerAndroid::NativeObserver on a Java thread. |
60 void OnCapturerStarted(bool success); | 60 void OnCapturerStarted(bool success); |
61 void OnMemoryBufferFrame(void* video_frame, int length, int width, | 61 void OnMemoryBufferFrame(void* video_frame, int length, int width, |
62 int height, int rotation, int64_t timestamp_ns); | 62 int height, int rotation, int64_t timestamp_ns); |
63 void OnTextureFrame(int width, int height, int64_t timestamp_ns, | 63 void OnTextureFrame(int width, int height, int64_t timestamp_ns, |
64 const NativeHandleImpl& handle); | 64 const NativeTextureHandleImpl& handle); |
65 void OnOutputFormatRequest(int width, int height, int fps); | 65 void OnOutputFormatRequest(int width, int height, int fps); |
66 | 66 |
67 protected: | 67 protected: |
68 ~AndroidVideoCapturerJni(); | 68 ~AndroidVideoCapturerJni(); |
69 | 69 |
70 private: | 70 private: |
71 void ReturnBuffer(int64_t time_stamp); | 71 void ReturnBuffer(int64_t time_stamp); |
72 JNIEnv* jni(); | 72 JNIEnv* jni(); |
73 | 73 |
74 // Helper function to make safe asynchronous calls to |capturer_|. The calls | 74 // Helper function to make safe asynchronous calls to |capturer_|. The calls |
(...skipping 20 matching lines...) Expand all Loading... |
95 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); | 95 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); |
96 | 96 |
97 static jobject application_context_; | 97 static jobject application_context_; |
98 | 98 |
99 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); | 99 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace webrtc_jni | 102 } // namespace webrtc_jni |
103 | 103 |
104 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ | 104 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ |
OLD | NEW |