From 0ce6aafc3283bb00cb7b957f2deed9ad0f085e73 Mon Sep 17 00:00:00 2001 From: sakal Date: Tue, 22 Nov 2016 01:26:16 -0800 Subject: [PATCH] Move androidvideotracksource from api under api/android/jni. This file fits there more naturally since it has dependencies to jni. BUG=None Review-Url: https://codereview.webrtc.org/2514383002 Cr-Commit-Position: refs/heads/master@{#15179} --- webrtc/api/BUILD.gn | 4 ++-- webrtc/api/OWNERS | 2 -- webrtc/api/android/jni/OWNERS | 1 + .../jni}/androidvideotracksource.cc | 23 ++++++++----------- .../jni}/androidvideotracksource.h | 6 ++--- .../jni/androidvideotracksource_jni.cc | 2 +- webrtc/api/android/jni/peerconnection_jni.cc | 2 +- 7 files changed, 18 insertions(+), 22 deletions(-) rename webrtc/api/{ => android/jni}/androidvideotracksource.cc (89%) rename webrtc/api/{ => android/jni}/androidvideotracksource.h (94%) diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn index e2b0e42de9..e3851828d2 100644 --- a/webrtc/api/BUILD.gn +++ b/webrtc/api/BUILD.gn @@ -179,6 +179,8 @@ if (is_android && !build_with_chromium) { "android/jni/androidmetrics_jni.cc", "android/jni/androidnetworkmonitor_jni.cc", "android/jni/androidnetworkmonitor_jni.h", + "android/jni/androidvideotracksource.cc", + "android/jni/androidvideotracksource.h", "android/jni/androidvideotracksource_jni.cc", "android/jni/classreferenceholder.cc", "android/jni/classreferenceholder.h", @@ -189,8 +191,6 @@ if (is_android && !build_with_chromium) { "android/jni/peerconnection_jni.cc", "android/jni/surfacetexturehelper_jni.cc", "android/jni/surfacetexturehelper_jni.h", - "androidvideotracksource.cc", - "androidvideotracksource.h", ] configs += [ ":libjingle_peerconnection_jni_warnings_config" ] diff --git a/webrtc/api/OWNERS b/webrtc/api/OWNERS index 4957c50866..43e2cd6e7f 100644 --- a/webrtc/api/OWNERS +++ b/webrtc/api/OWNERS @@ -7,8 +7,6 @@ tkchin@webrtc.org tommi@webrtc.org deadbeef@webrtc.org -per-file androidvideotracksource.*=sakal@webrtc.org -per-file androidvideotracksource.*=magjed@webrtc.org per-file rtcstats*=hbos@webrtc.org per-file rtcstats*=hta@webrtc.org diff --git a/webrtc/api/android/jni/OWNERS b/webrtc/api/android/jni/OWNERS index 96da1b9594..7c5f51a1e7 100644 --- a/webrtc/api/android/jni/OWNERS +++ b/webrtc/api/android/jni/OWNERS @@ -1,2 +1,3 @@ per-file androidmetrics_jni.cc=sakal@webrtc.org +per-file androidvideotracksource.*=sakal@webrtc.org per-file androidvideotracksource_jni.cc=sakal@webrtc.org diff --git a/webrtc/api/androidvideotracksource.cc b/webrtc/api/android/jni/androidvideotracksource.cc similarity index 89% rename from webrtc/api/androidvideotracksource.cc rename to webrtc/api/android/jni/androidvideotracksource.cc index 947311a83e..4f708a6b4f 100644 --- a/webrtc/api/androidvideotracksource.cc +++ b/webrtc/api/android/jni/androidvideotracksource.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/api/androidvideotracksource.h" +#include "webrtc/api/android/jni/androidvideotracksource.h" #include @@ -63,9 +63,9 @@ void AndroidVideoTrackSource::OnByteBufferFrameCaptured(const void* frame_data, int crop_x; int crop_y; - if (!AdaptFrame(width, height, camera_time_us, - &adapted_width, &adapted_height, &crop_width, &crop_height, - &crop_x, &crop_y)) { + if (!AdaptFrame(width, height, camera_time_us, &adapted_width, + &adapted_height, &crop_width, &crop_height, &crop_x, + &crop_y)) { return; } @@ -86,14 +86,11 @@ void AndroidVideoTrackSource::OnByteBufferFrameCaptured(const void* frame_data, buffer_pool_.CreateBuffer(adapted_width, adapted_height); nv12toi420_scaler_.NV12ToI420Scale( - y_plane, width, - uv_plane, uv_width * 2, - crop_width, crop_height, + y_plane, width, uv_plane, uv_width * 2, crop_width, crop_height, buffer->MutableDataY(), buffer->StrideY(), // Swap U and V, since we have NV21, not NV12. - buffer->MutableDataV(), buffer->StrideV(), - buffer->MutableDataU(), buffer->StrideU(), - buffer->width(), buffer->height()); + buffer->MutableDataV(), buffer->StrideV(), buffer->MutableDataU(), + buffer->StrideU(), buffer->width(), buffer->height()); OnFrame(VideoFrame(buffer, static_cast(rotation), translated_camera_time_us)); @@ -120,9 +117,9 @@ void AndroidVideoTrackSource::OnTextureFrameCaptured( int crop_x; int crop_y; - if (!AdaptFrame(width, height, camera_time_us, - &adapted_width, &adapted_height, &crop_width, &crop_height, - &crop_x, &crop_y)) { + if (!AdaptFrame(width, height, camera_time_us, &adapted_width, + &adapted_height, &crop_width, &crop_height, &crop_x, + &crop_y)) { surface_texture_helper_->ReturnTextureFrame(); return; } diff --git a/webrtc/api/androidvideotracksource.h b/webrtc/api/android/jni/androidvideotracksource.h similarity index 94% rename from webrtc/api/androidvideotracksource.h rename to webrtc/api/android/jni/androidvideotracksource.h index 4dc921aee3..be8da956a0 100644 --- a/webrtc/api/androidvideotracksource.h +++ b/webrtc/api/android/jni/androidvideotracksource.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ -#define WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ +#ifndef WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ +#define WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ #include "webrtc/api/android/jni/native_handle_impl.h" #include "webrtc/api/android/jni/surfacetexturehelper_jni.h" @@ -81,4 +81,4 @@ class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource { } // namespace webrtc -#endif // WEBRTC_API_ANDROIDVIDEOTRACKSOURCE_H_ +#endif // WEBRTC_API_ANDROID_JNI_ANDROIDVIDEOTRACKSOURCE_H_ diff --git a/webrtc/api/android/jni/androidvideotracksource_jni.cc b/webrtc/api/android/jni/androidvideotracksource_jni.cc index 32ed5f8568..5aba4c6dcd 100644 --- a/webrtc/api/android/jni/androidvideotracksource_jni.cc +++ b/webrtc/api/android/jni/androidvideotracksource_jni.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "webrtc/api/android/jni/androidvideotracksource.h" #include "webrtc/api/android/jni/classreferenceholder.h" -#include "webrtc/api/androidvideotracksource.h" #include "webrtc/api/videosourceproxy.h" // Identifiers are over 80 characters long so this is needed to fit them on one diff --git a/webrtc/api/android/jni/peerconnection_jni.cc b/webrtc/api/android/jni/peerconnection_jni.cc index 7012fc355a..1579a55832 100644 --- a/webrtc/api/android/jni/peerconnection_jni.cc +++ b/webrtc/api/android/jni/peerconnection_jni.cc @@ -45,10 +45,10 @@ #include "third_party/libyuv/include/libyuv/convert_from.h" #include "third_party/libyuv/include/libyuv/scale.h" -#include "webrtc/api/androidvideotracksource.h" #include "webrtc/api/android/jni/androidmediadecoder_jni.h" #include "webrtc/api/android/jni/androidmediaencoder_jni.h" #include "webrtc/api/android/jni/androidnetworkmonitor_jni.h" +#include "webrtc/api/android/jni/androidvideotracksource.h" #include "webrtc/api/android/jni/classreferenceholder.h" #include "webrtc/api/android/jni/jni_helpers.h" #include "webrtc/api/android/jni/native_handle_impl.h"