@@ -599,12 +599,42 @@ fn connection_pipeline(
599599 UVec2 :: new ( align32 ( res. x ) , align32 ( res. y ) )
600600 }
601601
602- let stream_view_resolution = get_view_res (
602+ let mut transcoding_view_resolution = get_view_res (
603603 initial_settings. video . transcoding_view_resolution . clone ( ) ,
604604 streaming_caps. default_view_resolution ,
605605 ) ;
606+ if transcoding_view_resolution. x > streaming_caps. max_view_resolution . x
607+ || transcoding_view_resolution. y > streaming_caps. max_view_resolution . y
608+ {
609+ warn ! (
610+ "Chosen resolution {}x{} exceeds client maximum supported resolution of {}x{}. \
611+ Using maximum supported resolution at same aspect ratio.",
612+ transcoding_view_resolution. x,
613+ transcoding_view_resolution. y,
614+ streaming_caps. max_view_resolution. x,
615+ streaming_caps. max_view_resolution. y,
616+ ) ;
617+
618+ let transcoding_ratio =
619+ transcoding_view_resolution. x as f32 / transcoding_view_resolution. y as f32 ;
620+
621+ if transcoding_ratio
622+ > streaming_caps. max_view_resolution . x as f32
623+ / streaming_caps. max_view_resolution . y as f32
624+ {
625+ transcoding_view_resolution = UVec2 :: new (
626+ align32 ( streaming_caps. max_view_resolution . x as f32 ) ,
627+ align32 ( streaming_caps. max_view_resolution . x as f32 / transcoding_ratio) ,
628+ ) ;
629+ } else {
630+ transcoding_view_resolution = UVec2 :: new (
631+ align32 ( streaming_caps. max_view_resolution . y as f32 * transcoding_ratio) ,
632+ align32 ( streaming_caps. max_view_resolution . y as f32 ) ,
633+ ) ;
634+ }
635+ }
606636
607- let target_view_resolution = get_view_res (
637+ let emulated_headset_view_resolution = get_view_res (
608638 initial_settings
609639 . video
610640 . emulated_headset_view_resolution
@@ -740,7 +770,7 @@ fn connection_pipeline(
740770 let stream_config_packet = StreamConfigPacket :: new (
741771 session_manager_lock. session ( ) ,
742772 NegotiatedStreamingConfig {
743- view_resolution : stream_view_resolution ,
773+ view_resolution : transcoding_view_resolution ,
744774 refresh_rate_hint : fps,
745775 game_audio_sample_rate,
746776 enable_foveated_encoding,
@@ -758,10 +788,10 @@ fn connection_pipeline(
758788 proto_socket. split ( STREAMING_RECV_TIMEOUT ) . to_con ( ) ?;
759789
760790 let mut new_openvr_config = contruct_openvr_config ( session_manager_lock. session ( ) ) ;
761- new_openvr_config. eye_resolution_width = stream_view_resolution . x ;
762- new_openvr_config. eye_resolution_height = stream_view_resolution . y ;
763- new_openvr_config. target_eye_resolution_width = target_view_resolution . x ;
764- new_openvr_config. target_eye_resolution_height = target_view_resolution . y ;
791+ new_openvr_config. eye_resolution_width = transcoding_view_resolution . x ;
792+ new_openvr_config. eye_resolution_height = transcoding_view_resolution . y ;
793+ new_openvr_config. target_eye_resolution_width = emulated_headset_view_resolution . x ;
794+ new_openvr_config. target_eye_resolution_height = emulated_headset_view_resolution . y ;
765795 new_openvr_config. refresh_rate = fps as _ ;
766796 new_openvr_config. enable_foveated_encoding = enable_foveated_encoding;
767797 new_openvr_config. h264_profile = encoder_profile as _ ;
0 commit comments