Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
113.17k stars 10.8k forks source link

Webview apps can't be recorded through audio-source=playback correctly #5482

Open Soremwar opened 2 weeks ago

Soremwar commented 2 weeks ago

Environment

Describe the bug

When running with audio source playback it works just fine for a minute, but all of a sudden the sound starts coming from the phone again without any errors in the console. This is limited to a single app running in webview mode, all the other applications seem to work just fine

.\scrcpy.exe --audio-source=playback
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  c57b88ea                        device  23028RA60L
C:\Users\user\Downloads\scrcpy-win64-v2.7\scrcpy-server: 1 file pushed, 0 skipped. 43.4 MB/s (71200 bytes in 0.002s)
[server] INFO: Device: [Xiaomi] Redmi 23028RA60L (Android 14)
[server] INFO: Retrying with -m1920...
[server] INFO: Retrying...
[server] ERROR: Encoding error: java.lang.IllegalArgumentException:
INFO: Renderer: direct3d
INFO: Texture: 1080x2400
INFO: Texture: 864x1920
rom1v commented 2 weeks ago

[server] ERROR: Encoding error: java.lang.IllegalArgumentException:

It is weird that the whole stacktrace is not printed. Can you find it in adb logcat?

Soremwar commented 2 weeks ago

This is everything I could find related to scrcpy

11-13 21:08:49.036 20155 20155 W ziparchive: Unable to open '/data/local/tmp/scrcpy-server.dm': No such file or directory
11-13 21:08:49.113 20155 20155 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.Server
11-13 21:08:49.116 20155 20155 I scrcpy  : Device: [Xiaomi] Redmi 23028RA60L (Android 14)
11-13 21:08:49.392 20172 20172 W ziparchive: Unable to open '/data/local/tmp/scrcpy-server.dm': No such file or directory
11-13 21:08:49.428 20172 20172 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.CleanUp
11-13 21:08:49.845 20155 20191 D MediaCodec: flushMediametrics
11-13 21:08:49.846 20155 20191 I MediaCodec: [mId: 0] audio-debug setState: CONFIGURING
11-13 21:08:49.846 20155 20192 I MediaCodec: [mId: 1] video-debug setState: INITIALIZED
11-13 21:08:49.846 20155 20191 D CCodec  : [c2.android.opus.encoder] buffers are bound to CCodec for this session
11-13 21:08:49.846 20155 20191 D CCodecConfig: no c2 equivalents for flags
11-13 21:08:49.846 20155 20191 D CCodecConfig: no c2 equivalents for encoder
11-13 21:08:49.848 20155 20191 D CCodecConfig: c2 config diff is   c2::u32 raw.channel-count.value = 2
11-13 21:08:49.848 20155 20191 W Codec2Client: query -- param skipped: index = 1107298332.
11-13 21:08:49.849 20155 20191 D CCodec  : encoding statistics level = 0
11-13 21:08:49.849 20155 20191 D CCodec  : setup formats input: AMessage(what = 0x00000000) = {
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t channel-count = 2
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t flac-compression-level = 10
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t max-input-size = 3840
11-13 21:08:49.849 20155 20191 D CCodec  :   string mime = "audio/raw"
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t sample-rate = 48000
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t android._config-pcm-encoding = 2
11-13 21:08:49.849 20155 20191 D CCodec  : }
11-13 21:08:49.849 20155 20191 D CCodec  : setup formats output: AMessage(what = 0x00000000) = {
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t bitrate = 128000
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t bitrate-mode = 1
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t channel-count = 2
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t flac-compression-level = 10
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t max-bitrate = 128000
11-13 21:08:49.849 20155 20191 D CCodec  :   string mime = "audio/opus"
11-13 21:08:49.849 20155 20191 D CCodec  :   int32_t sample-rate = 48000
11-13 21:08:49.849 20155 20191 D CCodec  : }
11-13 21:08:49.849 20155 20191 I CCodecConfig: query failed after returning 9 values (BAD_INDEX)
11-13 21:08:49.849 20155 20191 I MediaCodec: [mId: 0] audio-debug setState: CONFIGURED
11-13 21:08:49.850 20155 20187 E scrcpy  : Encoding error: java.lang.IllegalArgumentException: 
11-13 21:08:49.851 20155 20187 I scrcpy  : Retrying with -m1920...
11-13 21:08:49.851 20155 20187 I scrcpy  : Retrying...
11-13 21:08:49.851 20155 20192 I MediaCodec: [mId: 1] video-debug setState: RELEASING
11-13 21:08:49.855  1726 20202 I QC2Comp : [avcE_54] Stats: Pending(0) i/p-done(0) Works: Q: 0/Done 0|Work-Rate: Q(0.0/s Avg=0.0/s) Done(0.000/s Avg=0.000/s)| Stream: 30.00fps 0.0Kbps
11-13 21:08:49.855  1726 20202 I QC2Comp : [avcE_54] Mem-usage:  | Total: 0.000 MB
11-13 21:08:49.855  1726 20202 I QC2Comp : NOTE: handleReleaseCodec returning: 0 (OK=0)
11-13 21:08:49.855  1726  3562 I QC2Comp : NOTE: Release returning: 0 (OK=0)
11-13 21:08:49.856 20155 20192 I MediaCodec: [mId: 1] video-debug setState: UNINITIALIZED
11-13 21:08:49.856  1726  3562 I hw-BpHwBinder: onLastStrongRef automatically unlinking death recipients
11-13 21:08:49.856  1726  3562 I QC2CompStore: Deleting component(c2.qti.avc.encoder) id(54)
11-13 21:08:49.857  1726  3562 I QC2Comp : [avcE_54] Deallocated component c2.qti.avc.encoder [id=54]
11-13 21:08:49.857  1781 22761 D APM_AudioPolicyMix: registerMix(): adding mix for dev=0x8000 addr=742715996:ap:3mixp:0
11-13 21:08:49.857 20155 20204 I hw-BpHwBinder: onLastStrongRef automatically unlinking death recipients
11-13 21:08:49.858 20155 20192 I MediaCodec: MediaStub sendHdrInfo/sendFrameRateFloatCal/updateFrcAieAisState
11-13 21:08:49.858 20155 20192 D MediaImpl: FRC not support: valueSupport : 
11-13 21:08:49.858 20155 20192 D MediaImpl: AIE not support: valueSupport : 
11-13 21:08:49.858 20155 20192 D MediaImpl: AIS not support: valueSupport : 
11-13 21:08:49.999  2808  3021 I DisplayDeviceRepository: Display device added: DisplayDeviceInfo{"scrcpy": uniqueId="virtual:com.android.shell,2000,scrcpy,0", 864 x 1920, modeId 11, renderFrameRate 60.0, defaultModeId 11, supportedModes [{id=11, width=864, height=1920, fps=60.0, alternativeRefreshRates=[], supportedHdrTypes=[]}], colorMode 0, supportedColorModes [0], hdrCapabilities null, allmSupported false, gameContentTypeSupported false, density 1, 1.0 x 1.0 dpi, appVsyncOff 0, presDeadline 16666666, touch NONE, rotation 0, type VIRTUAL, deviceProductInfo null, state ON, committedState UNKNOWN, owner com.android.shell (uid 2000), frameRateOverride , brightnessMinimum 0.0, brightnessMaximum 0.0, brightnessDefault 0.0, hdrSdrRatio NaN, FLAG_PRIVATE, installOrientation 0, displayShape DisplayShape{ spec=-2066403209 displayWidth=864 displayHeight=1920 physicalPixelDisplaySizeRatio=1.0 rotation=0 offsetX=0 offsetY=0 scale=1.0}}
11-13 21:08:50.010  2808  3021 I LogicalDisplayMapper: Adding new display: 9: DisplayInfo{"scrcpy", displayId 9, displayGroupId 0, FLAG_PRIVATE, real 864 x 1920, largest app 864 x 1920, smallest app 864 x 1920, appVsyncOff 0, presDeadline 16666666, mode 1160.0, defaultMode 11, modes [{id=11, width=864, height=1920, fps=60.0, alternativeRefreshRates=[], supportedHdrTypes=[]}], hdrCapabilities null, userDisabledHdrTypes [], minimalPostProcessingSupported false, rotation 0, state ON, committedState UNKNOWN, type VIRTUAL, uniqueId "virtual:com.android.shell,2000,scrcpy,0", app 864 x 1920, density 1 (1.0 x 1.0) dpi, layerStack 9, colorMode 0, supportedColorModes [0], deviceProductInfo null, owner com.android.shell (uid 2000), removeMode 1, refreshRateOverride 0.0, brightnessMinimum 0.0, brightnessMaximum 0.0, brightnessDefault 0.0, installOrientation ROTATION_0, layoutLimitedRefreshRate null, hdrSdrRatio not_available, thermalRefreshRateThrottling {}, thermalBrightnessThrottlingDataId default}
11-13 21:08:50.089  2808  2907 I DisplayPowerController[9]: BrightnessEvent: disp=9, physDisp=virtual:com.android.shell,2000,scrcpy,0, brt=0.00342131, initBrt=NaN, rcmdBrt=NaN, preBrt=NaN, lux=0.0, preLux=0.0, hbmMax=1.0, hbmMode=off, rbcStrength=-1, thrmMax=1.0, powerFactor=1.0, wasShortTermModelActive=false, flags=, reason=manual, autoBrightness=false, strategy=
11-13 21:08:50.150  2808  2862 I DisplayDevice: [9] Layerstack set to 9 for virtual:com.android.shell,2000,scrcpy,0
11-13 21:08:50.186  1795  1795 D MI-SF   : setupNewDisplayDeviceInternalcheck: displayName:scrcpy, hasWideColorGamut=false, isScreenrecord=false
11-13 21:08:50.293  1795  1795 W SurfaceFlingerInspector: Slow frame composition: scrcpy doComposition took 100 ms