├── .gitignore ├── android └── svideostream │ ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── drawable │ │ │ │ │ └── recordcheckbox_selector.xml │ │ │ │ ├── values │ │ │ │ │ ├── attrs.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ └── layout │ │ │ │ │ ├── table_stream_info_row.xml │ │ │ │ │ ├── activity_screen.xml │ │ │ │ │ ├── notification_screen.xml │ │ │ │ │ ├── activity_main.xml │ │ │ │ │ └── activity_camera.xml │ │ │ ├── java │ │ │ │ └── cn │ │ │ │ │ └── cxw │ │ │ │ │ └── svideostream │ │ │ │ │ ├── fragments │ │ │ │ │ └── SettingsFragment.java │ │ │ │ │ ├── application │ │ │ │ │ ├── GlobalSetting.java │ │ │ │ │ ├── GlobalVideoStream.java │ │ │ │ │ ├── MainApplication.java │ │ │ │ │ └── Setting.java │ │ │ │ │ ├── utils │ │ │ │ │ └── PermissionCheck.java │ │ │ │ │ ├── widget │ │ │ │ │ └── InfoHudViewHolder.java │ │ │ │ │ ├── activities │ │ │ │ │ └── SettingActivity.java │ │ │ │ │ └── preference │ │ │ │ │ └── SvsListPreference.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── cxw │ │ │ │ └── svideostream │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── cn │ │ │ └── cxw │ │ │ └── svideostream │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle │ ├── screenlive │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── cxw │ │ │ │ └── screenlive │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── cn │ │ │ └── cxw │ │ │ └── screenlive │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle │ ├── magiccameralive │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── cxw │ │ │ │ └── magiccameralive │ │ │ │ └── MagicCameraFrameSource.java │ │ ├── test │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── cxw │ │ │ │ └── magiccameralive │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── cn │ │ │ └── cxw │ │ │ └── magiccameralive │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle │ ├── svideostreamlib │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── jniLibs │ │ │ │ └── armeabi-v7a │ │ │ │ │ └── libsvideostream.so │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── cxw │ │ │ │ └── svideostreamlib │ │ │ │ ├── CommonSetting.java │ │ │ │ ├── VideoStreamSetting.java │ │ │ │ ├── MediaConfig.java │ │ │ │ ├── StatsReport.java │ │ │ │ └── VideoFrameSource.java │ │ ├── test │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── cxw │ │ │ │ └── svideostreamlib │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── cn │ │ │ └── cxw │ │ │ └── svideostreamlib │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle │ ├── settings.gradle │ ├── libs │ ├── androidcomutils-1.1.jar │ ├── magiccameralib-2.1.aar │ └── openglesutils-2.1.aar │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ └── gradlew.bat ├── thirdparts ├── libyuv │ └── jni │ │ ├── tools │ │ ├── sanitizer_options.gyp │ │ ├── valgrind-libyuv │ │ │ ├── tsan │ │ │ │ ├── OWNERS │ │ │ │ ├── suppressions.txt │ │ │ │ ├── suppressions_mac.txt │ │ │ │ ├── suppressions_win32.txt │ │ │ │ └── PRESUBMIT.py │ │ │ ├── memcheck │ │ │ │ ├── OWNERS │ │ │ │ ├── suppressions.txt │ │ │ │ ├── suppressions_mac.txt │ │ │ │ └── suppressions_win32.txt │ │ │ └── libyuv_tests.bat │ │ └── lsan │ │ │ └── suppressions.txt │ │ ├── OWNERS │ │ ├── AUTHORS │ │ ├── unit_test │ │ ├── testdata │ │ │ ├── tegra3.txt │ │ │ ├── arm_v7.txt │ │ │ └── juno.txt │ │ ├── version_test.cc │ │ ├── basictypes_test.cc │ │ ├── unit_test.cc │ │ └── unit_test.h │ │ ├── Application.mk │ │ ├── chromium │ │ ├── README │ │ └── .gclient │ │ ├── README.chromium │ │ ├── LICENSE_THIRD_PARTY │ │ ├── public.mk │ │ ├── codereview.settings │ │ ├── .gitignore │ │ ├── include │ │ ├── libyuv │ │ │ ├── version.h │ │ │ ├── rotate_argb.h │ │ │ ├── scale_argb.h │ │ │ ├── compare.h │ │ │ ├── cpu_id.h │ │ │ └── basic_types.h │ │ └── libyuv.h │ │ ├── all.gyp │ │ ├── download_vs_toolchain.py │ │ ├── util │ │ ├── ssim.h │ │ ├── psnr.h │ │ ├── compare.cc │ │ └── cpuid.c │ │ ├── DEPS │ │ ├── winarm.mk │ │ ├── libyuv_nacl.gyp │ │ ├── gyp_libyuv.py │ │ ├── source │ │ ├── compare_common.cc │ │ ├── mjpeg_validate.cc │ │ ├── video_common.cc │ │ ├── compare_neon64.cc │ │ └── compare_neon.cc │ │ ├── PRESUBMIT.py │ │ ├── PATENTS │ │ ├── linux.mk │ │ ├── LICENSE │ │ ├── Android.mk │ │ ├── libyuv.gypi │ │ ├── BUILD.gn │ │ └── gyp_libyuv ├── librtmp │ └── jni │ │ ├── rtmp.c │ │ ├── Application.mk │ │ ├── librtmp.pc.in │ │ ├── Android.mk │ │ ├── http.h │ │ ├── log.h │ │ ├── bytes.h │ │ └── Makefile ├── download-x264.sh ├── download-baselib.sh ├── build-baselib.sh ├── download-ffmpeg.sh ├── download-fdkaac.sh ├── build-libyuv.sh └── build-librtmp.sh ├── svideostream ├── src │ ├── RtmpCommon.cpp │ ├── AudioEncoderFdkaac.cpp │ ├── CommonSetting.h │ ├── VideoEncoderFactory.h │ ├── Log.h │ ├── StatsCollector.h │ ├── VideoEncoderFactory.cpp │ ├── MediaConfig.h │ ├── AudioEncoderFdkaac.h │ ├── H264AacUtils.h │ ├── CommonSetting.cpp │ ├── PlatformThreadEx.h │ ├── VideoEncoderBase.cpp │ ├── VideoEncoderX264.h │ ├── FFmpegMux.h │ ├── Common.h │ ├── AudioEncoderBase.h │ ├── RtmpCommon.h │ ├── StatsCollector.cpp │ ├── StatsReport.h │ └── VideoEncoderBase.h ├── android │ ├── CommonSetting_JniWrap.h │ ├── CommonSetting_JniWrap.cpp │ ├── openglcapture │ │ ├── DynamicLibrary.h │ │ ├── GlShader.h │ │ ├── Log.h │ │ ├── DynamicLibrary.cpp │ │ ├── OpenglCapture_JniWrap.h │ │ ├── CMakeLists.txt │ │ ├── OpenglCapture.h │ │ └── GlShader.cpp │ ├── VideoEncoderMediaCodec.h │ └── SVideoStream_JniWrap.h ├── build │ └── build.sh └── AndroidNdkModules.cmake ├── app-debug.apk └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | gradle 2 | .idea 3 | -------------------------------------------------------------------------------- /android/svideostream/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android/svideostream/screenlive/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/sanitizer_options.gyp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/svideostream/magiccameralive/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/tsan/OWNERS: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/memcheck/OWNERS: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /svideostream/src/RtmpCommon.cpp: -------------------------------------------------------------------------------- 1 | #include "RtmpCommon.h" 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/OWNERS: -------------------------------------------------------------------------------- 1 | fbarchard@chromium.org 2 | mflodman@chromium.org 3 | -------------------------------------------------------------------------------- /app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/app-debug.apk -------------------------------------------------------------------------------- /android/svideostream/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':svideostreamlib', ':screenlive', ':magiccameralive' 2 | -------------------------------------------------------------------------------- /thirdparts/librtmp/jni/rtmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/thirdparts/librtmp/jni/rtmp.c -------------------------------------------------------------------------------- /svideostream/src/AudioEncoderFdkaac.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/svideostream/src/AudioEncoderFdkaac.cpp -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file like so: 2 | # Name or Organization 3 | 4 | Google Inc. 5 | -------------------------------------------------------------------------------- /android/svideostream/screenlive/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ScreenLive 3 | 4 | -------------------------------------------------------------------------------- /android/svideostream/libs/androidcomutils-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/libs/androidcomutils-1.1.jar -------------------------------------------------------------------------------- /android/svideostream/libs/magiccameralib-2.1.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/libs/magiccameralib-2.1.aar -------------------------------------------------------------------------------- /android/svideostream/libs/openglesutils-2.1.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/libs/openglesutils-2.1.aar -------------------------------------------------------------------------------- /android/svideostream/magiccameralive/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | magiccameralive 3 | 4 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | svideostreamlib 3 | 4 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/unit_test/testdata/tegra3.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/thirdparts/libyuv/jni/unit_test/testdata/tegra3.txt -------------------------------------------------------------------------------- /android/svideostream/screenlive/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /android/svideostream/magiccameralive/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/svideostream/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/drawable/recordcheckbox_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /thirdparts/download-x264.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | LOCAL_PATH=`pwd` 5 | X264PATH=$LOCAL_PATH/x264 6 | if [ ! -d "$X264PATH" ]; then 7 | git clone http://git.videolan.org/git/x264.git 8 | fi 9 | 10 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/jniLibs/armeabi-v7a/libsvideostream.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showwaychen/svideostream/HEAD/android/svideostream/svideostreamlib/src/main/jniLibs/armeabi-v7a/libsvideostream.so -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/Application.mk: -------------------------------------------------------------------------------- 1 | # The ARMv7 is significanly faster due to the use of the hardware FPU 2 | APP_ABI := armeabi armeabi-v7a x86 mips arm64-v8a x86_64 3 | APP_MODULES := libyuv 4 | APP_PLATFORM := android-14 5 | -------------------------------------------------------------------------------- /thirdparts/librtmp/jni/Application.mk: -------------------------------------------------------------------------------- 1 | # The ARMv7 is significanly faster due to the use of the hardware FPU 2 | APP_ABI := armeabi armeabi-v7a x86 mips arm64-v8a x86_64 3 | APP_MODULES := librtmp 4 | APP_PLATFORM := android-14 5 | -------------------------------------------------------------------------------- /thirdparts/download-baselib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | LOCAL_PATH=`pwd` 5 | BASELIBPATH=$LOCAL_PATH/baselib 6 | if [ ! -d "$BASELIBPATH" ]; then 7 | git clone https://github.com/showwaychen/baselib.git 8 | fi 9 | 10 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/chromium/README: -------------------------------------------------------------------------------- 1 | This .gclient file is used to do download a copy of Chromium. 2 | Libyuv uses the Chromium build toolchain and a number of shared 3 | dependencies by creating symlinks to folders in this checkout, 4 | using the ../setup_links.py script. 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/README.chromium: -------------------------------------------------------------------------------- 1 | Name: libyuv 2 | URL: http://code.google.com/p/libyuv/ 3 | Version: 1180 4 | License: BSD 5 | License File: LICENSE 6 | 7 | Description: 8 | libyuv is an open source project that includes 9 | YUV conversion and scaling functionality. 10 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/tsan/suppressions.txt: -------------------------------------------------------------------------------- 1 | # This file is used in addition to the one already maintained in Chrome. 2 | # It acts as a place holder for future additions for this project. 3 | # It must exist for the Python wrapper script to work properly. 4 | 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/build-baselib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ x$NDKROOT = "x" ] 4 | then 5 | echo ERROR:NDKROOT env variable is not set 6 | exit 1; 7 | fi 8 | # Environment 9 | cd ./baselib/build 10 | rm -R CMake* 11 | sh androidbuild.sh 12 | make clean 13 | make -j4 14 | make install 15 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/memcheck/suppressions.txt: -------------------------------------------------------------------------------- 1 | # This file is used in addition to the one already maintained in Chrome. 2 | # It acts as a place holder for future additions for this project. 3 | # It must exist for the Python wrapper script to work properly. 4 | 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/tsan/suppressions_mac.txt: -------------------------------------------------------------------------------- 1 | # This file is used in addition to the one already maintained in Chrome. 2 | # It acts as a place holder for future additions for this project. 3 | # It must exist for the Python wrapper script to work properly. 4 | 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/tsan/suppressions_win32.txt: -------------------------------------------------------------------------------- 1 | # This file is used in addition to the one already maintained in Chrome. 2 | # It acts as a place holder for future additions for this project. 3 | # It must exist for the Python wrapper script to work properly. 4 | 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/memcheck/suppressions_mac.txt: -------------------------------------------------------------------------------- 1 | # This file is used in addition to the one already maintained in Chrome. 2 | # It acts as a place holder for future additions for this project. 3 | # It must exist for the Python wrapper script to work properly. 4 | 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/valgrind-libyuv/memcheck/suppressions_win32.txt: -------------------------------------------------------------------------------- 1 | # This file is used in addition to the one already maintained in Chrome. 2 | # It acts as a place holder for future additions for this project. 3 | # It must exist for the Python wrapper script to work properly. 4 | 5 | 6 | -------------------------------------------------------------------------------- /thirdparts/download-ffmpeg.sh: -------------------------------------------------------------------------------- 1 | 2 | set -e 3 | 4 | LOCAL_PATH=`pwd` 5 | FFMPEGPATH=$LOCAL_PATH/FFmpeg-n3.3.4 6 | if [ ! -d "$FFMPEGPATH" ]; then 7 | wget -O FFmpeg-n3.3.4.zip https://codeload.github.com/FFmpeg/FFmpeg/zip/n3.3.4 8 | unzip FFmpeg-n3.3.4.zip 9 | ln -s FFmpeg-n3.3.4 ffmpeg 10 | fi 11 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /thirdparts/download-fdkaac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | LOCAL_PATH=`pwd` 5 | FDKAACPATH=$LOCAL_PATH/fdk-aac-0.1.5 6 | if [ ! -d "$FDKAACPATH" ]; then 7 | wget https://nchc.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.5.tar.gz 8 | tar -xf fdk-aac-0.1.5.tar.gz 9 | ln -s fdk-aac-0.1.5 fdk 10 | fi 11 | 12 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/LICENSE_THIRD_PARTY: -------------------------------------------------------------------------------- 1 | This source tree contains third party source code which is governed by third 2 | party licenses. This file contains references to files which are under other 3 | licenses than the one provided in the LICENSE file in the root of the source 4 | tree. 5 | 6 | Files governed by third party licenses: 7 | source/x86inc.asm 8 | 9 | -------------------------------------------------------------------------------- /svideostream/android/CommonSetting_JniWrap.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMONSETTING_JNIWRAP_H_ 2 | #define COMMONSETTING_JNIWRAP_H_ 3 | #include "android/jnihelper/jni_classloader.h" 4 | 5 | class CCommonSetting_JniWrap 6 | { 7 | public: 8 | static CRegisterNativeM s_registernm; 9 | static void JNICALL nativeSetLogLevel(JNIEnv *env, jclass thiz, jint level); 10 | 11 | }; 12 | #endif 13 | -------------------------------------------------------------------------------- /svideostream/src/CommonSetting.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_SETTING_H__ 2 | #define __COMMON_SETTING_H__ 3 | #include 4 | #include 5 | #include "base/logging.h" 6 | class CCommonSetting 7 | { 8 | public: 9 | static void SetLogLevel(int level); 10 | static void StartLeakMemDetect(); 11 | static void StopLeakMemDetect(); 12 | }; 13 | 14 | #endif 15 | 16 | 17 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/java/cn/cxw/svideostreamlib/CommonSetting.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostreamlib; 2 | 3 | /** 4 | * Created by user on 2017/10/18. 5 | */ 6 | 7 | public class CommonSetting { 8 | static 9 | { 10 | System.loadLibrary("svideostream"); 11 | } 12 | public static native void nativeSetLogLevel(int level); 13 | } 14 | -------------------------------------------------------------------------------- /thirdparts/librtmp/jni/librtmp.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=@libdir@ 4 | incdir=${prefix}/include 5 | 6 | Name: librtmp 7 | Description: RTMP implementation 8 | Version: @VERSION@ 9 | Requires: @CRYPTO_REQ@ 10 | URL: http://rtmpdump.mplayerhq.hu 11 | Libs: -L${libdir} -lrtmp -lz @PUBLIC_LIBS@ 12 | Libs.private: @PRIVATE_LIBS@ 13 | Cflags: -I${incdir} 14 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/unit_test/testdata/arm_v7.txt: -------------------------------------------------------------------------------- 1 | Processor : ARMv7 Processor rev 5 (v7l) 2 | BogoMIPS : 795.44 3 | Features : swp half thumb fastmult vfp edsp iwmmxt thumbee vfpv3 vfpv3d16 4 | CPU implementer : 0x56 5 | CPU architecture: 7 6 | CPU variant : 0x0 7 | CPU part : 0x581 8 | CPU revision : 5 9 | 10 | Hardware : OLPC XO-1.75 11 | Revision : 0000 12 | Serial : 0000000000000000 13 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/public.mk: -------------------------------------------------------------------------------- 1 | # This file contains all the common make variables which are useful for 2 | # anyone depending on this library. 3 | # Note that dependencies on NDK are not directly listed since NDK auto adds 4 | # them. 5 | 6 | LIBYUV_INCLUDES := $(LIBYUV_PATH)/include 7 | 8 | LIBYUV_C_FLAGS := 9 | 10 | LIBYUV_CPP_FLAGS := 11 | 12 | LIBYUV_LDLIBS := 13 | LIBYUV_DEP_MODULES := 14 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/tools/lsan/suppressions.txt: -------------------------------------------------------------------------------- 1 | # This is a suppressions file that must exist in order for the Leak Sanitizer 2 | # tool that runs on the ASan bot to be able to run with the default 3 | # configuration. More info about LSan on 4 | # http://www.chromium.org/developers/testing/leaksanitizer 5 | 6 | #### Third-party leaks #### 7 | 8 | #### Actual bugs in Libyuv code #### 9 | 10 | 11 | -------------------------------------------------------------------------------- /svideostream/src/VideoEncoderFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef VIDEOENCODER_FACTORY_H__ 2 | #define VIDEOENCODER_FACTORY_H__ 3 | #include 4 | 5 | class CVideoEncoderBase; 6 | class CVideoEncoderFactory 7 | { 8 | public: 9 | enum VideoEncoderType 10 | { 11 | H264ENCODER_X264 = 0, 12 | H264ENCODER_MEDIACODEC 13 | }; 14 | static std::shared_ptr CreateVideoEncoder(VideoEncoderType type); 15 | }; 16 | #endif 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/codereview.settings: -------------------------------------------------------------------------------- 1 | # This file is used by gcl to get repository specific information. 2 | # The LibYuv code review is via WebRtc's code review 3 | CODE_REVIEW_SERVER: webrtc-codereview.appspot.com 4 | #CC_LIST: 5 | VIEW_VC: https://code.google.com/p/libyuv/source/detail?r= 6 | #STATUS: 7 | TRY_ON_UPLOAD: False 8 | TRYSERVER_ROOT: src 9 | TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-libyuv 10 | #GITCL_PREUPLOAD: 11 | #GITCL_PREDCOMMIT: 12 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/unit_test/testdata/juno.txt: -------------------------------------------------------------------------------- 1 | Processor : AArch64 Processor rev 0 (aarch64) 2 | processor : 0 3 | processor : 1 4 | processor : 2 5 | processor : 3 6 | processor : 4 7 | processor : 5 8 | Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 9 | CPU implementer : 0x41 10 | CPU architecture: AArch64 11 | CPU variant : 0x0 12 | CPU part : 0xd07 13 | CPU revision : 0 14 | 15 | Hardware : Juno 16 | -------------------------------------------------------------------------------- /thirdparts/librtmp/jni/Android.mk: -------------------------------------------------------------------------------- 1 | # This is the Android makefile for librtmp 2 | LOCAL_PATH:= $(call my-dir) 3 | 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES := \ 7 | amf.c \ 8 | hashswf.c \ 9 | log.c \ 10 | parseurl.c \ 11 | rtmp.c 12 | 13 | #LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) 14 | #LOCAL_C_INCLUDES += $(LOCAL_PATH) 15 | 16 | LOCAL_CFLAGS += -DNO_CRYPTO 17 | 18 | LOCAL_MODULE := librtmp 19 | LOCAL_MODULE_TAGS := optional 20 | 21 | include $(BUILD_STATIC_LIBRARY) 22 | -------------------------------------------------------------------------------- /svideostream/src/Log.h: -------------------------------------------------------------------------------- 1 | #ifndef LOG_H_ 2 | #define LOG_H_ 3 | #include "base/logging.h" 4 | #define SVPALYERLOG_TAG "svideostreamjni" 5 | 6 | #define ALOG(sev) \ 7 | LOG_SEVERITY_PRECONDITION(rtc::sev) \ 8 | rtc::LogMessage(__FILE__, __LINE__, rtc::sev, SVPALYERLOG_TAG).stream() 9 | 10 | #define LOGV \ 11 | ALOG(LS_VERBOSE) 12 | #define LOGI \ 13 | ALOG(LS_INFO) 14 | #define LOGW \ 15 | ALOG(LS_WARNING) 16 | #define LOGE \ 17 | ALOG(LS_ERROR) 18 | #define LOGD \ 19 | ALOG(LS_INFO) 20 | 21 | 22 | #endif /* LOG_H_ */ 23 | -------------------------------------------------------------------------------- /android/svideostream/app/src/test/java/cn/cxw/svideostream/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /android/svideostream/screenlive/src/test/java/cn/cxw/screenlive/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.screenlive; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /thirdparts/build-libyuv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ x$NDKROOT = "x" ] 4 | then 5 | echo ERROR:NDKROOT env variable is not set 6 | exit 1; 7 | fi 8 | # Environment 9 | pushd ./ 10 | cd ./libyuv/jni 11 | $NDKROOT/ndk-build clean 12 | $NDKROOT/ndk-build 13 | popd 14 | ABIS=('armeabi' 'armeabi-v7a' 'x86' 'mips' 'arm64-v8a' 'x86_64') 15 | for ABI in ${ABIS[@]} 16 | do 17 | dst_dir=./build/${ABI}/libyuv/lib 18 | mkdir -p ${dst_dir} 19 | cp -f ./libyuv/obj/local/${ABI}/libyuv.a ${dst_dir} 20 | done 21 | 22 | rm -rf ./libyuv/obj 23 | 24 | 25 | -------------------------------------------------------------------------------- /thirdparts/build-librtmp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ x$NDKROOT = "x" ] 4 | then 5 | echo ERROR:NDKROOT env variable is not set 6 | exit 1; 7 | fi 8 | # Environment 9 | pushd ./ 10 | cd ./librtmp/jni 11 | $NDKROOT/ndk-build clean 12 | $NDKROOT/ndk-build 13 | popd 14 | ABIS=('armeabi' 'armeabi-v7a' 'x86' 'mips' 'arm64-v8a' 'x86_64') 15 | for ABI in ${ABIS[@]} 16 | do 17 | dst_dir=./build/${ABI}/librtmp/lib 18 | mkdir -p ${dst_dir} 19 | cp -f ./librtmp/obj/local/${ABI}/librtmp.a ${dst_dir} 20 | done 21 | 22 | rm -rf ./librtmp/obj 23 | 24 | 25 | -------------------------------------------------------------------------------- /android/svideostream/magiccameralive/src/test/java/cn/cxw/magiccameralive/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.magiccameralive; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/test/java/cn/cxw/svideostreamlib/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostreamlib; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /svideostream/src/StatsCollector.h: -------------------------------------------------------------------------------- 1 | #ifndef STATS_COLLECTOR_H_ 2 | #define STATS_COLLECTOR_H_ 3 | #include 4 | #include "StatsReport.h" 5 | class CSVideoStream; 6 | class CStatsCollector 7 | { 8 | CStatsReport m_cStatsReportVideoEncoder; 9 | CStatsReport m_cStatsReportImageProcess; 10 | CStatsReport m_cStatsReportRtmpLive; 11 | 12 | CSVideoStream* m_pPc = nullptr; 13 | 14 | public: 15 | explicit CStatsCollector(CSVideoStream* pc); 16 | void UpdateStats(); 17 | void GetStats(StatsReports* reports); 18 | ~CStatsCollector(); 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /svideostream/android/CommonSetting_JniWrap.cpp: -------------------------------------------------------------------------------- 1 | #include "CommonSetting_JniWrap.h" 2 | #include "../src/CommonSetting.h" 3 | 4 | 5 | static JNINativeMethod ls_nm[] = { 6 | { "nativeSetLogLevel", "(I)V", reinterpret_cast( 7 | &CCommonSetting_JniWrap::nativeSetLogLevel) } 8 | }; 9 | CRegisterNativeM CCommonSetting_JniWrap::s_registernm("cn/cxw/svideostreamlib/CommonSetting", ls_nm, ARRAYSIZE(ls_nm)); 10 | void JNICALL CCommonSetting_JniWrap::nativeSetLogLevel(JNIEnv *env, jclass thiz, jint level) 11 | { 12 | CCommonSetting::SetLogLevel(level); 13 | } 14 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/.gitignore: -------------------------------------------------------------------------------- 1 | .gn 2 | build 3 | buildtools 4 | chromium/.gclient_entries 5 | chromium/.last_sync_chromium 6 | chromium/src/ 7 | google_apis 8 | links 9 | net 10 | out/ 11 | testing 12 | third_party/ 13 | tools/android 14 | tools/clang 15 | tools/find_depot_tools.py 16 | tools/gn 17 | tools/gyp 18 | tools/memory 19 | tools/python 20 | tools/valgrind 21 | tools/win 22 | 23 | # Files generated by CMake build 24 | CMakeFiles/ 25 | CMakeCache.txt 26 | Makefile 27 | convert 28 | libgtest.a 29 | libyuv.a 30 | libyuv_unittest 31 | cmake_install.cmake 32 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/java/cn/cxw/svideostream/fragments/SettingsFragment.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.preference.PreferenceFragmentCompat; 5 | 6 | import cn.cxw.svideostream.R; 7 | 8 | /** 9 | * Created by cxw on 2017/11/2. 10 | */ 11 | 12 | public class SettingsFragment extends PreferenceFragmentCompat { 13 | 14 | @Override 15 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 16 | addPreferencesFromResource(R.xml.preferences); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | svideostream 3 | stop 4 | start record 5 | start capture for record 6 | start capture for live 7 | stop record 8 | start live 9 | stop live 10 | 11 | filter 12 | 13 | -------------------------------------------------------------------------------- /svideostream/src/VideoEncoderFactory.cpp: -------------------------------------------------------------------------------- 1 | #include "VideoEncoderFactory.h" 2 | #include "VideoEncoderX264.h" 3 | #if defined(SVS_ANDROID) 4 | #include "../android/VideoEncoderMediaCodec.h" 5 | #endif 6 | 7 | std::shared_ptr CVideoEncoderFactory::CreateVideoEncoder(VideoEncoderType type) 8 | { 9 | if (H264ENCODER_X264 == type) 10 | { 11 | return std::make_shared(); 12 | } 13 | #if defined(SVS_ANDROID) 14 | else if (H264ENCODER_MEDIACODEC == type) 15 | { 16 | return std::make_shared(); 17 | } 18 | #endif 19 | return nullptr; 20 | } 21 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #000000 7 | #ffffff 8 | #33808080 9 | #d3d3d3 10 | #00ffff 11 | #008B8B 12 | #20b2aa 13 | 14 | #77000000 15 | 16 | -------------------------------------------------------------------------------- /android/svideostream/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.0.0' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | google() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/include/libyuv/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT 12 | #define INCLUDE_LIBYUV_VERSION_H_ 13 | 14 | #define LIBYUV_VERSION 1180 15 | 16 | #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT 17 | -------------------------------------------------------------------------------- /svideostream/android/openglcapture/DynamicLibrary.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class DynamicLibrary 7 | { 8 | public: 9 | DynamicLibrary(const char *fileName); 10 | ~DynamicLibrary(); 11 | 12 | void *getFunctionPtr(const char *name) const; 13 | 14 | DynamicLibrary(const DynamicLibrary &) = delete; 15 | DynamicLibrary & operator = (const DynamicLibrary &other) = delete; 16 | 17 | private: 18 | void *libHandle; 19 | }; 20 | 21 | class OpenLibFailedException: public std::exception 22 | { 23 | virtual const char* what() const throw() 24 | { 25 | return "Failed to open Library"; 26 | } 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /svideostream/src/MediaConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef MEDIA_CONFIG_H_ 2 | #define MEDIA_CONFIG_H_ 3 | #include 4 | class CMediaConfig 5 | { 6 | public: 7 | 8 | std::map m_Configs; 9 | void PutConfig(const std::string& key, const std::string& value) 10 | { 11 | m_Configs[key] = value; 12 | } 13 | bool GetConfigFromKey(const std::string& key, std::string& value) 14 | { 15 | if (m_Configs.count(key) == 0) 16 | { 17 | return false; 18 | } 19 | value = m_Configs[key]; 20 | return true; 21 | } 22 | const std::map& Configs() 23 | { 24 | return m_Configs; 25 | } 26 | void Clear() 27 | { 28 | m_Configs.clear(); 29 | } 30 | }; 31 | #endif -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/chromium/.gclient: -------------------------------------------------------------------------------- 1 | solutions = [{ 2 | 'name': 'src', 3 | 'url': 'https://chromium.googlesource.com/chromium/src.git', 4 | 'deps_file': '.DEPS.git', 5 | 'managed': False, 6 | 'custom_deps': { 7 | # Skip syncing some large dependencies Libyuv will never need. 8 | 'src/chrome/tools/test/reference_build/chrome_linux': None, 9 | 'src/chrome/tools/test/reference_build/chrome_mac': None, 10 | 'src/chrome/tools/test/reference_build/chrome_win': None, 11 | 'src/native_client': None, 12 | 'src/third_party/ffmpeg': None, 13 | 'src/third_party/WebKit': None, 14 | 'src/v8': None, 15 | }, 16 | 'safesync_url': '' 17 | }] 18 | 19 | cache_dir = None 20 | -------------------------------------------------------------------------------- /svideostream/android/openglcapture/GlShader.h: -------------------------------------------------------------------------------- 1 | #ifndef GLSHADER_H_ 2 | #define GLSHADER_H_ 3 | #include "GLES2/gl2.h" 4 | #include 5 | class CGlShader 6 | { 7 | protected: 8 | int m_nVertexShader; 9 | int m_nFragmentShader; 10 | int m_nProgram; 11 | int m_nState; 12 | int CompileShader(int shaderType, const std::string& source); 13 | public: 14 | CGlShader(const std::string& vertexSource, const std::string& fragmentSource); 15 | 16 | int GetAttribLocation(const std::string& label); 17 | void SetVertexAttribArray(const std::string& label, int dimension, float* buffer); 18 | int GetUniformLocation(const std::string& label); 19 | bool UseProgram(); 20 | void Release(); 21 | }; 22 | #endif 23 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/all.gyp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 The LibYuv Project Authors. All rights reserved. 2 | # 3 | # Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file in the root of the source 5 | # tree. An additional intellectual property rights grant can be found 6 | # in the file PATENTS. All contributing project authors may 7 | # be found in the AUTHORS file in the root of the source tree. 8 | 9 | # all.gyp and All target are for benefit of android gyp build. 10 | { 11 | 'targets': [ 12 | { 13 | 'target_name': 'All', 14 | 'type': 'none', 15 | 'dependencies': [ 16 | 'libyuv.gyp:*', 17 | 'libyuv_test.gyp:*', 18 | ], 19 | }, 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### svideostream 2 | 3 | # a android video recording and living library 4 | 5 | ### Features 6 | cpu: ARMv7a 7 | camera streaming with beauty filter 8 | screen streaming 9 | H264: x264 Android MediaCodec 10 | AAC: fdkaac 11 | 12 | ### Build 13 | export NDKROOT= your ndk root path 14 | 15 | cd thirdparts 16 | ./download-baselib.sh 17 | ./download-ffmpeg.sh 18 | ./download-fdkaac.sh 19 | ./download-x264.sh 20 | ./build-fdk.sh 21 | ./build-librtmp.sh 22 | ./build-libyuv.sh 23 | ./build-x264.sh 24 | ./build-baselib.sh 25 | ./build-ffmpeg.sh 26 | 27 | 28 | cd svideostream/build 29 | ./build.sh 30 | make -j4 31 | 32 | output directory is svideostream/libs/armeabi-v7a 33 | -------------------------------------------------------------------------------- /svideostream/android/openglcapture/Log.h: -------------------------------------------------------------------------------- 1 | #ifndef LOG_H_ 2 | #define LOG_H_ 3 | #include "base/logging.h" 4 | #define SVPALYERLOG_TAG "openglcapturejni" 5 | 6 | #define ALOG(sev) \ 7 | LOG_SEVERITY_PRECONDITION(rtc::sev) \ 8 | rtc::LogMessage(__FILE__, __LINE__, rtc::sev, SVPALYERLOG_TAG).stream() 9 | 10 | #define LOGV \ 11 | ALOG(LS_VERBOSE) 12 | #define LOGI \ 13 | ALOG(LS_INFO) 14 | #define LOGW \ 15 | ALOG(LS_WARNING) 16 | #define LOGE \ 17 | ALOG(LS_ERROR) 18 | #define LOGD \ 19 | ALOG(LS_INFO) 20 | 21 | class CCommonSetting 22 | { 23 | public: 24 | static void SetLogLevel(int level) 25 | { 26 | rtc::LogMessage::SetMinLogSeverity((rtc::LoggingSeverity)level); 27 | rtc::LogMessage::LogToDebug((rtc::LoggingSeverity)rtc::LogMessage::GetMinLogSeverity()); 28 | } 29 | 30 | }; 31 | #endif /* LOG_H_ */ 32 | -------------------------------------------------------------------------------- /android/svideostream/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /svideostream/android/openglcapture/DynamicLibrary.cpp: -------------------------------------------------------------------------------- 1 | #include "DynamicLibrary.h" 2 | 3 | #include 4 | #include 5 | #include "Log.h" 6 | 7 | DynamicLibrary::DynamicLibrary(const char *fileName) 8 | { 9 | LOGI << "DynamicLibrary filename = "<< fileName; 10 | libHandle = dlopen(fileName, RTLD_LAZY); 11 | if (!libHandle) 12 | { 13 | LOGE << "dlopen "<< fileName<<" failed"; 14 | } 15 | if (!libHandle) throw OpenLibFailedException(); 16 | } 17 | 18 | DynamicLibrary::~DynamicLibrary() 19 | { 20 | if (libHandle) dlclose(libHandle); 21 | } 22 | 23 | void *DynamicLibrary::getFunctionPtr(const char *name) const 24 | { 25 | auto ret = (void *)dlsym(libHandle, name); 26 | if (ret == nullptr) { 27 | std::cerr << "Failed to get function " << name << std::endl; 28 | } 29 | return ret; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /svideostream/build/build.sh: -------------------------------------------------------------------------------- 1 | #cmake ../ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_NDK=/home/vmuser/android-ndk-r12b/ -DCMAKE_ANDROID_STL_TYPE=gnustl_static 2 | #rm -R CMake* cmake* Makefile 3 | 4 | #export ANDROID_NDK=/home/vmuser/android-ndk-r12b/ 5 | #export ANDROID_NATIVE_API_LEVEL=15 6 | 7 | #$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=/tmp/android-toolchain --ndk-dir=$ANDROID_NDK --toolchain=arm-linux-androideabi-4.9 8 | 9 | #export PATH=$PATH:/tmp/android-toolchain/bin/ 10 | #export ANDROID_STANDALONE_TOOLCHAIN=/tmp/android-toolchain/ 11 | cmake ../ -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_NATIVE_API_LEVEL=15 -DANDROID_NDK=$NDKROOT -DANDROID_STL=gnustl_static -DCMAKE_BUILD_TYPE=Release 12 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/java/cn/cxw/svideostream/application/GlobalSetting.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream.application; 2 | 3 | import android.os.Environment; 4 | import android.util.Log; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | * Created by user on 2017/11/23. 10 | */ 11 | 12 | public class GlobalSetting { 13 | public static String getRecordPath() 14 | { 15 | String recordpath = Environment.getExternalStorageDirectory() + "/svideostream/"; 16 | File file = new File(recordpath); 17 | if (!file.exists()) 18 | { 19 | if (!file.mkdir()) 20 | { 21 | Log.e("getRecordPath", " mkdirs failed"); 22 | } 23 | } 24 | return recordpath; 25 | } 26 | public static String getLiveUrl() 27 | { 28 | return "rtmp://940239"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /android/svideostream/screenlive/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/svideostream/magiccameralive/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /android/svideostream/app/src/androidTest/java/cn/cxw/svideostream/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("cn.cxw.svideostream", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /svideostream/src/AudioEncoderFdkaac.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIO_ENCODER_FDKAAC_H_ 2 | #define AUDIO_ENCODER_FDKAAC_H_ 3 | #include "AudioEncoderBase.h" 4 | #include "aacenc_lib.h" 5 | #include "PlatformThreadEx.h" 6 | #include "BufferQuene.h" 7 | #include 8 | class CAudioEncoderFdkaac :public CAudioEncoderBase 9 | { 10 | bool m_bAbort = false; 11 | HANDLE_AACENCODER m_handle; 12 | CHANNEL_MODE m_eMode; 13 | AACENC_InfoStruct m_sInfo; 14 | bool m_bEncoderOk = false; 15 | bool OnAudioEncoderThread(); 16 | CPlatformThreadEx m_hEncodeThread; 17 | CBufferQueneEx m_qFrameQ; 18 | public: 19 | CAudioEncoderFdkaac(); 20 | ~CAudioEncoderFdkaac(); 21 | virtual int OpenEncoder(); 22 | 23 | virtual int CloseEncoder(); 24 | 25 | virtual int PushData(uint8_t *audiodata, int nsize, int64_t pts); 26 | 27 | virtual sAacCodecInfo GetCodecInfo(); 28 | 29 | virtual int StartEncode() override; 30 | 31 | }; 32 | #endif -------------------------------------------------------------------------------- /android/svideostream/screenlive/src/androidTest/java/cn/cxw/screenlive/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.screenlive; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("cn.cxw.screenlive.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/layout/table_stream_info_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 24 | 25 | -------------------------------------------------------------------------------- /android/svideostream/magiccameralive/src/androidTest/java/cn/cxw/magiccameralive/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.magiccameralive; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("cn.cxw.magiccameralive.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/androidTest/java/cn/cxw/svideostreamlib/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostreamlib; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("cn.cxw.svideostreamlib.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /svideostream/src/H264AacUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef H264AAC_UTILS_H_ 2 | #define H264AAC_UTILS_H_ 3 | #include "Common.h" 4 | #define NALTYPE_SLICE_IDR (5) 5 | #define NALTYPE_SLICE_SEI (6) 6 | #define NALTYPE_SLICE_SPS (7) 7 | #define NALTYPE_SLICE_PPS (8) 8 | 9 | 10 | class CH264AacUtils 11 | { 12 | public: 13 | enum FRAMETYPE 14 | { 15 | NONEFRAME, 16 | I_FRAME, 17 | P_FRAME, 18 | B_FRAME 19 | }; 20 | static int GetFrameSize(ImageFormat format, int stride, int height); 21 | static bool IsKeyFrame(uint8_t* vdata, int nsize, bool annexb = true); 22 | //static FRAMETYPE FrameType(uint8_t* vdata, int nsize, bool annexb = true); 23 | static void ConvertAVCCToAnnexB(uint8_t *data, int size); 24 | static int ExtractSPSData(uint8_t *data, int size, uint8_t* outbuf, int outbufsize, bool annexb = true); 25 | static int ExtractPPSData(uint8_t *data, int size, uint8_t* outbuf, int outbufsize, bool annexb = true); 26 | 27 | }; 28 | #endif -------------------------------------------------------------------------------- /android/svideostream/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\android/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\android/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /svideostream/src/CommonSetting.cpp: -------------------------------------------------------------------------------- 1 | #include "CommonSetting.h" 2 | #if defined(LEAKTRACER) 3 | #include "MemoryTrace.hpp" 4 | #include 5 | #endif 6 | #include "Log.h" 7 | void CCommonSetting::SetLogLevel(int level) 8 | { 9 | rtc::LogMessage::SetMinLogSeverity((rtc::LoggingSeverity)level); 10 | rtc::LogMessage::LogToDebug((rtc::LoggingSeverity)rtc::LogMessage::GetMinLogSeverity()); 11 | 12 | } 13 | 14 | void CCommonSetting::StartLeakMemDetect() 15 | { 16 | #if defined(LEAKTRACER) 17 | leaktracer::MemoryTrace::GetInstance().startMonitoringAllThreads(); 18 | 19 | #endif 20 | 21 | } 22 | void CCommonSetting::StopLeakMemDetect() 23 | { 24 | #if defined(LEAKTRACER) 25 | //leaktracer::MemoryTrace::GetInstance().stopMonitoringAllocations(); 26 | leaktracer::MemoryTrace::GetInstance().stopAllMonitoring(); 27 | std::ofstream oleaks; 28 | oleaks.open("/storage/emulated/0/leaks.out", std::ios_base::out); 29 | if (oleaks.is_open()) 30 | leaktracer::MemoryTrace::GetInstance().writeLeaks(oleaks); 31 | else 32 | LOGE << "Failed to write to \"leaks.out\"\n"; 33 | 34 | #endif 35 | 36 | } -------------------------------------------------------------------------------- /svideostream/src/PlatformThreadEx.h: -------------------------------------------------------------------------------- 1 | #ifndef PLATFORM_THREADEX_H_ 2 | #define PLATFORM_THREADEX_H_ 3 | #include"base/platform_thread.h" 4 | #include "Log.h" 5 | 6 | template 7 | class CPlatformThreadEx :public rtc::PlatformThread 8 | { 9 | public: 10 | typedef bool (T::*ThreadFun)(); 11 | protected: 12 | T* m_obj; 13 | ThreadFun m_fun; 14 | static bool ThreadRunCallBack(void* arg) 15 | { 16 | CPlatformThreadEx* obj = (CPlatformThreadEx*)arg; //??? 17 | if (obj != nullptr) 18 | { 19 | return obj->OnThreadRunCallBack(); 20 | } 21 | return true; 22 | } 23 | bool OnThreadRunCallBack() 24 | { 25 | if (m_obj == nullptr || m_fun == nullptr) 26 | { 27 | LOGE << "obj is null or fun is null "<< m_obj<< " m_fun "<*m_fun)(); 31 | } 32 | 33 | public: 34 | 35 | CPlatformThreadEx(T* obj, ThreadFun tfun, const char* threadname) 36 | :rtc::PlatformThread(&CPlatformThreadEx::ThreadRunCallBack, this, threadname) 37 | { 38 | m_obj = obj; 39 | m_fun = tfun; 40 | } 41 | ~CPlatformThreadEx() 42 | { 43 | Stop(); 44 | } 45 | 46 | }; 47 | #endif -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/download_vs_toolchain.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2014 The LibYuv Project Authors. All rights reserved. 4 | # 5 | # Use of this source code is governed by a BSD-style license 6 | # that can be found in the LICENSE file in the root of the source 7 | # tree. An additional intellectual property rights grant can be found 8 | # in the file PATENTS. All contributing project authors may 9 | # be found in the AUTHORS file in the root of the source tree. 10 | 11 | # This script is used to run the vs_toolchain.py script to download the 12 | # Visual Studio toolchain. It's just a temporary measure while waiting for the 13 | # Chrome team to move find_depot_tools into src/build to get rid of these 14 | # workarounds (similar one in gyp_libyuv). 15 | 16 | import os 17 | import sys 18 | 19 | 20 | checkout_root = os.path.dirname(os.path.realpath(__file__)) 21 | sys.path.insert(0, os.path.join(checkout_root, 'build')) 22 | sys.path.insert(0, os.path.join(checkout_root, 'tools', 'find_depot_tools')) 23 | 24 | 25 | import vs_toolchain 26 | 27 | 28 | if __name__ == '__main__': 29 | sys.exit(vs_toolchain.main()) 30 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/util/ssim.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | // Get SSIM for video sequence. Assuming RAW 4:2:0 Y:Cb:Cr format 12 | 13 | #ifndef UTIL_SSIM_H_ // NOLINT 14 | #define UTIL_SSIM_H_ 15 | 16 | #include // For log10() 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED) 23 | typedef unsigned char uint8; 24 | #define UINT8_TYPE_DEFINED 25 | #endif 26 | 27 | double CalcSSIM(const uint8* org, const uint8* rec, 28 | const int image_width, const int image_height); 29 | 30 | double CalcLSSIM(double ssim); 31 | 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | #endif 35 | 36 | #endif // UTIL_SSIM_H_ // NOLINT 37 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/include/libyuv/rotate_argb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | #ifndef INCLUDE_LIBYUV_ROTATE_ARGB_H_ // NOLINT 12 | #define INCLUDE_LIBYUV_ROTATE_ARGB_H_ 13 | 14 | #include "libyuv/basic_types.h" 15 | #include "libyuv/rotate.h" // For RotationMode. 16 | 17 | #ifdef __cplusplus 18 | namespace libyuv { 19 | extern "C" { 20 | #endif 21 | 22 | // Rotate ARGB frame 23 | LIBYUV_API 24 | int ARGBRotate(const uint8* src_argb, int src_stride_argb, 25 | uint8* dst_argb, int dst_stride_argb, 26 | int src_width, int src_height, enum RotationMode mode); 27 | 28 | #ifdef __cplusplus 29 | } // extern "C" 30 | } // namespace libyuv 31 | #endif 32 | 33 | #endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_ NOLINT 34 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/java/cn/cxw/svideostreamlib/VideoStreamSetting.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostreamlib; 2 | 3 | /** 4 | * Created by cxw on 2017/11/3. 5 | */ 6 | 7 | public class VideoStreamSetting { 8 | public int getVideoEncoderType() 9 | { 10 | return VideoStreamConstants.H264ENCODER_X264; 11 | } 12 | public boolean getAudioEnable() 13 | { 14 | return true; 15 | } 16 | public int getVideoBitrate() 17 | { 18 | return 300000; 19 | } 20 | public int getVideoFps() 21 | { 22 | return 15; 23 | } 24 | public MediaConfig getH264EncoderConfigs() 25 | { 26 | MediaConfig configs = new MediaConfig(); 27 | configs.putConfig(VideoStreamConstants.KEY_PROFILE, VideoStreamConstants.VALUE_BASELINE); 28 | configs.putConfig(VideoStreamConstants.KEY_PRESET, VideoStreamConstants.VALUE_superfast); 29 | configs.putConfig(VideoStreamConstants.KEY_TUNE, VideoStreamConstants.VALUE_zerolatency); 30 | configs.putConfig(VideoStreamConstants.KEY_RC_METHOD, VideoStreamConstants.VALUE_rc_abr); 31 | return configs; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/DEPS: -------------------------------------------------------------------------------- 1 | vars = { 2 | "libyuv_trunk" : "https://libyuv.googlecode.com/svn/trunk", 3 | 4 | # Override root_dir in your .gclient's custom_vars to specify a custom root 5 | # folder name. 6 | "root_dir": "trunk", 7 | "extra_gyp_flag": "-Dextra_gyp_flag=0", 8 | 9 | # Roll the Chromium Git hash to pick up newer versions of all the 10 | # dependencies and tools linked to in setup_links.py. 11 | "chromium_revision": "d8c90415d681a7c3727e3ef70873bc4f44dd3ab0", 12 | } 13 | 14 | hooks = [ 15 | { 16 | # Clone chromium and its deps. 17 | "name": "sync chromium", 18 | "pattern": ".", 19 | "action": ["python", "-u", Var("root_dir") + "/sync_chromium.py", 20 | "--target-revision", Var("chromium_revision")], 21 | }, 22 | { 23 | # Create links to shared dependencies in Chromium. 24 | "name": "setup_links", 25 | "pattern": ".", 26 | "action": ["python", Var("root_dir") + "/setup_links.py"], 27 | }, 28 | { 29 | # A change to a .gyp, .gypi, or to GYP itself should run the generator. 30 | "pattern": ".", 31 | "action": ["python", Var("root_dir") + "/gyp_libyuv"], 32 | }, 33 | ] 34 | -------------------------------------------------------------------------------- /svideostream/src/VideoEncoderBase.cpp: -------------------------------------------------------------------------------- 1 | #include "VideoEncoderBase.h" 2 | 3 | 4 | 5 | void CVideoEncoderBase::OnCallback(uint8_t* data, int nsize, int64_t pts, int64_t dts) 6 | { 7 | auto callback = m_pCallBack.lock(); 8 | if (callback != nullptr) 9 | { 10 | callback->OnVideoEncodedData(data, nsize, pts, dts); 11 | } 12 | } 13 | 14 | int CVideoEncoderBase::StringToProfile(const std::string& profile) 15 | { 16 | if (profile == "baseline") 17 | { 18 | return 66; 19 | } 20 | else if (profile == "main") 21 | { 22 | return 77; 23 | } 24 | else if (profile == "extended") 25 | { 26 | return 88; 27 | } 28 | else if (profile == "high") 29 | { 30 | return 100; 31 | } 32 | else if (profile == "high10") 33 | { 34 | return 110; 35 | } 36 | else if (profile == "high422") 37 | { 38 | return 122; 39 | } 40 | else if (profile == "high444") 41 | { 42 | return 144; 43 | } 44 | return 66; 45 | } 46 | 47 | const char CVideoEncoderBase::kProfile[] = "profile"; 48 | 49 | const char CVideoEncoderBase::kPreset[] = "preset"; 50 | 51 | const char CVideoEncoderBase::kTune[] = "tune"; 52 | 53 | const char CVideoEncoderBase::kRcMethod[] = "rc_method"; 54 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/winarm.mk: -------------------------------------------------------------------------------- 1 | # This is a generic makefile for libyuv for Windows Arm. 2 | # nmake /f winarm.mk 3 | # make -f winarm.mk 4 | # nmake /f winarm.mk clean 5 | # consider /arch:ARMv7VE 6 | CC=cl 7 | CCFLAGS=/Ox /nologo /Iinclude /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP 8 | AR=lib 9 | ARFLAGS=/MACHINE:ARM /NOLOGO /SUBSYSTEM:NATIVE 10 | RM=cmd /c del 11 | 12 | LOCAL_OBJ_FILES = \ 13 | source/compare.o\ 14 | source/compare_common.o\ 15 | source/convert.o\ 16 | source/convert_argb.o\ 17 | source/convert_from.o\ 18 | source/convert_from_argb.o\ 19 | source/convert_to_argb.o\ 20 | source/convert_to_i420.o\ 21 | source/cpu_id.o\ 22 | source/format_conversion.o\ 23 | source/planar_functions.o\ 24 | source/rotate.o\ 25 | source/rotate_argb.o\ 26 | source/row_any.o\ 27 | source/row_common.o\ 28 | source/scale.o\ 29 | source/scale_argb.o\ 30 | source/scale_common.o\ 31 | source/video_common.o 32 | 33 | .cc.o: 34 | $(CC) /c $(CCFLAGS) $*.cc /Fo$@ 35 | 36 | all: libyuv_arm.lib winarm.mk 37 | 38 | libyuv_arm.lib: $(LOCAL_OBJ_FILES) winarm.mk 39 | $(AR) $(ARFLAGS) /OUT:$@ $(LOCAL_OBJ_FILES) 40 | 41 | clean: 42 | $(RM) "source\*.o" libyuv_arm.lib 43 | 44 | -------------------------------------------------------------------------------- /svideostream/src/VideoEncoderX264.h: -------------------------------------------------------------------------------- 1 | #ifndef VIDEO_ENCODER_X264_H_ 2 | #define VIDEO_ENCODER_X264_H_ 3 | #include "VideoEncoderBase.h" 4 | #include "PlatformThreadEx.h" 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "x264.h" 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #include "BufferQuene.h" 15 | class CVideoEncoderX264 :public CVideoEncoderBase 16 | { 17 | x264_t *m_pX264 = nullptr; 18 | bool m_bAbort = false; 19 | int m_nAvgEncodedTimeMs = 0; 20 | CPlatformThreadEx m_hEncodeThread; 21 | CBufferQueneEx m_qVideoFrameQ; 22 | 23 | int m_nLevel = 21; 24 | bool OnEncodeThread(); 25 | void UpdateEncodeTime(int difftime) 26 | { 27 | m_nAvgEncodedTimeMs = (m_nAvgEncodedTimeMs + difftime) / 2; 28 | } 29 | void ConfigSetting(x264_param_t* x264param); 30 | 31 | public: 32 | CVideoEncoderX264(); 33 | virtual int OpenEncoder(); 34 | 35 | virtual int CloseEncoder(); 36 | 37 | virtual int PushData(uint8_t *imagedata, int nsize, int64_t pts); 38 | 39 | virtual sH264CodecInfo GetCodecInfo(); 40 | 41 | virtual int StartEncode() override; 42 | 43 | virtual EncoderRunTimeInfo GetRunTimeInfo(); 44 | ~CVideoEncoderX264(); 45 | 46 | }; 47 | #endif -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/java/cn/cxw/svideostreamlib/MediaConfig.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostreamlib; 2 | 3 | import java.util.HashMap; 4 | import java.util.Iterator; 5 | 6 | /** 7 | * Created by user on 2017/11/16. 8 | */ 9 | 10 | public class MediaConfig { 11 | private final HashMap configs; 12 | 13 | public MediaConfig() { 14 | this.configs = new HashMap<>(); 15 | } 16 | public void putConfig(String key, String value) 17 | { 18 | configs.put(key, value); 19 | } 20 | private static String stringifyKeyValuePairList(HashMap list) { 21 | StringBuilder builder = new StringBuilder("["); 22 | for (HashMap.Entry pair : list.entrySet()) { 23 | if (builder.length() > 1) { 24 | builder.append(", "); 25 | } 26 | builder.append(pair.getKey() + ": " + pair.getValue()); 27 | } 28 | return builder.append("]").toString(); 29 | } 30 | private Iterator getKeySetIte() 31 | { 32 | 33 | return configs.entrySet().iterator(); 34 | } 35 | public String toString() 36 | { 37 | return stringifyKeyValuePairList(configs); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/include/libyuv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | #ifndef INCLUDE_LIBYUV_H_ // NOLINT 12 | #define INCLUDE_LIBYUV_H_ 13 | 14 | #include "libyuv/basic_types.h" 15 | #include "libyuv/compare.h" 16 | #include "libyuv/convert.h" 17 | #include "libyuv/convert_argb.h" 18 | #include "libyuv/convert_from.h" 19 | #include "libyuv/convert_from_argb.h" 20 | #include "libyuv/cpu_id.h" 21 | #include "libyuv/format_conversion.h" 22 | #include "libyuv/mjpeg_decoder.h" 23 | #include "libyuv/planar_functions.h" 24 | #include "libyuv/rotate.h" 25 | #include "libyuv/rotate_argb.h" 26 | #include "libyuv/row.h" 27 | #include "libyuv/scale.h" 28 | #include "libyuv/scale_argb.h" 29 | #include "libyuv/scale_row.h" 30 | #include "libyuv/version.h" 31 | #include "libyuv/video_common.h" 32 | 33 | #endif // INCLUDE_LIBYUV_H_ NOLINT 34 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/libyuv_nacl.gyp: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved. 2 | # 3 | # Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file in the root of the source 5 | # tree. An additional intellectual property rights grant can be found 6 | # in the file PATENTS. All contributing project authors may 7 | # be found in the AUTHORS file in the root of the source tree. 8 | 9 | { 10 | 'includes': [ 11 | 'libyuv.gypi', 12 | '../../native_client/build/untrusted.gypi', 13 | ], 14 | 'targets': [ 15 | { 16 | 'target_name': 'libyuv_nacl', 17 | 'type': 'none', 18 | 'variables': { 19 | 'nlib_target': 'libyuv_nacl.a', 20 | 'build_glibc': 0, 21 | 'build_newlib': 0, 22 | 'build_pnacl_newlib': 1, 23 | }, 24 | 'dependencies': [ 25 | '../../native_client/tools.gyp:prep_toolchain', 26 | ], 27 | 'include_dirs': [ 28 | 'include', 29 | ], 30 | 'direct_dependent_settings': { 31 | 'include_dirs': [ 32 | 'include', 33 | ], 34 | }, 35 | 'sources': [ 36 | '<@(libyuv_sources)', 37 | ], 38 | }, # target libyuv_nacl 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/gyp_libyuv.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2014 The LibYuv Project Authors. All rights reserved. 4 | # 5 | # Use of this source code is governed by a BSD-style license 6 | # that can be found in the LICENSE file in the root of the source 7 | # tree. An additional intellectual property rights grant can be found 8 | # in the file PATENTS. All contributing project authors may 9 | # be found in the AUTHORS file in the root of the source tree. 10 | 11 | 12 | # This script is a modified copy of the src/build/gyp_chromium.py file. 13 | # It is needed for parallel processing. 14 | 15 | # This file is (possibly, depending on python version) imported by 16 | # gyp_libyuv when GYP_PARALLEL=1 and it creates sub-processes 17 | # through the multiprocessing library. 18 | 19 | # Importing in Python 2.6 (fixed in 2.7) on Windows doesn't search for 20 | # imports that don't end in .py (and aren't directories with an 21 | # __init__.py). This wrapper makes "import gyp_libyuv" work with 22 | # those old versions and makes it possible to execute gyp_libyuv.py 23 | # directly on Windows where the extension is useful. 24 | 25 | import os 26 | 27 | path = os.path.abspath(os.path.split(__file__)[0]) 28 | execfile(os.path.join(path, 'gyp_libyuv')) 29 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/java/cn/cxw/svideostream/application/GlobalVideoStream.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream.application; 2 | 3 | import cn.cxw.svideostreamlib.VideoStreamProxy; 4 | 5 | /** 6 | * Created by cxw on 2017/11/19. 7 | */ 8 | 9 | public class GlobalVideoStream { 10 | static VideoStreamProxy mGpuImageSourceUsing = null; 11 | static VideoStreamProxy mScreenCaptureUsing = null; 12 | public static VideoStreamProxy getGPUImageSourceOwn() 13 | { 14 | if (mGpuImageSourceUsing == null) 15 | { 16 | mGpuImageSourceUsing = new VideoStreamProxy(); 17 | } 18 | return mGpuImageSourceUsing; 19 | } 20 | public static VideoStreamProxy getScreenCaptureOwn() 21 | { 22 | if (mScreenCaptureUsing == null) 23 | { 24 | mScreenCaptureUsing = new VideoStreamProxy(); 25 | } 26 | return mScreenCaptureUsing; 27 | } 28 | public static void destroyGlobalVideoStream() 29 | { 30 | if (mScreenCaptureUsing != null) 31 | { 32 | mScreenCaptureUsing.destroyStream(); 33 | } 34 | if (mGpuImageSourceUsing != null) 35 | { 36 | mGpuImageSourceUsing.destroyStream(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/source/compare_common.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | #include "libyuv/basic_types.h" 12 | 13 | #ifdef __cplusplus 14 | namespace libyuv { 15 | extern "C" { 16 | #endif 17 | 18 | uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count) { 19 | uint32 sse = 0u; 20 | int i; 21 | for (i = 0; i < count; ++i) { 22 | int diff = src_a[i] - src_b[i]; 23 | sse += (uint32)(diff * diff); 24 | } 25 | return sse; 26 | } 27 | 28 | // hash seed of 5381 recommended. 29 | // Internal C version of HashDjb2 with int sized count for efficiency. 30 | uint32 HashDjb2_C(const uint8* src, int count, uint32 seed) { 31 | uint32 hash = seed; 32 | int i; 33 | for (i = 0; i < count; ++i) { 34 | hash += (hash << 5) + src[i]; 35 | } 36 | return hash; 37 | } 38 | 39 | #ifdef __cplusplus 40 | } // extern "C" 41 | } // namespace libyuv 42 | #endif 43 | -------------------------------------------------------------------------------- /svideostream/android/openglcapture/OpenglCapture_JniWrap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "android/jnihelper/jni_classloader.h" 3 | #include"android/jnihelper/jni_helpers.h" 4 | 5 | #include 6 | #include "OpenglCapture.h" 7 | class COpenglCapture_JniWrap:public COpenglCapture::IFrameAvaliable 8 | { 9 | public: 10 | static CRegisterNativeM s_registernm; 11 | std::unique_ptr m_pCapturer; 12 | static COpenglCapture_JniWrap* GetInst(JNIEnv* jni, jobject j_object); 13 | 14 | uint8_t *m_pDirectBuffer = nullptr; 15 | //java 16 | ScopedGlobalRef m_pThiz; 17 | jmethodID m_jinitDirectBuffer; 18 | jmethodID m_jdataCallback; 19 | COpenglCapture_JniWrap(JNIEnv *env, jobject thiz); 20 | static jlong JNICALL newinstance(JNIEnv *env, jobject thiz); 21 | static void JNICALL native_destroy(JNIEnv *env, jobject thiz); 22 | static jboolean JNICALL native_initCapture(JNIEnv *env, jobject thiz, jint width, jint height); 23 | static void JNICALL native_deinitCapture(JNIEnv *env, jobject thiz); 24 | static void JNICALL native_captureFrame(JNIEnv *env, jobject thiz, jint textureid); 25 | static void JNICALL native_setDirectBuffer(JNIEnv *env, jobject thiz, jobject bytebuffer); 26 | 27 | 28 | virtual ~COpenglCapture_JniWrap(); 29 | 30 | virtual void OnCapture(const uint8_t* pdata, int nsize, int stride, int64_t pts) override; 31 | 32 | }; -------------------------------------------------------------------------------- /android/svideostream/app/src/main/java/cn/cxw/svideostream/application/MainApplication.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream.application; 2 | 3 | import android.app.Application; 4 | 5 | import com.squareup.leakcanary.LeakCanary; 6 | import com.squareup.leakcanary.RefWatcher; 7 | 8 | import cn.cxw.magiccameralib.MagicCamera; 9 | 10 | /** 11 | * Created by user on 2017/11/3. 12 | */ 13 | 14 | public class MainApplication extends Application { 15 | private static MainApplication instance; 16 | private RefWatcher mRefWatcher; 17 | Setting mSetting = null; 18 | @Override public void onCreate() { 19 | super.onCreate(); 20 | instance = this; 21 | mSetting = new Setting(this); 22 | if (LeakCanary.isInAnalyzerProcess(this)) { 23 | // This process is dedicated to LeakCanary for heap analysis. 24 | // You should not init your app in this process. 25 | return; 26 | } 27 | mRefWatcher = LeakCanary.install(this); 28 | MagicCamera.getInst().setContext(this); 29 | } 30 | public static MainApplication getInstance() { 31 | return instance; 32 | } 33 | public Setting getSetting() 34 | { 35 | return mSetting; 36 | } 37 | public static RefWatcher getRefWatcher() { 38 | return getInstance().mRefWatcher; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/java/cn/cxw/svideostream/utils/PermissionCheck.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostream.utils; 2 | 3 | import android.app.Activity; 4 | import android.content.pm.PackageManager; 5 | import android.support.v4.app.ActivityCompat; 6 | import android.support.v4.content.ContextCompat; 7 | 8 | /** 9 | * Created by user on 2017/10/19. 10 | */ 11 | 12 | public class PermissionCheck { 13 | //已授权. 14 | public static int AUTHPERMISSION = 0; 15 | public static int USEREJECT_NOTIPS = 1; 16 | public static int REQPERMISSION = 2; 17 | 18 | public static final int MY_PERMISSIONS_REQUEST_OK = 1; 19 | 20 | public static int Check(Activity context, String permission, int requestcode) 21 | { 22 | if (ContextCompat.checkSelfPermission(context, 23 | permission) 24 | != PackageManager.PERMISSION_GRANTED) { 25 | if (ActivityCompat.shouldShowRequestPermissionRationale(context, 26 | permission)) { 27 | return USEREJECT_NOTIPS; 28 | } else { 29 | ActivityCompat.requestPermissions(context, 30 | new String[]{permission}, 31 | requestcode); 32 | return REQPERMISSION; 33 | } 34 | } 35 | return AUTHPERMISSION; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /android/svideostream/svideostreamlib/src/main/java/cn/cxw/svideostreamlib/StatsReport.java: -------------------------------------------------------------------------------- 1 | package cn.cxw.svideostreamlib; 2 | 3 | /** 4 | * Created by cxw on 2017/11/17. 5 | */ 6 | 7 | public class StatsReport { 8 | public final String mType; 9 | public final StatsReport.Value[] mValues; 10 | public StatsReport(String type, StatsReport.Value[] values) { 11 | this.mType = type; 12 | this.mValues = values; 13 | } 14 | public String toString() { 15 | StringBuilder builder = new StringBuilder(); 16 | builder.append("type: ").append(this.mType).append(", values: "); 17 | 18 | for(int i = 0; i < this.mValues.length; ++i) { 19 | builder.append(this.mValues[i].toString()).append(", "); 20 | } 21 | 22 | return builder.toString(); 23 | } 24 | public static class Value { 25 | public final String name; 26 | public final String value; 27 | 28 | public Value(String name, String value) { 29 | this.name = name; 30 | this.value = value; 31 | } 32 | 33 | public String toString() { 34 | StringBuilder builder = new StringBuilder(); 35 | builder.append("[").append(this.name).append(": ").append(this.value).append("]"); 36 | return builder.toString(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/PRESUBMIT.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved. 2 | # 3 | # Use of this source code is governed by a BSD-style license 4 | # that can be found in the LICENSE file in the root of the source 5 | # tree. An additional intellectual property rights grant can be found 6 | # in the file PATENTS. All contributing project authors may 7 | # be found in the AUTHORS file in the root of the source tree. 8 | 9 | import re 10 | import sys 11 | 12 | 13 | def GetDefaultTryConfigs(bots=None): 14 | """Returns a list of ('bot', set(['tests']), optionally filtered by [bots]. 15 | 16 | For WebRTC purposes, we always return an empty list of tests, since we want 17 | to run all tests by default on all our trybots. 18 | """ 19 | return { 'tryserver.libyuv': dict((bot, []) for bot in bots)} 20 | 21 | 22 | # pylint: disable=W0613 23 | def GetPreferredTryMasters(project, change): 24 | files = change.LocalPaths() 25 | bots = [ 26 | 'win', 27 | 'win_rel', 28 | 'win_x64_rel', 29 | 'mac', 30 | 'mac_rel', 31 | 'mac_x64_rel', 32 | 'ios', 33 | 'ios_rel', 34 | 'mac_asan', 35 | 'linux', 36 | 'linux_rel', 37 | 'linux_memcheck', 38 | 'linux_tsan2', 39 | 'linux_asan', 40 | 'android', 41 | 'android_rel', 42 | ] 43 | if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files): 44 | return {} 45 | return GetDefaultTryConfigs(bots) 46 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the LibYuv code package. 5 | 6 | Google hereby grants to you a perpetual, worldwide, non-exclusive, 7 | no-charge, irrevocable (except as stated in this section) patent 8 | license to make, have made, use, offer to sell, sell, import, 9 | transfer, and otherwise run, modify and propagate the contents of this 10 | implementation of the LibYuv code package, where such license applies 11 | only to those patent claims, both currently owned by Google and 12 | acquired in the future, licensable by Google that are necessarily 13 | infringed by this implementation of the LibYuv code package. This 14 | grant does not include claims that would be infringed only as a 15 | consequence of further modification of this implementation. If you or 16 | your agent or exclusive licensee institute or order or agree to the 17 | institution of patent litigation against any entity (including a 18 | cross-claim or counterclaim in a lawsuit) alleging that this 19 | implementation of the LibYuv code package or any code incorporated 20 | within this implementation of the LibYuv code package constitutes 21 | direct or contributory patent infringement, or inducement of patent 22 | infringement, then any patent rights granted to you under this License 23 | for this implementation of the LibYuv code package shall terminate as 24 | of the date such litigation is filed. -------------------------------------------------------------------------------- /android/svideostream/screenlive/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 15 10 | targetSdkVersion 26 11 | versionCode 1 12 | versionName "1.1" 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | ext { 27 | AARArchiveName = "screenlive-" + android.defaultConfig.versionName + ".aar" 28 | } 29 | task deleteOldAAR(type: Delete) { 30 | delete AARArchiveName 31 | } 32 | task exportAAR(type: Copy) { 33 | //原地址 34 | from('build/outputs/aar/') 35 | //导出后的地址 36 | into('./') 37 | include('screenlive-release.aar') 38 | //重命名jar 39 | rename('screenlive-release.aar', AARArchiveName) 40 | } 41 | exportAAR.dependsOn(deleteOldAAR, build) 42 | dependencies { 43 | implementation fileTree(dir: 'libs', include: ['*.jar']) 44 | 45 | implementation 'com.android.support:appcompat-v7:26.1.0' 46 | testImplementation 'junit:junit:4.12' 47 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 48 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 49 | compile project(path: ':svideostreamlib') 50 | } 51 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/linux.mk: -------------------------------------------------------------------------------- 1 | # This is a generic makefile for libyuv for gcc. 2 | # make -f linux.mk CXX=clang++ 3 | 4 | CXX?=g++ 5 | CXXFLAGS?=-O2 -fomit-frame-pointer 6 | CXXFLAGS+=-Iinclude/ 7 | 8 | LOCAL_OBJ_FILES := \ 9 | source/compare.o \ 10 | source/compare_common.o \ 11 | source/compare_posix.o \ 12 | source/convert.o \ 13 | source/convert_argb.o \ 14 | source/convert_from.o \ 15 | source/convert_from_argb.o \ 16 | source/convert_to_argb.o \ 17 | source/convert_to_i420.o \ 18 | source/cpu_id.o \ 19 | source/format_conversion.o \ 20 | source/planar_functions.o \ 21 | source/rotate.o \ 22 | source/rotate_argb.o \ 23 | source/rotate_mips.o \ 24 | source/row_any.o \ 25 | source/row_common.o \ 26 | source/row_mips.o \ 27 | source/row_posix.o \ 28 | source/scale.o \ 29 | source/scale_argb.o \ 30 | source/scale_common.o \ 31 | source/scale_mips.o \ 32 | source/scale_posix.o \ 33 | source/video_common.o 34 | 35 | .cc.o: 36 | $(CXX) -c $(CXXFLAGS) $*.cc -o $*.o 37 | 38 | all: libyuv.a convert 39 | 40 | libyuv.a: $(LOCAL_OBJ_FILES) 41 | $(AR) $(ARFLAGS) $@ $(LOCAL_OBJ_FILES) 42 | 43 | # A test utility that uses libyuv conversion. 44 | convert: util/convert.cc libyuv.a 45 | $(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/convert.cc libyuv.a 46 | 47 | clean: 48 | /bin/rm -f source/*.o *.ii *.s libyuv.a convert 49 | 50 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/util/psnr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | // Get PSNR for video sequence. Assuming RAW 4:2:0 Y:Cb:Cr format 12 | 13 | #ifndef UTIL_PSNR_H_ // NOLINT 14 | #define UTIL_PSNR_H_ 15 | 16 | #include // For log10() 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED) 23 | typedef unsigned char uint8; 24 | #define UINT8_TYPE_DEFINED 25 | #endif 26 | 27 | static const double kMaxPSNR = 128.0; 28 | 29 | // libyuv provides this function when linking library for jpeg support. 30 | // TODO(fbarchard): make psnr lib compatible subset of libyuv. 31 | #if !defined(HAVE_JPEG) 32 | // Computer Sum of Squared Error (SSE). 33 | // Pass this to ComputePSNR for final result. 34 | double ComputeSumSquareError(const uint8* org, const uint8* rec, int size); 35 | #endif 36 | 37 | // PSNR formula: psnr = 10 * log10 (Peak Signal^2 * size / sse) 38 | // Returns 128.0 (kMaxPSNR) if sse is 0 (perfect match). 39 | double ComputePSNR(double sse, double size); 40 | 41 | #ifdef __cplusplus 42 | } // extern "C" 43 | #endif 44 | 45 | #endif // UTIL_PSNR_H_ // NOLINT 46 | -------------------------------------------------------------------------------- /thirdparts/libyuv/jni/source/mjpeg_validate.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license 5 | * that can be found in the LICENSE file in the root of the source 6 | * tree. An additional intellectual property rights grant can be found 7 | * in the file PATENTS. All contributing project authors may 8 | * be found in the AUTHORS file in the root of the source tree. 9 | */ 10 | 11 | #include "libyuv/mjpeg_decoder.h" 12 | 13 | #ifdef __cplusplus 14 | namespace libyuv { 15 | extern "C" { 16 | #endif 17 | 18 | // Helper function to validate the jpeg appears intact. 19 | // TODO(fbarchard): Optimize case where SOI is found but EOI is not. 20 | LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size) { 21 | size_t i; 22 | if (sample_size < 64) { 23 | // ERROR: Invalid jpeg size: sample_size 24 | return LIBYUV_FALSE; 25 | } 26 | if (sample[0] != 0xff || sample[1] != 0xd8) { // Start Of Image 27 | // ERROR: Invalid jpeg initial start code 28 | return LIBYUV_FALSE; 29 | } 30 | for (i = sample_size - 2; i > 1;) { 31 | if (sample[i] != 0xd9) { 32 | if (sample[i] == 0xff && sample[i + 1] == 0xd9) { // End Of Image 33 | return LIBYUV_TRUE; // Success: Valid jpeg. 34 | } 35 | --i; 36 | } 37 | --i; 38 | } 39 | // ERROR: Invalid jpeg end code not found. Size sample_size 40 | return LIBYUV_FALSE; 41 | } 42 | 43 | #ifdef __cplusplus 44 | } // extern "C" 45 | } // namespace libyuv 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /android/svideostream/app/src/main/res/layout/activity_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 13 | 21 |