Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.53k stars 10.45k forks source link

Can't run scrcpy; Error 0xfffffc03 #1525

Open Lineup12 opened 4 years ago

Lineup12 commented 4 years ago

Environment

The Problem: I can't see the screen, I just get this in terminal.

On errors, adb logcat:

I/scrcpy  (22345): Device: samsung SM-P601 (Android 5.1.1)
I/art     (22345): Thread[1,tid=22345,WaitingForJniOnLoad,Thread*=0xb4427800,peer=0x12c1a100,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
D/MtpDeviceJNI(22345): register_android_mtp_MtpDevice
I/art     (22345): Thread[1,tid=22345,WaitingForJniOnLoad,Thread*=0xb4427800,peer=0x12c1a100,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
I/art     (22345): Thread[1,tid=22345,WaitingForJniOnLoad,Thread*=0xb4427800,peer=0x12c1a100,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
I/ACodec  (22345):  [] Now uninitialized
I/OMXClient(22345): Using client-side OMX mux.
D/libexynosv4l2( 2289): try node: /dev/video6
D/libexynosv4l2( 2289): try node: /dev/video7
I/libexynosv4l2( 2289): node found for device s5p-mfc-enc: /dev/video7
I/libexynosv4l2( 2289): open video device /dev/video7
D/OMX     ( 2289): SendBroadCasting VIDEO_PLAYBACK_START
I/ACodec  (22345): [OMX.Exynos.AVC.Encoder] Now Loaded
W/ACodec  (22345): do not know color format 0x7f000011 = 2130706449
W/ACodec  (22345): do not know color format 0x10 = 16
W/ACodec  (22345): do not know color format 0x7f000013 = 2130706451
W/ACodec  (22345): do not know color format 0x7f000789 = 2130708361
I/OMX     ( 2289): width (2560),height (1600),fps (60)
I/OMX     ( 2289): SendBroadCast NOT_ALLOWED_SCREEN_MIRRORING : recording
E/OMX     ( 2289):  setParam  sum(8192000) > max resolution(4177920)
D/WifiDisplayController( 2921): LimitedContents : android.intent.action.NOT_ALLOWED_SCREEN_MIRRORING
D/WifiDisplayController( 2921): LimitedContents : Video playing
D/SettingsProvider( 2921): isChangeAllowed() : name = wifi_display_limited_contents_playing
E/ACodec  (22345): [OMX.Exynos.AVC.Encoder] failed to set input port definition parameters.
E/ACodec  (22345):  configureCodec multi window instance fail  appPid : 22345
E/ACodec  (22345): [OMX.Exynos.AVC.Encoder] configureCodec returning error -1021
E/ACodec  (22345): signalError(omxError 0x80001001, internalError -1021)
E/MediaCodec(22345): Codec reported err 0xfffffc03, actionCode 0, while in state 3
E/MediaCodec(22345): configure failed with err 0xfffffc03, resetting...
D/OMX     ( 2289): SendBroadCasting VIDEO_PLAYBACK_STOP
I/ACodec  (22345):  [OMX.Exynos.AVC.Encoder] Now uninitialized
I/ACodec  (22345):  [] Now uninitialized
I/OMXClient(22345): Using client-side OMX mux.
D/SettingsProvider( 2921): isChangeAllowed() : name = wifi_display_limited_contents_playing
D/WifiDisplayController( 2921): LimitedContents : android.intent.action.VIDEO_PLAYBACK_STOP
D/libexynosv4l2( 2289): try node: /dev/video6
D/libexynosv4l2( 2289): try node: /dev/video7
I/libexynosv4l2( 2289): node found for device s5p-mfc-enc: /dev/video7
I/libexynosv4l2( 2289): open video device /dev/video7
D/OMX     ( 2289): SendBroadCasting VIDEO_PLAYBACK_START
I/ACodec  (22345): [OMX.Exynos.AVC.Encoder] Now Loaded
D/AndroidRuntime(22345): Shutting down VM
E/scrcpy  (22345): Exception on thread Thread[main,5,main]
E/scrcpy  (22345): android.media.MediaCodec$CodecException: Error 0xfffffc03
E/scrcpy  (22345):  at android.media.MediaCodec.native_configure(Native Method)
E/scrcpy  (22345):  at android.media.MediaCodec.configure(MediaCodec.java:577)
E/scrcpy  (22345):  at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:205)
E/scrcpy  (22345):  at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:84)
E/scrcpy  (22345):  at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
E/scrcpy  (22345):  at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
E/scrcpy  (22345):  at com.genymobile.scrcpy.Server.main(Server.java:225)
E/scrcpy  (22345):  at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
E/scrcpy  (22345):  at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:255)
E/OMXNodeInstance( 2289): !!! Observer died. Quickly, do something, ... anything...

My terminal:

scrcpy
INFO: scrcpy 1.14 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 7.0 MB/s (33142 bytes in 0.005s)
[server] INFO: Device: samsung SM-P601 (Android 5.1.1)
[server] ERROR: Exception on thread Thread[main,5,main]
android.media.MediaCodec$CodecException: Error 0xfffffc03
    at android.media.MediaCodec.native_configure(Native Method)
    at android.media.MediaCodec.configure(MediaCodec.java:577)
    at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:205)
    at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:84)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
    at com.genymobile.scrcpy.Server.main(Server.java:225)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:255)
INFO: OpenGL shaders: ENABLED
INFO: Created renderer: opengl
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 435.21
INFO: Trilinear filtering enabled
INFO: Initial texture: 2560x1600
WARN: Device disconnected
rom1v commented 4 years ago

This is not exactly the same error code, but: https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#exception

Could you try scrcpy -m 1024?

Lineup12 commented 4 years ago

I did, I get the same error with only the INFO: Initial texture: 1024x640 different.

rom1v commented 4 years ago

neg_1021 is not defined by the framework so it's a platform error. reference. We'll probably never find out what it means

https://stackoverflow.com/questions/56579863/error-0xfffffc03-android-media-mediacodec-error-neg-1021-on-mediacodec-omx-spr

:no_mouth:

OMX.Exynos.AVC.Encoder

That's the problem.

Please test with these changes (replace scrcpy-server in v1.14):

diff ```diff diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index d722388c..8e34ee14 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -5,6 +5,7 @@ import com.genymobile.scrcpy.wrappers.SurfaceControl; import android.graphics.Rect; import android.media.MediaCodec; import android.media.MediaCodecInfo; +import android.media.MediaCodecList; import android.media.MediaFormat; import android.os.IBinder; import android.view.Surface; @@ -12,6 +13,7 @@ import android.view.Surface; import java.io.FileDescriptor; import java.io.IOException; import java.nio.ByteBuffer; +import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -63,13 +65,26 @@ public class ScreenEncoder implements Device.RotationListener { } } + private static void listEncoders() { + MediaCodecList list = new MediaCodecList(MediaCodecList.ALL_CODECS); + for (MediaCodecInfo info : list.getCodecInfos()) { + if (!info.isEncoder()) + continue; + if (Arrays.asList(info.getSupportedTypes()).contains(MediaFormat.MIMETYPE_VIDEO_AVC)) { + Ln.d("Available encoder: " + info.getName()); + } + } + } + private void internalStreamScreen(Device device, FileDescriptor fd) throws IOException { MediaFormat format = createFormat(bitRate, maxFps, codecOptions); device.setRotationListener(this); boolean alive; + listEncoders(); try { do { MediaCodec codec = createCodec(); + Ln.d("Selected encoder: " + codec.getCodecInfo().getName()); IBinder display = createDisplay(); ScreenInfo screenInfo = device.getScreenInfo(); Rect contentRect = screenInfo.getContentRect(); ```

It will just print all the available encoders.

Then, you could test another encoder by changing:

diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index d722388c..1c29c70e 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -151,7 +151,7 @@ public class ScreenEncoder implements Device.RotationListener {
     }

     private static MediaCodec createCodec() throws IOException {
-        return MediaCodec.createEncoderByType(MediaFormat.MIMETYPE_VIDEO_AVC);
+        return MediaCodec.createByCodecName("your_codec_name");
     }

     private static void setCodecOption(MediaFormat format, CodecOption codecOption) {

(replace "your_codec_name").

If you don't know how to compile, post the output with the available encoders, I'll post a binary.

Lineup12 commented 4 years ago

A lot of this I don't understand! I just use scrcpy to show my drawing on Tablet in video chat screen-share. I was planning to upgrade to ubuntu 20; would it help if I do that and install scrcpy with the apt install?

rom1v commented 4 years ago

No, take the scrcpy-server from my previous comment, and replace it in your scrcpy v1.14 folder, then run scrcpy.

It will fail the same way, but give the list of available encoders in the console. Just paste the output here, please.

ANDImur commented 4 years ago
INFO: scrcpy 1.14 <https://github.com/Genymobile/scrcpy>
\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 51.0 MB/s (33142 bytes in 0.001s)
[server] INFO: Device: HTC Nexus 9 (Android 8.1.0)
INFO: Created renderer: direct3d
INFO: Renderer: direct3d
INFO: Initial texture: 1536x2048
ERROR: SDL failed to get a vertex buffer for this Direct3D 9 rendering batch!
ERROR: Dropping back to a slower method.
ERROR: This might be a brief hiccup, but if performance is bad, this is probably why.
ERROR: This error will not be logged again for this renderer.
[server] ERROR: Exception on thread Thread[main,5,main]WARN: Device disconnected

java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2632)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:108)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:89)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:288)
Press any key to continue...

Hi!

Same error. Trying scrcpy -m 1920, scrcpy -m 1024, scrcpy -m 800, but nothing. I tried changing the file above, but it didn't help either. Can I try something else?

rom1v commented 4 years ago

I tried changing the file above, but it didn't help either.

The file above just prints more logs. Please post the output when you run scrcpy with this server please.

ANDImur commented 4 years ago

I tried changing the file above, but it didn't help either.

The file above just prints more logs. Please post the output when you run scrcpy with this server please.

2020-06-25 21:34:12.362 17188-17188/? I/scrcpy: Device: HTC Nexus 9 (Android 8.1.0)
2020-06-25 21:34:12.403 17188-17188/? I/app_process: Thread[1,tid=17188,Native,Thread*=0x7b1e65aa00,peer=0x12c01e68,"main"] recursive attempt to load library "/system/lib64/libmedia_jni.so"

    --------- beginning of system
2020-06-25 21:34:12.404 291-1098/system_process I/PowerManagerService: Waking up from sleep (uid=1000 reason=android.policy:POWER)...
2020-06-25 21:34:12.405 17188-17188/? D/MtpDeviceJNI: register_android_mtp_MtpDevice
2020-06-25 21:34:12.408 291-1098/system_process E/FlounderPowerHAL: Error writing to /sys/devices/system/cpu/cpufreq/interactive/boostpulse: Bad file descriptor
2020-06-25 21:34:12.411 17188-17188/? I/app_process: Thread[1,tid=17188,Native,Thread*=0x7b1e65aa00,peer=0x12c01e68,"main"] recursive attempt to load library "/system/lib64/libmedia_jni.so"
2020-06-25 21:34:12.413 17188-17188/? I/app_process: Thread[1,tid=17188,Native,Thread*=0x7b1e65aa00,peer=0x12c01e68,"main"] recursive attempt to load library "/system/lib64/libmedia_jni.so"
2020-06-25 21:34:12.414 291-1098/system_process E/LightsService: Light requested not available on this device. 2
2020-06-25 21:34:12.414 291-334/system_process I/DisplayPowerController: Blocking screen on until initial contents have been drawn.
2020-06-25 21:34:12.418 291-332/system_process I/DisplayManagerService: Display device changed state: "Встроенный экран", ON
2020-06-25 21:34:12.419 152-152/? D/SurfaceFlinger: Set power mode=2, type=0 flinger=0x756c244000
2020-06-25 21:34:12.419 152-152/? D/hwcomposer: hwc_blank: display 0: unblank
2020-06-25 21:34:12.419 152-152/? D/hwcomposer: hwc_blank_display: display 0: [1 -> 0]
2020-06-25 21:34:12.419 152-152/? D/hwcomposer: Display 0 layer clip is 1536 x 2048
2020-06-25 21:34:12.419 152-152/? D/hwcomposer: Display 0 device clip is 1536 x 2048
2020-06-25 21:34:12.425 291-460/system_process W/LocalDisplayAdapter: Unable to find color mode 0, ignoring request.
2020-06-25 21:34:12.426 291-511/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000004
2020-06-25 21:34:12.429 291-1255/system_process I/WindowManager: Suppressed redundant power key press while already in the process of turning the screen on.
2020-06-25 21:34:12.452 582-582/com.google.android.inputmethod.latin I/DeviceStatusMonitor: DeviceStatusMonitor$1.onReceive():51 onReceive() : Action = android.intent.action.SCREEN_ON
2020-06-25 21:34:12.452 582-582/com.google.android.inputmethod.latin I/DeviceStatusMonitor: DeviceStatusMonitor.updateCountryInfo():111 updateCountryInfo(), notifyAnyway = false
2020-06-25 21:34:12.464 587-587/com.android.systemui D/StatusBar: disable<e i a s b H R c s q >
2020-06-25 21:34:12.505 291-334/system_process I/DisplayPowerController: Unblocked screen on after 92 ms
2020-06-25 21:34:12.464 587-587/com.android.systemui D/StatusBar: disable<e i a s b H R c s q >
2020-06-25 21:34:12.509 204-224/? D/BrcmNciX: 20020401b90100
2020-06-25 21:34:12.529 204-224/? D/BrcmNciR: 4002020000
2020-06-25 21:34:12.530 204-224/? D/BrcmNciX: 20020702320120500100
2020-06-25 21:34:12.534 204-224/? D/BrcmNciR: 4002020000
2020-06-25 21:34:12.534 204-224/? D/BrcmNciX: 2103050200018001
2020-06-25 21:34:12.540 204-224/? D/BrcmNciR: 41030100
2020-06-25 21:34:12.549 17188-17188/? I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
2020-06-25 21:34:12.552 17188-17188/? W/VideoCapabilities: Unrecognized level 0 for video/x-vnd.on2.vp8
2020-06-25 21:34:12.721 291-580/system_process D/SurfaceControl: Excessive delay in setPowerMode()
2020-06-25 21:34:12.727 291-334/system_process W/PowerManagerService: Screen on took 340 ms
2020-06-25 21:34:12.949 16026-16026/? D/NvOsDebugPrintf: WARNING: Library libnvmmlite_msaudio is not present
2020-06-25 21:34:12.970 16026-16026/? D/NvOsDebugPrintf: Inside NvxLiteH264DecoderLowLatencyInit
2020-06-25 21:34:12.970 16026-16026/? D/NvOsDebugPrintf: NvxLiteH264DecoderLowLatencyInit set DPB and Mjstreaming
2020-06-25 21:34:12.976 16026-16026/? W/MediaCodecsXmlParser: unable to open media codecs configuration xml file: /data/misc/media/media_codecs_profiling_results.xml
2020-06-25 21:34:12.976 16026-16026/? W/MediaCodecsXmlParser: parseTopLevelXMLFile(/data/misc/media/media_codecs_profiling_results.xml) failed
2020-06-25 21:34:12.977 16026-16033/? I/OMXMaster: makeComponentInstance(OMX.Nvidia.h264.encoder) in android.hardwar process
2020-06-25 21:34:12.982 16026-16033/? E/OMXNodeInstance: setParameter(0xf42193e0:Nvidia.h264.encoder, OMX.google.android.index.enableAndroidNativeBuffers(0x7fc00004): Output:1 en=0) ERROR: BadParameter(0x80001005)
2020-06-25 21:34:12.982 16026-16033/? E/OMXNodeInstance: setParameter(0xf42193e0:Nvidia.h264.encoder, OMX.google.android.index.allocateNativeHandle(0x7fc00019): Output:1 en=0) ERROR: NotImplemented(0x80001006)
2020-06-25 21:34:12.983 16026-16033/? W/OMXNodeInstance: [0xf42193e0:Nvidia.h264.encoder] component does not support metadata mode; using fallback
2020-06-25 21:34:12.984 17188-17202/? W/OMXUtils: do not know color format 0x7f000789 = 2130708361
2020-06-25 21:34:12.985 16026-16033/? D/NvOsDebugPrintf: Framerate set to : 60 at NvxVideoEncoderSetParameter
2020-06-25 21:34:12.986 16026-17205/? D/NvOsDebugPrintf: NvMMLiteOpen : Block : BlockType = 4 
2020-06-25 21:34:12.986 16026-17205/? D/NvOsDebugPrintf: ===== MSENC =====
2020-06-25 21:34:12.985 16026-16026/? I/Binder:16026_2: type=1400 audit(0.0:301): avc: denied { read write } for name="nvhost-msenc" dev="tmpfs" ino=5956 scontext=u:r:mediacodec:s0 tcontext=u:object_r:camera_device:s0 tclass=chr_file permissive=1
2020-06-25 21:34:12.993 16026-17205/? D/NvOsDebugPrintf: NvMMLiteBlockCreate : Block : BlockType = 4 
2020-06-25 21:34:12.991 16026-16026/? I/Binder:16026_2: type=1400 audit(0.0:303): avc: denied { ioctl } for path="/dev/nvhost-msenc" dev="tmpfs" ino=5956 ioctlcmd=4805 scontext=u:r:mediacodec:s0 tcontext=u:object_r:camera_device:s0 tclass=chr_file permissive=1
2020-06-25 21:34:12.994 17188-17202/? I/ACodec: setupAVCEncoderParameters with [profile: Baseline] [level: Level5]
2020-06-25 21:34:12.995 17188-17202/? I/ACodec: [OMX.Nvidia.h264.encoder] cannot encode color aspects. Ignoring.
2020-06-25 21:34:12.995 17188-17202/? I/ACodec: [OMX.Nvidia.h264.encoder] cannot encode HDR static metadata. Ignoring.
2020-06-25 21:34:12.995 17188-17202/? I/ACodec: setupVideoEncoder succeeded
2020-06-25 21:34:12.995 17188-17202/? W/OMXUtils: do not know color format 0x7f000789 = 2130708361
2020-06-25 21:34:12.995 16026-16033/? E/OMXNodeInstance: getConfig(0xf42193e0:Nvidia.h264.encoder, ConfigLatency(0x6f800005)) ERROR: UnsupportedIndex(0x8000101a)
2020-06-25 21:34:12.996 16026-16026/? E/OMXNodeInstance: getConfig(0xf42193e0:Nvidia.h264.encoder, ConfigAndroidIntraRefresh(0x6f60000a)) ERROR: NotReady(0x80001010)
2020-06-25 21:34:12.997 16026-16033/? E/cutils-trace: Error opening trace file: No such file or directory (2)
2020-06-25 21:34:12.998 16026-17206/? E/OMXNodeInstance: getParameter(0xf42193e0:Nvidia.h264.encoder, ParamConsumerUsageBits(0x6f800004)) ERROR: NotImplemented(0x80001006)
2020-06-25 21:34:12.998 16026-17206/? D/GraphicBufferSource: setting dataspace: 0x104, acquired=0
2020-06-25 21:34:12.999 16026-17205/? E/OMXNodeInstance: getParameter(0xf42193e0:Nvidia.h264.encoder, ParamConsumerUsageBits(0x6f800004)) ERROR: NotImplemented(0x80001006)
2020-06-25 21:34:12.999 16026-17205/? D/GraphicBufferSource: requesting color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M))
2020-06-25 21:34:13.006 152-152/? E/FrameEvents: Source mDeltas not empty.
2020-06-25 21:34:13.006 152-152/? E/FrameEvents: Source mDeltas not empty.
2020-06-25 21:34:13.007 16026-17209/? W/GraphicBufferSource: released unpopulated slots: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]
2020-06-25 21:34:13.009 16026-17205/? D/vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
2020-06-25 21:34:13.010 16026-17205/? D/vndksupport: Loading /vendor/lib/hw/gralloc.tegra132.so from current namespace instead of sphal namespace.
2020-06-25 21:34:13.028 16026-17203/? D/GraphicBufferSource: got buffer with new dataSpace #104
2020-06-25 21:34:13.029 17188-17202/? D/ACodec: dataspace changed to 0x10c10000 (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) (R:2(Limited), S:1(BT709), T:3(SMPTE_170M))
2020-06-25 21:34:13.068 16026-17203/? D/vndksupport: Loading /vendor/lib/hw/gralloc.tegra132.so from current namespace instead of sphal namespace.
2020-06-25 21:34:13.073 16026-17203/? D/vndksupport: Loading /vendor/lib/egl/libEGL_tegra.so from current namespace instead of sphal namespace.
2020-06-25 21:34:13.074 16026-17203/? D/libEGL: loaded /vendor/lib/egl/libEGL_tegra.so
2020-06-25 21:34:13.076 16026-17203/? D/vndksupport: Loading /vendor/lib/egl/libGLESv1_CM_tegra.so from current namespace instead of sphal namespace.
2020-06-25 21:34:13.125 16026-17203/? D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_tegra.so
2020-06-25 21:34:13.150 16026-17203/? D/vndksupport: Loading /vendor/lib/egl/libGLESv2_tegra.so from current namespace instead of sphal namespace.
2020-06-25 21:34:13.151 16026-17203/? D/libEGL: loaded /vendor/lib/egl/libGLESv2_tegra.so
2020-06-25 21:34:13.175 16026-17203/? E/media.codec: libminijail[16026]: blocked syscall: sysinfo
2020-06-25 21:34:13.176 265-265/? I//system/bin/tombstoned: received crash request for pid 16026

    --------- beginning of crash
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: LineageOS Version: '15.1-20200221-UNOFFICIAL-flounder'
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: Build fingerprint: 'google/volantis/flounder:7.1.1/N9F27M/4333998:user/release-keys'
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: Revision: '0'
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: ABI: 'arm'
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: pid: 16026, tid: 17203, name: media.codec  >>> android.hardwar <<<
2020-06-25 21:34:13.177 16026-17203/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2020-06-25 21:34:13.184 16026-17203/? A/DEBUG:     r0 00000000  r1 00004333  r2 00000006  r3 00000008
2020-06-25 21:34:13.184 16026-17203/? A/DEBUG:     r4 00003e9a  r5 00004333  r6 f06fdb94  r7 0000010c
2020-06-25 21:34:13.184 16026-17203/? A/DEBUG:     r8 00000000  r9 0000000a  sl 000000e0  fp 00000000
2020-06-25 21:34:13.184 16026-17203/? A/DEBUG:     ip 00000074  sp f06fdb80  lr f457ad4f  pc f457475c  cpsr 20010030
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG: backtrace:
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #00 pc 0001a75c  /system/lib/libc.so (abort+63)
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #01 pc 000081cd  /vendor/lib/libminijail_vendor.so (log_sigsys_handler+44)
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #02 pc 000189b0  /system/lib/libc.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #03 pc 0004b678  /system/lib/libc.so (sysinfo+8)
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #04 pc 00021785  /system/lib/libc.so (get_phys_pages+16)
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #05 pc 0000540b  /vendor/lib/libnvrmapi_tegra.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #06 pc 00001cf9  /vendor/lib/libnvrmapi_tegra.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #07 pc 00003d71  /vendor/lib/libnvrmapi_tegra.so (_nv000rmt+72)
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #08 pc 00016cb1  /vendor/lib/libnvglsi.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #09 pc 00017b67  /vendor/lib/libnvglsi.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #10 pc 0000aa3d  /vendor/lib/libnvglsi.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #11 pc 000079cb  /vendor/lib/libnvglsi.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #12 pc 00007a1d  /vendor/lib/libnvglsi.so (_nv067glsi+44)
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #13 pc 0000de39  /vendor/lib/egl/libEGL_tegra.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #14 pc 0000e075  /vendor/lib/egl/libEGL_tegra.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #15 pc 0000e0a1  /vendor/lib/egl/libEGL_tegra.so
2020-06-25 21:34:13.193 16026-17203/? A/DEBUG:     #16 pc 0001226d  /vendor/lib/egl/libEGL_tegra.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #17 pc 00007cc7  /system/lib/libEGL.so (android::egl_display_t::initialize(int*, int*)+206)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #18 pc 00006ffd  /vendor/lib/hw/gralloc.tegra132.so (NvGrEglInit+172)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #19 pc 0000711f  /vendor/lib/hw/gralloc.tegra132.so (NvGrEglGetImage+50)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #20 pc 000071a7  /vendor/lib/hw/gralloc.tegra132.so (NvGrEglDecompressBuffer+22)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #21 pc 00003a47  /vendor/lib/hw/gralloc.tegra132.so (NvGrDecompressBuffer+106)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #22 pc 00001225  /vendor/lib/libnvgr.so (nvgr_decompress+56)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #23 pc 00004689  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #24 pc 00005735  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #25 pc 0002d15f  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #26 pc 0002f8f9  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #27 pc 00029c87  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #28 pc 00008a39  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #29 pc 0000e10f  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #30 pc 0000e195  /vendor/lib/libnvomx.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #31 pc 0000ad64  /vendor/lib/libnvos.so
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #32 pc 000489e7  /system/lib/libc.so (__pthread_start(void*)+22)
2020-06-25 21:34:13.194 16026-17203/? A/DEBUG:     #33 pc 0001b349  /system/lib/libc.so (__start_thread+32)
2020-06-25 21:34:13.209 265-265/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_44
2020-06-25 21:34:13.210 291-328/system_process I/BootReceiver: Copying /data/tombstones/tombstone_44 to DropBox (SYSTEM_TOMBSTONE)
2020-06-25 21:34:13.219 17188-17202/? E/ACodec: OMX/mediaserver died, signalling error!
2020-06-25 21:34:13.219 17188-17202/? E/ACodec: signalError(omxError 0x8000100d, internalError -32)
2020-06-25 21:34:13.219 17188-17201/? E/MediaCodec: Codec reported err 0xffffffe0, actionCode 0, while in state 6
2020-06-25 21:34:13.219 149-149/? I/ServiceManager: service 'media.codec' died
2020-06-25 21:34:13.222 17188-17188/? D/AndroidRuntime: Shutting down VM
2020-06-25 21:34:13.224 152-152/? W/libEGL: EGLNativeWindowType 0x756801c010 disconnect failed
2020-06-25 21:34:13.226 17188-17188/? E/AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
    java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2632)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:123)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:104)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:57)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:288)
2020-06-25 21:34:13.227 17188-17188/? E/scrcpy: Exception on thread Thread[main,5,main]
    java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2632)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:123)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:104)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:57)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:288)
2020-06-25 21:34:13.235 291-316/system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
2020-06-25 21:34:13.235 291-316/system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2020-06-25 21:34:13.353 17213-17213/? I//vendor/bin/hw/android.hardware.media.omx@1.0-service: mediacodecservice starting
2020-06-25 21:34:13.353 17213-17213/? W//vendor/bin/hw/android.hardware.media.omx@1.0-service: libminijail[17213]: allowing syscall: clock_gettime
2020-06-25 21:34:13.353 17213-17213/? W//vendor/bin/hw/android.hardware.media.omx@1.0-service: libminijail[17213]: allowing syscall: connect
2020-06-25 21:34:13.353 17213-17213/? W//vendor/bin/hw/android.hardware.media.omx@1.0-service: libminijail[17213]: allowing syscall: fcntl64
2020-06-25 21:34:13.353 17213-17213/? W//vendor/bin/hw/android.hardware.media.omx@1.0-service: libminijail[17213]: allowing syscall: socket
2020-06-25 21:34:13.353 17213-17213/? W//vendor/bin/hw/android.hardware.media.omx@1.0-service: libminijail[17213]: allowing syscall: writev
2020-06-25 21:34:13.354 17213-17213/? W//vendor/bin/hw/android.hardware.media.omx@1.0-service: libminijail[17213]: logging seccomp filter failures
2020-06-25 21:34:13.355 17213-17213/? I//vendor/bin/hw/android.hardware.media.omx@1.0-service: Non-Treble OMX service created.
rom1v commented 4 years ago

I think the logs are not complete.

If you use the scrcpy-server from https://github.com/Genymobile/scrcpy/issues/1525#issuecomment-646847073, you should get logs in the console directly (starting with Available encoder).

ANDImur commented 4 years ago

I think the logs are not complete.

If you use the scrcpy-server from #1525 (comment), you should get logs in the console directly (starting with Available encoder).

I downloaded sсrcpy-server (81 kb) from the post above and replaced it in the sсrcpy folder. That's all there is in the window. 2020-06-25_23-59-45 Is there anything else I need to do?

INFO: scrcpy 1.14 <https://github.com/Genymobile/scrcpy>
***\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 123.4 MB/s (82882 bytes in 0.001s)
[server] INFO: Device: HTC Nexus 9 (Android 8.1.0)
INFO: Created renderer: direct3d
INFO: Renderer: direct3d
INFO: Initial texture: 1536x2048
ERROR: SDL failed to get a vertex buffer for this Direct3D 9 rendering batch!
ERROR: Dropping back to a slower method.
ERROR: This might be a brief hiccup, but if performance is bad, this is probably why.
ERROR: This error will not be logged again for this renderer.
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2632)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:123)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:104)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:57)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:288)
Press any key to continue...
rom1v commented 4 years ago

Oh, I put a debug log, and since recently, the client provides the verbosity level. That's why you don't get the log.

Instead, run:

scrcpy -Vdebug
ANDImur commented 4 years ago

-Vdebug

[server] INFO: Device: HTC Nexus 9 (Android 8.1.0)
DEBUG: Starting stream thread
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
[server] DEBUG: Available encoder: OMX.Nvidia.h264.encoder
[server] DEBUG: Available encoder: OMX.google.h264.encoder
INFO: Created renderer: direct3d
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
INFO: Initial texture: 1536x2048
ERROR: SDL failed to get a vertex buffer for this Direct3D 9 rendering batch!
ERROR: Dropping back to a slower method.
ERROR: This might be a brief hiccup, but if performance is bad, this is probably why.
ERROR: This error will not be logged again for this renderer.
[server] DEBUG: Selected encoder: OMX.Nvidia.h264.encoder
DEBUG: End of frames
DEBUG: Receiver stopped
DEBUG: Video stream stopped
[server] DEBUG: Controller stoppedWARN: Device disconnected
DEBUG: quit...

[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2632)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:123)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:104)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:57)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:288)
DEBUG: Server terminated
rom1v commented 4 years ago

OK, great, so let's hardcode OMX.google.h264.encoder as the encoder:

diff ```diff diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index d722388c..14458087 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -151,7 +151,7 @@ public class ScreenEncoder implements Device.RotationListener { } private static MediaCodec createCodec() throws IOException { - return MediaCodec.createEncoderByType(MediaFormat.MIMETYPE_VIDEO_AVC); + return MediaCodec.createByCodecName("OMX.google.h264.encoder"); } private static void setCodecOption(MediaFormat format, CodecOption codecOption) { ```

Could you retry with this version, please?

ANDImur commented 4 years ago

OK, great, so let's hardcode OMX.google.h264.encoder as the encoder:

diff

  • scrcpy-server SHA256: 93eaf623d15f8101b96c395e520a3f5d38b7968e37cdefff9f1ab94bcc255b97

Could you retry with this version, please?

2020-06-26_00-33-37

Same error =(

rom1v commented 4 years ago

And with -Vdebug?

ANDImur commented 4 years ago

And with -Vdebug?

Sorry. Replaced screenshot.

rom1v commented 4 years ago

😞 so this is a bug in the ROM, but not related to the encoder (or in code shared by both encoders?): https://github.com/Genymobile/scrcpy/issues/1525#issuecomment-649749166 (the crash in your logs)

ANDImur commented 4 years ago

😞 so this is a bug in the ROM, but not related to the encoder (or in code shared by both encoders?): #1525 (comment) (the crash in your logs)

Thx!

rom1v commented 4 years ago

Oh, I didn't even ask: what if you record with screenrecord:

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4
ANDImur commented 4 years ago

adb shell screenrecord /sdcard/file.mp4

Encoder failed (err=-38)

Most likely, the error is due to custom firmware. I will try to roll back to the stock firmware.