diff --git a/app/build.gradle b/app/build.gradle index 8bbd684..91422ad 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,5 +38,5 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.2.6' + implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:a813c206292cea0767d9cb091f14c87ca9afdc9e' } \ No newline at end of file diff --git a/app/src/main/java/com/jerryxiao/droidcast/ScreenCapService.java b/app/src/main/java/com/jerryxiao/droidcast/ScreenCapService.java index a45c0e2..449ca62 100644 --- a/app/src/main/java/com/jerryxiao/droidcast/ScreenCapService.java +++ b/app/src/main/java/com/jerryxiao/droidcast/ScreenCapService.java @@ -190,8 +190,13 @@ public class ScreenCapService extends Service { if (screenCapDisplay instanceof RtmpDisplay d) { d.setWriteChunkSize(prefs.getInt("write_chunk_size_int", 1024)); } + if (screenCapDisplay instanceof RtmpDisplay d) { + d.setVideoCodec(prefs.getBoolean("enable_h265", false) ? com.pedro.rtmp.rtmp.VideoCodec.H265 : com.pedro.rtmp.rtmp.VideoCodec.H264); + } + else if (screenCapDisplay instanceof RtspDisplay d) { + d.setVideoCodec(prefs.getBoolean("enable_h265", false) ? com.pedro.rtsp.rtsp.VideoCodec.H265 : com.pedro.rtsp.rtsp.VideoCodec.H264); + } screenCapDisplay.setReTries(prefs.getInt("retries_int", 0)); - screenCapDisplay.resizeCache(prefs.getInt("cache_size_int", 120)); screenCapDisplay.setLogs(prefs.getBoolean("enable_lib_logs", true)); if (prefs.getBoolean("use_gl", true) && prefs.getBoolean("use_force_render", true)) { screenCapDisplay.getGlInterface().setForceRender(true); @@ -215,7 +220,7 @@ public class ScreenCapService extends Service { } Log.d(TAG, String.format("capture width %d height %d", video_width, video_height)); if (this.screenCapDisplay.prepareInternalAudio(Integer.parseInt(prefs.getString("audio_bitrate", "131072")), 48000, prefs.getBoolean("stereo_audio", true), false, false) && - this.screenCapDisplay.prepareVideo(video_width, video_height, Integer.parseInt(prefs.getString("fps", "30")), Integer.parseInt(prefs.getString("video_bitrate", "10485760")), 0, 320, -1, -1, 2)) { + this.screenCapDisplay.prepareVideo(video_width, video_height, Integer.parseInt(prefs.getString("fps", "30")), Integer.parseInt(prefs.getString("video_bitrate", "10485760")), 0, 320)) { this.screenCapDisplay.startStream(server); } else { diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 8c0cbbb..a37fb02 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -16,7 +16,6 @@ 网络设置 视频比特率 音频比特率 - rtmp:// 开始 停止 设置 @@ -37,4 +36,6 @@ 杂项 开启库日志 + 开启 H.265 + 并非所有服务器均支持 h265 推流 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ee3c8da..1344c92 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -17,7 +17,6 @@ Video Bitrate (bps) Audio Bitrate - rtmp:// Start Stop Settings @@ -41,4 +40,6 @@ OK Misc Enable library logs + Enable H.265 + Only a few servers support h265 rtmp streaming \ No newline at end of file diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 83adfd6..1300b43 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -32,6 +32,12 @@ app:title="@string/fps_title" app:useSimpleSummaryProvider="true" /> + +