Add the ability for clients to reduce bitrate when HEVC is used

This commit is contained in:
Cameron Gutman 2017-09-25 21:36:23 -07:00
parent 957b1de1ad
commit c0596ad1df
2 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,12 @@ typedef struct _STREAM_CONFIGURATION {
// if the server is able to provide one. // if the server is able to provide one.
int supportsHevc; int supportsHevc;
// Specifies the percentage that the specified bitrate will be adjusted
// when an HEVC stream will be delivered. This allows clients to opt to
// reduce bandwidth when HEVC is chosen as the video codec rather than
// (or in addition to) improving image quality.
int hevcBitratePercentageMultiplier;
// AES encryption data for the remote input stream. This must be // AES encryption data for the remote input stream. This must be
// the same as what was passed as rikey and rikeyid // the same as what was passed as rikey and rikeyid
// in /launch and /resume requests. // in /launch and /resume requests.

View File

@ -537,6 +537,12 @@ int performRtspHandshake(void) {
// look for the base 64 encoded VPS NALU prefix that is unique to the HEVC bitstream. // look for the base 64 encoded VPS NALU prefix that is unique to the HEVC bitstream.
if (StreamConfig.supportsHevc && strstr(response.payload, "sprop-parameter-sets=AAAAAU")) { if (StreamConfig.supportsHevc && strstr(response.payload, "sprop-parameter-sets=AAAAAU")) {
NegotiatedVideoFormat = VIDEO_FORMAT_H265; NegotiatedVideoFormat = VIDEO_FORMAT_H265;
// Apply bitrate adjustment for HEVC if the client requested one
if (StreamConfig.hevcBitratePercentageMultiplier != 0) {
StreamConfig.bitrate *= StreamConfig.hevcBitratePercentageMultiplier;
StreamConfig.bitrate /= 100;
}
} }
else { else {
NegotiatedVideoFormat = VIDEO_FORMAT_H264; NegotiatedVideoFormat = VIDEO_FORMAT_H264;