Skip to content

Commit

Permalink
Avoid recreating the display when no display parameters have changed
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Feb 7, 2024
1 parent aee88f3 commit 8373a8b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2353,12 +2353,7 @@ namespace video {
};

int
validate_config(std::shared_ptr<platf::display_t> &disp, const encoder_t &encoder, const config_t &config) {
reset_display(disp, encoder.platform_formats->dev_type, config::video.output_name, config);
if (!disp) {
return -1;
}

validate_config(std::shared_ptr<platf::display_t> disp, const encoder_t &encoder, const config_t &config) {
auto encode_device = make_encode_device(*disp, encoder, config);
if (!encode_device) {
return -1;
Expand Down Expand Up @@ -2561,6 +2556,12 @@ namespace video {
hevc.videoFormat = 1;
av1.videoFormat = 2;

// Reset the display since we're switching from SDR to HDR
reset_display(disp, encoder.platform_formats->dev_type, config::video.output_name, config);
if (!disp) {
return false;
}

// HDR is not supported with H.264. Don't bother even trying it.
encoder.h264[flag] = flag != encoder_t::DYNAMIC_RANGE && validate_config(disp, encoder, h264) >= 0;

Expand Down

0 comments on commit 8373a8b

Please sign in to comment.