-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Add device orientation information to header information #5918
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
base: dev
Are you sure you want to change the base?
Conversation
Reset encoding on rotation even if the resulting size is the same. Refs <Genymobile#5894 (comment)>
…ncoder package, added session package
The previous fork has too many redundant records, use the new pull. @rom1v Please check again to see if there are any new suggestions. |
@rom1v Can this PR be merged in the next version? If it can be confirmed, I can't wait to update the Web client protocol parsing method. |
Introduce a new packet type, a "session" packet, containing metadata about the encoding session. It is used only for the video stream, and currently includes the video resolution. For illustration, here is a sequence of packets on the video stream: device rotation v CODEC | SESSION | MEDIA | MEDIA | … | SESSION | MEDIA | MEDIA | … 1920x1080 <-----------------> 1080x1920 <------------------ encoding session 1 encoding session 2 This metadata is not strictly necessary, since the video resolution can be determined after decoding. However, it allows detection of cases where the encoder does not respect the requested size (and logs a warning), even without decoding (e.g., when there is no video playback). Additional metadata could be added later if necessary, for example the actual device rotation. Refs #5918 <#5918> Refs #5984 <#5894> Co-authored-by: gz0119 <liyong2@4399.com>
I just submitted #6159. It introduces the protocol change to add a "session packet" (you're mentioned as co-author of that commit). The session packet only includes the video resolution (since scrcpy currently does not use the device rotation), but the architecture is here, you can add the rotation on your branch with minimal changes I guess. I adapted the client so that everything works correctly (as mentioned here: #5894 (comment)). |
e06777a
to
4841fdd
Compare
Okay, future versions will align with the new protocol. |
This is useful if need to draw the device appearance correctly.
Related Discussions
#5704
#3605
#925
#5894
CODEC packet:
codecId
4byteSESSION packet:
type
1byte, The SESSION packet type is0xff
width
4bytehegiht
4byteorient
3byteisFlip
1byte180°
1byte90°
1byteOrient format reference source
scrcpy/app/src/options.h
Lines 72 to 85 in 7998811
Test run
Output