| 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 NativeTextureHandleImpl; | 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, 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 NativeTextureHandleImpl& handle); | 64 const NativeHandleImpl& 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 // To avoid deducing Args from the 3rd parameter of AsyncCapturerInvoke. | 74 // To avoid deducing Args from the 3rd parameter of AsyncCapturerInvoke. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 101 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); | 101 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); |
| 102 | 102 |
| 103 static jobject application_context_; | 103 static jobject application_context_; |
| 104 | 104 |
| 105 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); | 105 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace webrtc_jni | 108 } // namespace webrtc_jni |
| 109 | 109 |
| 110 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ | 110 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ |
| OLD | NEW |