diff --git a/ZLMediaKit/CMakeLists.txt b/ZLMediaKit/CMakeLists.txt index df11f72..dfc54b2 100644 --- a/ZLMediaKit/CMakeLists.txt +++ b/ZLMediaKit/CMakeLists.txt @@ -39,7 +39,7 @@ option(ENABLE_ASAN "Enable Address Sanitize" OFF) option(ENABLE_CXX_API "Enable C++ API SDK" OFF) option(ENABLE_FAAC "Enable FAAC" OFF) option(ENABLE_FFMPEG "Enable FFmpeg" OFF) -option(ENABLE_HLS "Enable HLS" OFF) +option(ENABLE_HLS "Enable HLS" ON) option(ENABLE_JEMALLOC_STATIC "Enable static linking to the jemalloc library" OFF) option(ENABLE_JEMALLOC_DUMP "Enable jemalloc to dump malloc statistics" OFF) option(ENABLE_MEM_DEBUG "Enable Memory Debug" OFF) @@ -55,7 +55,7 @@ option(ENABLE_SRT "Enable SRT" OFF) option(ENABLE_TESTS "Enable Tests" OFF) option(ENABLE_SCTP "Enable SCTP" OFF) option(ENABLE_WEBRTC "Enable WebRTC" OFF) -option(ENABLE_X264 "Enable x264" OFF) +option(ENABLE_X264 "Enable x264" ON) option(ENABLE_WEPOLL "Enable wepoll" ON) option(ENABLE_VIDEOSTACK "Enable video stack" OFF) option(DISABLE_REPORT "Disable report to report.zlmediakit.com" OFF) diff --git a/ZLMediaKit/server/System.cpp b/ZLMediaKit/server/System.cpp index c37e495..4b1a0d3 100644 --- a/ZLMediaKit/server/System.cpp +++ b/ZLMediaKit/server/System.cpp @@ -187,6 +187,7 @@ void System::systemSetup(){ #endif //ENABLE_JEMALLOC_DUMP #if !defined(_WIN32) +#if !defined(__ANDROID__) struct rlimit rlim,rlim_new; if (getrlimit(RLIMIT_CORE, &rlim)==0) { rlim_new.rlim_cur = rlim_new.rlim_max = RLIM_INFINITY; @@ -205,6 +206,7 @@ void System::systemSetup(){ } InfoL << "文件最大描述符个数设置为:" << rlim_new.rlim_cur; } +#endif // __ANDROID__ #ifndef ANDROID signal(SIGSEGV, sig_crash); diff --git a/app/build.gradle b/app/build.gradle index 106f6ab..54d6800 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,19 +9,19 @@ def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNum def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber android { - compileSdkVersion 26 + compileSdkVersion 33 defaultConfig { applicationId "com.xypower.mplive" minSdkVersion 21 - targetSdkVersion 26 + targetSdkVersion 28 versionCode AppVersionCode versionName AppVersionName externalNativeBuild { cmake { cppFlags "-std=c++11 -frtti -fexceptions" - arguments "-DENABLE_API=on", "-DENABLE_API_STATIC_LIB=on", "-DENABLE_TESTS=off", "-DENABLE_PLAYER=off", "-DENABLE_SERVER_LIB=on" + arguments "-DENABLE_API=on", "-DENABLE_API_STATIC_LIB=on", "-DENABLE_TESTS=off", "-DENABLE_HLS", "-DENABLE_PLAYER=off", "-DENABLE_SERVER_LIB=on" abiFilters "armeabi-v7a", "arm64-v8a" } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 317093e..f5e73b5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,7 +4,10 @@ + + + @@ -14,14 +17,16 @@ android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:usesCleartextTraffic="true" + android:requestLegacyExternalStorage="true" > - diff --git a/app/src/main/java/com/xypower/mplive/MainActivity.java b/app/src/main/java/com/xypower/mplive/MainActivity.java index 95bde42..0db212e 100644 --- a/app/src/main/java/com/xypower/mplive/MainActivity.java +++ b/app/src/main/java/com/xypower/mplive/MainActivity.java @@ -57,7 +57,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL private SharedPreferences sp; // private String rtmpUrl = "rtmp://192.168.50.250/live/0"; - private String rtmpUrl = "rtmp://61.169.135.146/live/0"; + private String rtmpUrl = "rtmp://127.0.0.1/live/0"; private String recPath = Environment.getExternalStorageDirectory().getPath() + "/test.mp4"; private SrsPublisher mPublisher; @@ -197,10 +197,11 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL SharedPreferences.Editor editor = sp.edit(); editor.putString("rtmpUrl", rtmpUrl); editor.apply(); - efu.setText(rtmpUrl + " cameraid=" + cameraId + " auto=" + autoStart); + // efu.setText(rtmpUrl + " cameraid=" + cameraId + " auto=" + autoStart); + efu.setText(rtmpUrl); mPublisher.startPublish(rtmpUrl); if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) { - Toast.makeText(getApplicationContext(), "Use hard encoder", Toast.LENGTH_SHORT).show(); + // Toast.makeText(getApplicationContext(), "Use hard encoder", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Use soft encoder", Toast.LENGTH_SHORT).show(); } @@ -585,17 +586,17 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL @Override public void onRecordPause() { - Toast.makeText(getApplicationContext(), "Record paused", Toast.LENGTH_SHORT).show(); + // Toast.makeText(getApplicationContext(), "Record paused", Toast.LENGTH_SHORT).show(); } @Override public void onRecordResume() { - Toast.makeText(getApplicationContext(), "Record resumed", Toast.LENGTH_SHORT).show(); + // Toast.makeText(getApplicationContext(), "Record resumed", Toast.LENGTH_SHORT).show(); } @Override public void onRecordStarted(String msg) { - Toast.makeText(getApplicationContext(), "Recording file: " + msg, Toast.LENGTH_SHORT).show(); + // Toast.makeText(getApplicationContext(), "Recording file: " + msg, Toast.LENGTH_SHORT).show(); } @Override diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..dca93c0 --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file