Remove proxy layer from AndroidVideoTrackSource

This layer is not needed since the methods are thread safe, and the
classes those method touches (VideoBroadcaster, cricket::VideoAdapter)
are thread safe.

Bug: webrtc:10247
Change-Id: Id4e309de4ac1b9669052aaa60d3bd1ed965aaa29
Reviewed-on: https://webrtc-review.googlesource.com/c/120801
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26543}
This commit is contained in:
Magnus Jedvert
2019-01-31 13:23:46 +01:00
committed by Commit Bot
parent 69b761e52b
commit 167316b833
9 changed files with 10 additions and 50 deletions

View File

@ -12,7 +12,6 @@
#include <utility>
#include "api/video_track_source_proxy.h"
#include "rtc_base/logging.h"
namespace webrtc {
@ -32,7 +31,6 @@ AndroidVideoTrackSource::AndroidVideoTrackSource(rtc::Thread* signaling_thread,
is_screencast_(is_screencast),
align_timestamps_(align_timestamps) {
RTC_LOG(LS_INFO) << "AndroidVideoTrackSource ctor";
camera_thread_checker_.DetachFromThread();
}
AndroidVideoTrackSource::~AndroidVideoTrackSource() = default;
@ -73,8 +71,6 @@ void AndroidVideoTrackSource::OnFrameCaptured(
int64_t timestamp_ns,
VideoRotation rotation,
const JavaRef<jobject>& j_video_frame_buffer) {
RTC_DCHECK(camera_thread_checker_.CalledOnValidThread());
int64_t camera_time_us = timestamp_ns / rtc::kNumNanosecsPerMicrosec;
int64_t translated_camera_time_us =
align_timestamps_ ? timestamp_aligner_.TranslateTimestamp(

View File

@ -18,7 +18,6 @@
#include "media/base/adapted_video_track_source.h"
#include "rtc_base/async_invoker.h"
#include "rtc_base/checks.h"
#include "rtc_base/thread_checker.h"
#include "rtc_base/timestamp_aligner.h"
#include "sdk/android/src/jni/video_frame.h"
@ -63,7 +62,6 @@ class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource {
private:
rtc::Thread* signaling_thread_;
rtc::AsyncInvoker invoker_;
rtc::ThreadChecker camera_thread_checker_;
SourceState state_;
const bool is_screencast_;
rtc::TimestampAligner timestamp_aligner_;

View File

@ -10,7 +10,6 @@
#include "sdk/android/src/jni/native_capturer_observer.h"
#include "api/video_track_source_proxy.h"
#include "rtc_base/logging.h"
#include "sdk/android/generated_video_jni/jni/NativeCapturerObserver_jni.h"
#include "sdk/android/native_api/jni/java_types.h"

View File

@ -15,7 +15,6 @@
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "api/video_track_source_proxy.h"
#include "rtc_base/logging.h"
#include "sdk/android/native_api/jni/java_types.h"
#include "sdk/android/src/jni/android_video_track_source.h"
@ -49,8 +48,7 @@ void* CreateVideoSource(JNIEnv* env,
rtc::scoped_refptr<AndroidVideoTrackSource> source(
new rtc::RefCountedObject<AndroidVideoTrackSource>(
signaling_thread, env, is_screencast, align_timestamps));
return VideoTrackSourceProxy::Create(signaling_thread, worker_thread, source)
.release();
return source.release();
}
} // namespace jni

View File

@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/video_track_source_proxy.h"
#include "rtc_base/logging.h"
#include "sdk/android/generated_video_jni/jni/VideoSource_jni.h"
#include "sdk/android/native_api/jni/java_types.h"
@ -17,18 +16,6 @@
namespace webrtc {
namespace jni {
namespace {
AndroidVideoTrackSource* AndroidVideoTrackSourceFromJavaProxy(jlong j_proxy) {
auto* proxy_source = reinterpret_cast<VideoTrackSourceProxy*>(j_proxy);
return reinterpret_cast<AndroidVideoTrackSource*>(proxy_source->internal());
}
} // namespace
static jlong JNI_VideoSource_GetInternalSource(JNIEnv* jni,
jlong j_source) {
return NativeToJavaPointer(AndroidVideoTrackSourceFromJavaProxy(j_source));
}
static void JNI_VideoSource_AdaptOutputFormat(JNIEnv* jni,
jlong j_source,
jint j_landscape_width,
@ -37,10 +24,9 @@ static void JNI_VideoSource_AdaptOutputFormat(JNIEnv* jni,
jint j_portrait_height,
jint j_fps) {
RTC_LOG(LS_INFO) << "VideoSource_nativeAdaptOutputFormat";
AndroidVideoTrackSource* source =
AndroidVideoTrackSourceFromJavaProxy(j_source);
source->OnOutputFormatRequest(j_landscape_width, j_landscape_height,
j_portrait_width, j_portrait_height, j_fps);
reinterpret_cast<AndroidVideoTrackSource*>(j_source)->OnOutputFormatRequest(
j_landscape_width, j_landscape_height, j_portrait_width,
j_portrait_height, j_fps);
}
} // namespace jni