File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
alvr/server_openvr/cpp/platform/win32 Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -709,7 +709,18 @@ void VideoEncoderAMF::Transmit(
709709
710710 auto params = GetDynamicEncoderParams ();
711711 if (params.updated ) {
712- amf_int64 bitRateIn = params.bitrate_bps / params.framerate * m_refreshRate; // in bits
712+ amf_int64 bitRateIn = params.bitrate_bps / params.framerate * m_refreshRate; // in bps
713+
714+ const amf_int64 maxRate = 1'000'000'000 ;
715+ if (bitRateIn > maxRate) {
716+ // Don't warn if we're within 1% (10 mbps) of the max bitrate because that case gets
717+ // triggered by rounding errors with the max supported rate
718+ if (bitRateIn > maxRate + maxRate / 100 ) {
719+ Warn (" Set bitrate over max supported by AMF, clamping to 1000mbps" );
720+ }
721+ bitRateIn = maxRate;
722+ }
723+
713724 if (m_codec == ALVR_CODEC_H264) {
714725 m_amfComponents.back ()->SetProperty (AMF_VIDEO_ENCODER_TARGET_BITRATE, bitRateIn);
715726 m_amfComponents.back ()->SetProperty (AMF_VIDEO_ENCODER_PEAK_BITRATE, bitRateIn);
You can’t perform that action at this time.
0 commit comments