Skip to content

Commit

Permalink
feat(core): streamer: make startStream suspendable as it can call net…
Browse files Browse the repository at this point in the history
…work
  • Loading branch information
ThibaultBee committed Nov 27, 2023
1 parent 594af7f commit e188f44
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ open class BaseScreenRecorderStreamer(
* Same as [BaseStreamer] but it prepares [ScreenSource.encoderSurface].
* You must have set [activityResult] before.
*/
override fun startStream() {
override suspend fun startStream() {
screenSource.encoderSurface = videoEncoder?.inputSurface
super.startStream()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ abstract class BaseStreamer(
*
* @see [stopStream]
*/
override fun startStream() {
override suspend fun startStream() {
try {
endpoint.startStream()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ open class BaseAudioOnlyFileStreamer(
* Manifest.permission.WRITE_EXTERNAL_STORAGE.
*/
@RequiresPermission(allOf = [Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO])
override fun startStream() = super.startStream()
override suspend fun startStream() = super.startStream()
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ open class BaseCameraFileStreamer(
* Manifest.permission.WRITE_EXTERNAL_STORAGE.
*/
@RequiresPermission(allOf = [Manifest.permission.WRITE_EXTERNAL_STORAGE])
override fun startStream() = super.startStream()
override suspend fun startStream() = super.startStream()
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface IStreamer {
*
* @see [stopStream]
*/
fun startStream()
suspend fun startStream()

/**
* Stops audio/video stream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class CameraSrtLiveStreamer(
/**
* Same as [BaseCameraLiveStreamer.startStream] but also starts bitrate regulator.
*/
override fun startStream() {
override suspend fun startStream() {
if (bitrateRegulator != null) {
scheduler.start()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class ScreenRecorderSrtLiveStreamer(
/**
* Same as [BaseScreenRecorderLiveStreamer.startStream] but also starts bitrate regulator.
*/
override fun startStream() {
override suspend fun startStream() {
if (bitrateRegulator != null) {
scheduler.start()
}
Expand Down

0 comments on commit e188f44

Please sign in to comment.