scrcpy: Stack corruption detected when using version 1.21
Environment
- OS: MacOS
- scrcpy version: 1.21 (last)
- installation method: Downloaded the last prebuild server (https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#option-2-use-prebuilt-server)
- device model: Samsung Galaxy A40
- Android version: 11
Describe the bug
I was using for some time scrcpy 1.17 in order to retrieve frames from the device, and decided today to update to the last version. In the previous version, I was able in Python3, following a code a bit like this one https://github.com/DawningW/swy-bot/blob/main/scrcpy.py to:
- Push the server on my phone
- Launch the server
- Forward server port :
- Then get from the video socket the dummy byte, the device name, and the screen resolution
After that, I was able to receive all my frames from the video socket, and it was working perfectly fine.
In 1.21, I saw that the method to launch the server changed. In 1.17, I was using :
subprocess.Popen(
['adb', '-s', device_id, 'shell',
'CLASSPATH=/data/local/tmp/scrcpy-server',
'app_process', '/', 'com.genymobile.scrcpy.Server 1.17 verbose {} {} {} -1 true - false false 0 false false - -'.format(max_width, bitrate, max_fps)],
But in 1.21, there are now named parameters, and also new one, based on what I saw in the Server.java src code. I modified my code to something like :
['adb', '-s', device_id, 'shell',
'CLASSPATH=/data/local/tmp/scrcpy-server',
'app_process', '/',
'com.genymobile.scrcpy.Server {} log_level=verbose max_size=0 bit_rate=8000000 max_fps=0 lock_video_orientation=-1 tunnel_forward=true send_frame_meta=false control=false display_id=0 show_touches=false stay_awake=false power_off_on_close=false clipboard_autosync=false'],
cwd=SERVER_ROOT)
After launching the server, I’m still able to get access to the dummy byte, the device name, and the screen resolution from the socket, but then I don’t receive any frame anymore. I have this error happening :
stack corruption detected (-fstack-protector) Aborted
My question is, is it still possible to retrieve frames this way ? And if it is the case, is there a parameter that is not working like that anymore, and that would explain why I have a problem retrieving the frames from the video socket now ?
Thanks a lot for your time.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 22 (3 by maintainers)
Commits related to this issue
- fix(scrcpy): skip default value in 1.21 option serialization workaround Genymobile/scrcpy#2841 — committed to yume-chan/ya-webadb by yume-chan 2 years ago
- fix(scrcpy): skip default value in 1.21 option serialization workaround Genymobile/scrcpy#2841 — committed to tango-adb/old-demo by yume-chan 2 years ago
Also got this issue on Samsung Galaxy S9 (Android 10), the same crash stack trace.
Searched through Android source code and Google, looks like the
reconfigEncoder4OtherApps
function only exists on Samsung devices, and I can’t find the source code for it.In my test it only happens to
OMX.qcom.video.encoder.avc
encoder, the other two (c2.android.avc.encoder
,OMX.google.h264.encoder
) on my device doesn’t crash even with a much longer command (>300 characters)And the character limit of 255 starts from
app_process
part, for exampledoesn’t crash.
crashes.
I have also encountered this problem on a samsung device. After I shorten the app_process options, the error of
stack corruption detected (-fstack-protector)
is gone.Consider simplifying parameter names? There seems to be a limit to the parameter length on Samsung devices