@@ -152,9 +152,16 @@ open class StreamerPipeline(
152152 }
153153
154154 require(withVideo) { " Do not need to set video rotation as it is an audio only streamer" }
155- safeOutputCall { outputs ->
156- outputs.keys.filterIsInstance<IVideoSurfacePipelineOutputInternal >()
157- .forEach { it.setTargetRotation(rotation) }
155+
156+ withContext(dispatcherProvider.default) {
157+ val jobs = mutableListOf<Job >()
158+ safeOutputCall { outputs ->
159+ jobs + = coroutineScope.launch {
160+ outputs.keys.filterIsInstance<IVideoSurfacePipelineOutputInternal >()
161+ .forEach { it.setTargetRotation(rotation) }
162+ }
163+ }
164+ jobs.joinAll()
158165 }
159166 }
160167
@@ -780,7 +787,7 @@ open class StreamerPipeline(
780787 * If an [IEncodingPipelineOutput] is not opened, it won't start the stream and will throw an
781788 * exception. But the other outputs will be started.
782789 */
783- override suspend fun startStream () = withContext(dispatcherProvider.default) {
790+ override suspend fun startStream () {
784791 if (isReleaseRequested.get()) {
785792 throw IllegalStateException (" Pipeline is released" )
786793 }
@@ -914,7 +921,7 @@ open class StreamerPipeline(
914921 safeStreamingOutputCall { outputs ->
915922 jobs + = stopStreamOutputs(outputs.keys)
916923 }
917-
924+ jobs.joinAll()
918925 }
919926
920927 /* *
@@ -927,7 +934,6 @@ open class StreamerPipeline(
927934 throw IllegalStateException (" Pipeline is released" )
928935 }
929936 withContext(dispatcherProvider.default) {
930-
931937 inputMutex.withLock {
932938 stopStreamInputsUnsafe()
933939 }
0 commit comments