-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pedro
committed
Apr 17, 2021
1 parent
f5f2ae1
commit 6c244f1
Showing
7 changed files
with
125 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
rtspserver/src/main/java/com/pedro/rtspserver/RtspServerOnlyAudio.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.pedro.rtspserver | ||
|
||
import android.media.MediaCodec | ||
import com.pedro.rtplibrary.base.OnlyAudioBase | ||
import com.pedro.rtsp.utils.ConnectCheckerRtsp | ||
import java.nio.ByteBuffer | ||
|
||
/** | ||
* Created by pedro on 17/04/21. | ||
*/ | ||
class RtspServerOnlyAudio(connectCheckerRtsp: ConnectCheckerRtsp, port: Int) : OnlyAudioBase() { | ||
|
||
private val rtspServer = RtspServer(connectCheckerRtsp, port) | ||
|
||
init { | ||
rtspServer.setOnlyAudio(true) | ||
} | ||
|
||
fun getNumClients(): Int = rtspServer.getNumClients() | ||
|
||
fun getEndPointConnection(): String = "rtsp://${rtspServer.serverIp}:${rtspServer.port}/" | ||
|
||
override fun setAuthorization(user: String, password: String) { //not developed | ||
} | ||
|
||
fun startStream() { | ||
super.startStream("") | ||
rtspServer.startServer() | ||
} | ||
|
||
override fun prepareAudioRtp(isStereo: Boolean, sampleRate: Int) { | ||
rtspServer.isStereo = isStereo | ||
rtspServer.sampleRate = sampleRate | ||
} | ||
|
||
override fun startStreamRtp(url: String) { //unused | ||
} | ||
|
||
override fun stopStreamRtp() { | ||
rtspServer.stopServer() | ||
} | ||
|
||
override fun getAacDataRtp(aacBuffer: ByteBuffer, info: MediaCodec.BufferInfo) { | ||
rtspServer.sendAudio(aacBuffer, info) | ||
} | ||
|
||
override fun setLogs(enable: Boolean) { | ||
rtspServer.setLogs(enable) | ||
} | ||
|
||
/** | ||
* Unused functions | ||
*/ | ||
@Throws(RuntimeException::class) | ||
override fun resizeCache(newSize: Int) { | ||
} | ||
|
||
override fun shouldRetry(reason: String?): Boolean = false | ||
|
||
override fun reConnect(delay: Long) { | ||
} | ||
|
||
override fun hasCongestion(): Boolean = rtspServer.hasCongestion() | ||
|
||
override fun setReTries(reTries: Int) { | ||
} | ||
|
||
override fun getCacheSize(): Int = 0 | ||
|
||
override fun getSentAudioFrames(): Long = 0 | ||
|
||
override fun getSentVideoFrames(): Long = 0 | ||
|
||
override fun getDroppedAudioFrames(): Long = 0 | ||
|
||
override fun getDroppedVideoFrames(): Long = 0 | ||
|
||
override fun resetSentAudioFrames() { | ||
} | ||
|
||
override fun resetSentVideoFrames() { | ||
} | ||
|
||
override fun resetDroppedAudioFrames() { | ||
} | ||
|
||
override fun resetDroppedVideoFrames() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters