Fix meizu deadlock
Some devices (Meizu) assume that the video encoding thread has a
Looper. By moving video encoding to a separate thread, commit
feab87053a
broke this assumption.
Call Looper.prepare() from this thread to fix the problem.
Fixes #4143 <https://github.com/Genymobile/scrcpy/issues/4143>
This commit is contained in:
parent
01d785d9a3
commit
7e936fa879
1 changed files with 5 additions and 0 deletions
|
@ -8,6 +8,7 @@ import android.media.MediaCodecInfo;
|
||||||
import android.media.MediaFormat;
|
import android.media.MediaFormat;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
|
|
||||||
|
@ -285,6 +286,10 @@ public class ScreenEncoder implements Device.RotationListener, Device.FoldListen
|
||||||
@Override
|
@Override
|
||||||
public void start(TerminationListener listener) {
|
public void start(TerminationListener listener) {
|
||||||
thread = new Thread(() -> {
|
thread = new Thread(() -> {
|
||||||
|
// Some devices (Meizu) deadlock if the video encoding thread has no Looper
|
||||||
|
// <https://github.com/Genymobile/scrcpy/issues/4143>
|
||||||
|
Looper.prepare();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
streamScreen();
|
streamScreen();
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
|
|
Loading…
Reference in a new issue