Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Auto codec selection Android 14 phone #8101

Closed
mikekgr opened this issue May 20, 2024 · 50 comments
Closed

Incorrect Auto codec selection Android 14 phone #8101

mikekgr opened this issue May 20, 2024 · 50 comments
Labels
bug Something isn't working

Comments

@mikekgr
Copy link

mikekgr commented May 20, 2024

Bug Description

Using the today nightly release (20-05-2024) I discover an error.
When I am trying to connect to my Android 14 phone from Windows 10, Windows 11 PC then in the Auto possition it select codec H265. Using this Auto codec I get not image. If I manually change to let's say VP9, AV1, H264 etc then I have normal image again.
Please see the Auto codec logic.

Thanks and Best

How to Reproduce

Just follow my steps above

Expected Behavior

To be working fine in the Auto codec possition

Operating system(s) on local side and remote side

Windows 10/11 => Android 14 phone

RustDesk Version(s) on local side and remote side

nightly release 20-05-2024

Screenshots

no

Additional Context

No response

@mikekgr mikekgr added the bug Something isn't working label May 20, 2024
@rustdesk rustdesk changed the title Incorrect Auto codeselection Android 14 phone Incorrect Auto codec selection Android 14 phone May 20, 2024
@21pages
Copy link
Collaborator

21pages commented May 20, 2024

@mikekgr Thanks for your feedback, could you give the related log here? Here are steps:

  1. Enable the Transfer file permission (Make it able to write external stroage) and restart android app.
  2. Use auto codec to connect to your android
  3. The log is in External stroage -> RustDesk -> Logs -> rs_rCurrent.log
  4. You can
  • remove server info and send the log file to my email: cGFnZXMyMUAxNjMuY29tCg== (base64),
  • or paste the log start with:scrap::common::hwcodec: all codec info: and scrap::common::hwcodec: available H265 encoders:, scrap::common::codec: new encoder: HWRAM(HwRamEncoderConfig, and see if there are many hwcodec::ffmpeg_ram::encode: Error encode: -1, serveral failed encoding is normal.

file-permission

@mikekgr
Copy link
Author

mikekgr commented May 20, 2024

@mikekgr Thanks for your feedback, could you give the related log here? Here are steps:

  1. Enable the Transfer file permission (Make it able to write external stroage) and restart android app.
  2. Use auto codec to connect to your android
  3. The log is in External stroage -> RustDesk -> Logs -> rs_rCurrent.log
  4. You can
  • remove server info and send the log file to my email: cGFnZXMyMUAxNjMuY29tCg== (base64),
  • or paste the log start with:scrap::common::hwcodec: all codec info: and scrap::common::hwcodec: available H265 encoders:, scrap::common::codec: new encoder: HWRAM(HwRamEncoderConfig, and see if there are many hwcodec::ffmpeg_ram::encode: Error encode: -1, serveral failed encoding is normal.

file-permission

OK I sent you the log from my email : bWlrZWtAb3BlbmZvcmFsbC5jb20=

Tell me if you need anything more. Thanks

@21pages
Copy link
Collaborator

21pages commented May 20, 2024

Thanks for the log, there are not many Error encode: -1,

  • If you control it while it's playing video, will there be hundreds of Error encode: -1?
  • Enable quality monitor, is fps always zero?

1716201568643

@mikekgr
Copy link
Author

mikekgr commented May 20, 2024

Thanks for the log, there are not many Error encode: -1,

  • If you control it while it's playing video, will there be hundreds of Error encode: -1?
  • Enable quality monitor, is fps always zero?

1716201568643

Well, in case of manual codec selection e.g. VP9 or AV1, (not the case of log file that was the try of H265) then the fsp IS NOT zero although I did not tried to play video. If you need more testing, I will try anything you need but after 1-1,5 hours.
Send me what do you need to check and I will reply after 1-1.5 hours.

@21pages
Copy link
Collaborator

21pages commented May 20, 2024

Take your time, there's no rush.
And use this windows client to control other devices (or even itself) through h265 to see if the windows client can display h265 images normally.

@mikekgr
Copy link
Author

mikekgr commented May 20, 2024

@21pages
Well after return home, I did some new tests, this time using my laptop (Dell Latitude 7280, i5-7300U CPU @ 2.60GHz) having Windows 11 pro.
In these tests, the Auto codec was working fine even with the H265 that was again the preselected. Also I test the rest of the codecs and all went fine. my conclusion in this case is: My previous PC (HP Compaq Elite 8300 SFF, i7-3770 CPU @ 3.40GHz) having Windows 10 pro, definitely doesn't support H265 and the only mistake that I can see is the Auto codec logic that pre-select a codec that this PC doesn't support...

That's all I can report.

Thanks and Best Regards.
Mike Kranidis

@21pages
Copy link
Collaborator

21pages commented May 20, 2024

Thanks for your feedback, when the previous pc is available, could you provide the file %appdata%/rustdesk/config/RustDesk_hwcodec.toml? It should support H265 decode, and notice whether fps is zero.

@mikekgr
Copy link
Author

mikekgr commented May 20, 2024

Thanks for your feedback, when the previous pc is available, could you provide the file %appdata%/rustdesk/config/RustDesk_hwcodec.toml? It should support H265 decode, and notice whether fps is zero.

Yes, tomorrow I will do it and I will report here

@21pages
Copy link
Collaborator

21pages commented May 20, 2024

Here are some debug tips:
After connection with H265, look the latest date file in directory %appdata%/RustDesk/log (not sub directory), there should have logs start with try create vram decoder or try create ram decoder, that is the decoder used for decoding, and you can find the decoder in %appdata%/rustdesk/config/RustDesk_hwcodec.toml, you can remove the used one and connect again, btw, vram decoders have higher priority than ram decoders, hope you can find some clues.

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

According to https://en.wikipedia.org/wiki/Intel_Graphics_Technology#Capabilities_(GPU_video_acceleration), i7-3770 CPU (Ivy Bridge) doesn't support H265. The reason may be that the current detection mistakenly think that d3d11 h265 decode acceleration is supported.

Please provide old %appdata%/rustdesk/config/RustDesk_hwcodec.toml and run new https://github.com/21pages/test/releases/download/test/decode_check.exe in termial to verify it. I willl do more to improve the support check.

And try https://github.com/21pages/rustdesk/releases/download/nightly/rustdesk-1.2.4-x86_64-more-hwcodec-check.exe, maybe this version will make h265 normal. If not, please give %appdata%/rustdesk/config/RustDesk_hwcodec.toml of this version.

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

According to https://en.wikipedia.org/wiki/Intel_Graphics_Technology#Capabilities_(GPU_video_acceleration), i7-3770 CPU (Ivy Bridge) doesn't support H265. The reason may be that the current detection mistakenly think that d3d11 h265 decode acceleration is supported.

Please provide old %appdata%/rustdesk/config/RustDesk_hwcodec.toml and run new https://github.com/21pages/test/releases/download/test/decode_check.exe in termial to verify it. I willl do more to improve the support check.

And try https://github.com/21pages/rustdesk/releases/download/nightly/rustdesk-1.2.4-x86_64-more-hwcodec-check.exe, maybe this version will make h265 normal. If not, please give %appdata%/rustdesk/config/RustDesk_hwcodec.toml of this version.

Well the result of running decode_check.exe is:
vram decoders:
[2024-05-21T03:45:41Z ERROR hwcodec] [FFMPEG_VRAM_DEC] unsupported data format

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), `anonymous-namespace'::VplDecoder::init, Query at D:\rustdesk\hwcodec\cpp\mfx\mfx_decode.cpp:110
[2024-05-21T03:45:41Z ERROR hwcodec] [MFXDEC] Queryfailed, sts=-3
DecodeContext { device: None, driver: FFMPEG, luid: 40330, api: API_DX11, data_format: H264 }
DecodeContext { device: None, driver: MFX, luid: 40330, api: API_DX11, data_format: H264 }
[2024-05-21T03:45:41Z ERROR hwcodec] [FFMPEG_RAM_DEC] Failed to check support hevc
[2024-05-21T03:45:41Z ERROR hwcodec] [FFMPEG_RAM_DEC] check_support failed
[2024-05-21T03:45:41Z DEBUG hwcodec::ffmpeg_ram::decode] name:hevc device:AV_HWDEVICE_TYPE_D3D11VA new failed:12.4932ms
ram decoders:
CodecInfo { name: "h264", mc_name: None, format: H264, priority: 0, hwdevice: AV_HWDEVICE_TYPE_D3D11VA }
CodecInfo { name: "h264", mc_name: None, format: H264, priority: 3, hwdevice: AV_HWDEVICE_TYPE_NONE }
CodecInfo { name: "hevc", mc_name: None, format: H265, priority: 3, hwdevice: AV_HWDEVICE_TYPE_NONE }

The test programm: rustdesk-1.2.4-x86_64-more-hwcodec-check.exe still does not work, still get H265 in the Auto place

The content of: %appdata%/rustdesk/config/RustDesk_hwcodec.toml is:
ram = '''
{
"e": [],
"d": [
{
"name": "h264",
"format": "H264",
"priority": 0,
"hwdevice": "AV_HWDEVICE_TYPE_D3D11VA"
},
{
"name": "h264",
"format": "H264",
"priority": 3,
"hwdevice": "AV_HWDEVICE_TYPE_NONE"
},
{
"name": "hevc",
"format": "H265",
"priority": 3,
"hwdevice": "AV_HWDEVICE_TYPE_NONE"
}
]
}'''
vram = '''
{
"e": [
{
"driver": "FFMPEG",
"luid": 40330,
"api": "API_DX11",
"data_format": "H264"
}
],
"d": [
{
"driver": "FFMPEG",
"luid": 40330,
"api": "API_DX11",
"data_format": "H264"
},
{
"driver": "MFX",
"luid": 40330,
"api": "API_DX11",
"data_format": "H264"
}
]
}'''

Am I forgot something useful to you, don't hesitate to ask me, thanks

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Could you provide the content of %appdata%/rustdesk/config/RustDesk_hwcodec.toml after running nigthly RustDesk.exe?

The test programm: rustdesk-1.2.4-x86_64-more-hwcodec-check.exe still does not work, still get H265 in the Auto place

If you connect your phone with the new RustDesk.exe with H265, the image is still not normal? Only software h265 decoder is available now.

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

%appdata%/rustdesk/config/RustDesk_hwcodec.toml

Help me to install the nightly release, after having rustdesk-1.2.4-x86_64-more-hwcodec-check.exe installed, tring to install the nightly release does not give me the known update gui button. How to do it ?

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Uninstall the current one, and installation is not needed, let's test with portable.

  1. Click and run nightly first, and show the cotent of %appdata%/rustdesk/config/RustDesk_hwcodec.toml
    nightly: https://github.com/rustdesk/rustdesk/releases/download/nightly/rustdesk-1.2.4-x86_64.exe
  2. Click and run rustdesk-1.2.4-x86_64-more-hwcodec-check.exe, connect to your phone, the auto codec is H265, and see if the image is normal.
    test: https://github.com/21pages/rustdesk/releases/download/nightly/rustdesk-1.2.4-x86_64-more-hwcodec-check.exe

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

Uninstall the current one, and installation is not needed.

nightly: https://github.com/rustdesk/rustdesk/releases/download/nightly/rustdesk-1.2.4-x86_64.exe test: https://github.com/21pages/rustdesk/releases/download/nightly/rustdesk-1.2.4-x86_64-more-hwcodec-check.exe

I am trying to install the nightly release (after having installed your test release) and I can't . I am pretty sure that this one Build date: 2024-05-21 02:47 is your testy release. Am I right ?
In this case how to force to install the nightly release?

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Uninstall with windows setting, or uninstall with rustdesk.exe --uninstall

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

Same, see the screenshot, now running the nightly release:

image

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Now the fix has not been merged to the ngihtly build, with the nightly build you have installed now, could you provide the content of %appdata%/rustdesk/config/RustDesk_hwcodec.toml? and what if connect itself, eg: if your ID is 1234567, connect to 1234567

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

%appdata%/rustdesk/config/RustDesk_hwcodec.toml

Here is:

ram = '''
{
"e": [],
"d": [
{
"name": "h264",
"format": "H264",
"priority": 0,
"hwdevice": "AV_HWDEVICE_TYPE_D3D11VA"
},
{
"name": "h264",
"format": "H264",
"priority": 3,
"hwdevice": "AV_HWDEVICE_TYPE_NONE"
},
{
"name": "hevc",
"format": "H265",
"priority": 3,
"hwdevice": "AV_HWDEVICE_TYPE_NONE"
}
]
}'''
vram = '''
{
"e": [
{
"driver": "FFMPEG",
"luid": 40330,
"api": "API_DX11",
"data_format": "H264"
}
],
"d": [
{
"driver": "FFMPEG",
"luid": 40330,
"api": "API_DX11",
"data_format": "H264"
},
{
"driver": "MFX",
"luid": 40330,
"api": "API_DX11",
"data_format": "H264"
}
]
}'''

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

So the contents of RustDesk_hwcodec.toml are the same. what if connect to another computer which have h265 encoding, still waiting for image?

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

So the contents of RustDesk_hwcodec.toml are the same. what if connect itself, eg: if your ID is 1234567, connect to 1234567

I did and I got connection with screen but with chaos as the screens repeat itself

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Sorry, I provide wrong method, your computer doesn't support h265 encoding, could you connect to my computer with public server? I have sent my RustDesk ID to your email.

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

Sorry, I provide wrong method, your computer doesn't support h265 encoding, could you connect to my computer with public server? I have sent my RustDesk ID to your email.

Please sent me your email here: bWlrZS5rcmFuaWRpc0BnbWFpbC5jb20=
because my main email account has problems receiving emails from Chinese servers, sorry

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

in your connection I had H265 in working condition !

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Well after return home, I did some new tests, this time using my laptop (Dell Latitude 7280, i5-7300U CPU @ 2.60GHz) having Windows 11 pro.

Did i5-7300U and i7-3770 CPU connect to the same phone? If i5-7300U not connect to the same phone, the problem should still be that the android h265 encoding failed

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

Well after return home, I did some new tests, this time using my laptop (Dell Latitude 7280, i5-7300U CPU @ 2.60GHz) having Windows 11 pro.

Did i5-7300U and i7-3770 CPU connect to the same phone?

Yes these are connecting to my personal OnePlus 9 pro Android phone

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

the problem should still be that the android h265 encoding failed

Yes it remained at Connected, waiting for image...

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

i5-7300U connect to android with H265: good
i7-3770 CPU connect to android with H265: bad
i7-3770 CPU connect to my computer with H265: good

Seems not reasonable, did you remember i5-7300U connect to android with H265 or other codec?

Connect to your phone, and enable file transfer,

  • If you control it while it's playing video, will there be hundreds of Error encode: -1 in the android log? If there are, the reason is android encoding failed.
  • Enable quality monitor, is fps always zero?

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

i5-7300U connect to android with H265: good i7-3770 CPU connect to android with H265: bad i7-3770 CPU connect to my computer with H265: good

Seems not reasonable, is i5-7300U connect to android with H265?
"is i5-7300U connect to android with H265?"
Sure see the screenshot

rustdesk-02

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Ok. connect to your phone with i7-3770 CPU , and enable file transfer,

If you control it while it's playing video, will there be hundreds of Error encode: -1 in the android log? If there are, the reason is android encoding failed.
Enable quality monitor, is fps always zero?

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

i5-7300U connect to android with H265: good i7-3770 CPU connect to android with H265: bad i7-3770 CPU connect to my computer with H265: good

Seems not reasonable, did you remember i5-7300U connect to android with H265 or other codec?

Connect to your phone, and enable file transfer,

  • If you control it while it's playing video, will there be hundreds of Error encode: -1 in the android log? If there are, the reason is android encoding failed.
  • Enable quality monitor, is fps always zero?

I can do these tests after returned home (8+ hours), where the Dell laptop is. Then I will be happy to send you the information you asked.

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Thanks, take your time.

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

Ok. connect to your phone with i7-3770 CPU , and enable file transfer,

If you control it while it's playing video, will there be hundreds of Error encode: -1 in the android log? If there are, the reason is android encoding failed. Enable quality monitor, is fps always zero?

I can do this test because I am in front of this pc. Just tell me, using what coder? Obviously not H265 that is not working...

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Use H265, because H264 is working, I want to know why H265 is not working,

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

Use H265, because H264 is working, I want to know why H265 is not working,

To understand well, you instruct me to connect from my pc having with i7-3770 CPU to my phone using H265 correct?
The problem here is when I trying to connect using H265 (in this setup) I can't get picture at all. How to see the Video? I thing I misunderstood your instructions

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

To understand well, you instruct me to connect from my pc having with i7-3770 CPU to my phone using H265 correct?

Yes

How to see the Video?

Playing video is the method to let android encode many times to see whether it can encode successfully, showing correct image on i7-3770 CPU is not required.

After connection, could you send the android log and the computer log %appdata%/RustDesk/log/rustdesk_rCURRENT.log to my email

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

To understand well, you instruct me to connect from my pc having with i7-3770 CPU to my phone using H265 correct?

Yes

How to see the Video?

Playing video is the method to let android encode many times to see whether it can encode successfully, showing correct image on i7-3770 CPU is not required.

After connection, could you send the android log and the computer log %appdata%/RustDesk/log/rustdesk_rCURRENT.log to my email

email with the requested Android phone log sent

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

[2024-05-21 07:22:14.127371 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.159089 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.168335 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.178180 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.188996 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.201070 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.212365 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.222450 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)
[2024-05-21 07:22:14.232572 +03:00] ERROR [src\flutter.rs:432] width/height mismatch: (1080,2412) != (1080,2428)

Thanks, found the reason, I'll try to fix it.

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

@21pages
thanks, glad to help you

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

I want to analyze the encoded video, when you're home, could you connect to your phone with the i5-7300U with H265, then record the connection with rustdesk, and send the mp4 to my email?

1716270908013

1716271004386

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

I want to analyze the encoded video, when you're home, could you connect to your phone with the i5-7300U with H265, then record the connection with rustdesk, and send the mp4 to my email?

1716270908013

1716271004386

Sure, I will do that when home

@mikekgr
Copy link
Author

mikekgr commented May 21, 2024

@21pages
I sent the video.

@21pages
Copy link
Collaborator

21pages commented May 21, 2024

Thanks

@mikekgr
Copy link
Author

mikekgr commented May 22, 2024

@21pages
Hello Sir. Did you solve the problem? Do you need any further help with debugging?

@21pages
Copy link
Collaborator

21pages commented May 22, 2024

Thank you for your help, no further help is needed and I will let you know when the issue is resolved.

@21pages
Copy link
Collaborator

21pages commented May 22, 2024

Try next nightly

The i7-3770 should be able to connect to with H265, the i5-7300U's image should not have a green bottom.

1716380774605

@rustdesk
Copy link
Owner

Nightly build is under building, will be ready soon.

@mikekgr
Copy link
Author

mikekgr commented May 22, 2024

@21pages
the pc with i7-3770 that has the reported problem, is my work pc. I am not sure if I can reliably be tested now (or when nightly build is ready) using the connection path: from home laptop (i5-7300U) => i7-3770 => my Android phone. Otherwise, I will test it tomorrow.
In all cases I will report here the result.

Many thanks for your exceptional work !

@rustdesk
Copy link
Owner

rustdesk commented May 22, 2024

Nightly build is ready now, take your time. This fix only affects android build, nothing to do with controlling side.

@mikekgr
Copy link
Author

mikekgr commented May 22, 2024

Dear @21pages @rustdesk
I happily confirm that the reported problem is solved using the latest (today) nightly.

Thanks for your fabulous work !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants