File tree Expand file tree Collapse file tree
extensions/rtmp/src/main/java/io/github/thibaultbee/streampack/ext/rtmp/configuration/mediadescriptor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import java.security.InvalidParameterException
2626/* *
2727 * Creates a RTMP connection descriptor from an [descriptor].
2828 * If the descriptor is already a [RtmpMediaDescriptor], it will be returned as is.
29- * If the descriptor is an [UriMediaDescriptor], it will be converted to a [RtmpMediaDescriptor] with default [TSServiceInfo] .
29+ * If the descriptor is an [UriMediaDescriptor], it will be converted to a [RtmpMediaDescriptor].
3030 * Otherwise, an [InvalidParameterException] will be thrown.
3131 */
3232fun RtmpMediaDescriptor (descriptor : MediaDescriptor ) =
@@ -65,7 +65,7 @@ class RtmpMediaDescriptor(
6565 require(streamKey.isNotBlank()) { " Invalid streamKey $streamKey " }
6666 }
6767
68- override val uri = Uri .Builder ()
68+ override val uri: Uri = Uri .Builder ()
6969 .scheme(scheme)
7070 .encodedAuthority(" $host :$port " )
7171 .apply {
@@ -109,12 +109,10 @@ class RtmpMediaDescriptor(
109109 val port = if (uri.port > 0 ) {
110110 uri.port
111111 } else {
112- if ((scheme == RTMPS_SCHEME ) || (scheme == RTMPTS_SCHEME )) {
113- SSL_DEFAULT_PORT
114- } else if ((scheme == RTMPT_SCHEME ) || (scheme == RTMPTE_SCHEME )) {
115- HTTP_DEFAULT_PORT
116- } else {
117- DEFAULT_PORT
112+ when (scheme) {
113+ RTMPS_SCHEME , RTMPTS_SCHEME -> SSL_DEFAULT_PORT
114+ RTMPT_SCHEME , RTMPTE_SCHEME -> HTTP_DEFAULT_PORT
115+ else -> DEFAULT_PORT
118116 }
119117 }
120118 if (uri.pathSegments.isEmpty()) {
You can’t perform that action at this time.
0 commit comments