mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 12:15:34 +08:00
[fix] fix setting item [enable turn]
This commit is contained in:
@@ -93,6 +93,7 @@ int Render::SaveSettingsIntoCacheFile() {
|
||||
sizeof(video_encode_format_button_value_));
|
||||
memcpy(&cd_cache_.enable_hardware_video_codec, &enable_hardware_video_codec_,
|
||||
sizeof(enable_hardware_video_codec_));
|
||||
memcpy(&cd_cache_.enable_turn, &enable_turn_, sizeof(enable_turn_));
|
||||
|
||||
cd_cache_file_.write(reinterpret_cast<char*>(&cd_cache_), sizeof(CDCache));
|
||||
cd_cache_file_.close();
|
||||
@@ -104,6 +105,7 @@ int Render::SaveSettingsIntoCacheFile() {
|
||||
config_center_.SetVideoEncodeFormat(
|
||||
(ConfigCenter::VIDEO_ENCODE_FORMAT)video_encode_format_button_value_);
|
||||
config_center_.SetHardwareVideoCodec(enable_hardware_video_codec_);
|
||||
config_center_.SetTurn(enable_turn_);
|
||||
|
||||
LOG_INFO("Save settings into cache file success");
|
||||
|
||||
@@ -124,6 +126,7 @@ int Render::LoadSettingsFromCacheFile() {
|
||||
video_quality_button_value_ = 0;
|
||||
video_encode_format_button_value_ = 1;
|
||||
enable_hardware_video_codec_ = false;
|
||||
enable_turn_ = false;
|
||||
|
||||
config_center_.SetLanguage((ConfigCenter::LANGUAGE)language_button_value_);
|
||||
config_center_.SetVideoQuality(
|
||||
@@ -131,6 +134,7 @@ int Render::LoadSettingsFromCacheFile() {
|
||||
config_center_.SetVideoEncodeFormat(
|
||||
(ConfigCenter::VIDEO_ENCODE_FORMAT)video_encode_format_button_value_);
|
||||
config_center_.SetHardwareVideoCodec(enable_hardware_video_codec_);
|
||||
config_center_.SetTurn(enable_turn_);
|
||||
|
||||
thumbnail_ = std::make_unique<Thumbnail>();
|
||||
thumbnail_->GetKeyAndIv(aes128_key_, aes128_iv_);
|
||||
@@ -161,11 +165,13 @@ int Render::LoadSettingsFromCacheFile() {
|
||||
video_quality_button_value_ = cd_cache_.video_quality;
|
||||
video_encode_format_button_value_ = cd_cache_.video_encode_format;
|
||||
enable_hardware_video_codec_ = cd_cache_.enable_hardware_video_codec;
|
||||
enable_turn_ = cd_cache_.enable_turn;
|
||||
|
||||
language_button_value_last_ = language_button_value_;
|
||||
video_quality_button_value_last_ = video_quality_button_value_;
|
||||
video_encode_format_button_value_last_ = video_encode_format_button_value_;
|
||||
enable_hardware_video_codec_last_ = enable_hardware_video_codec_;
|
||||
enable_turn_last_ = enable_turn_;
|
||||
|
||||
config_center_.SetLanguage((ConfigCenter::LANGUAGE)language_button_value_);
|
||||
config_center_.SetVideoQuality(
|
||||
@@ -173,6 +179,7 @@ int Render::LoadSettingsFromCacheFile() {
|
||||
config_center_.SetVideoEncodeFormat(
|
||||
(ConfigCenter::VIDEO_ENCODE_FORMAT)video_encode_format_button_value_);
|
||||
config_center_.SetHardwareVideoCodec(enable_hardware_video_codec_);
|
||||
config_center_.SetTurn(enable_turn_);
|
||||
|
||||
LOG_INFO("Load settings from cache file");
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ class Render {
|
||||
int video_quality;
|
||||
int video_encode_format;
|
||||
bool enable_hardware_video_codec;
|
||||
bool enable_turn;
|
||||
|
||||
unsigned char key[16];
|
||||
unsigned char iv[16];
|
||||
|
||||
@@ -40,28 +40,18 @@ void ScaleYUV420pToABGR(char* dst_buffer_, int video_width_, int video_height_,
|
||||
std::unique_ptr<uint8_t[]> dst_u(new uint8_t[dst_uv_size]);
|
||||
std::unique_ptr<uint8_t[]> dst_v(new uint8_t[dst_uv_size]);
|
||||
|
||||
try {
|
||||
libyuv::I420Scale(src_y, video_width_, src_u, (video_width_ + 1) / 2, src_v,
|
||||
(video_width_ + 1) / 2, video_width_, video_height_,
|
||||
dst_y.get(), scaled_video_width_, dst_u.get(),
|
||||
(scaled_video_width_ + 1) / 2, dst_v.get(),
|
||||
(scaled_video_width_ + 1) / 2, scaled_video_width_,
|
||||
scaled_video_height_, libyuv::kFilterBilinear);
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR("I420Scale failed: %s", e.what());
|
||||
return;
|
||||
}
|
||||
libyuv::I420Scale(src_y, video_width_, src_u, (video_width_ + 1) / 2, src_v,
|
||||
(video_width_ + 1) / 2, video_width_, video_height_,
|
||||
dst_y.get(), scaled_video_width_, dst_u.get(),
|
||||
(scaled_video_width_ + 1) / 2, dst_v.get(),
|
||||
(scaled_video_width_ + 1) / 2, scaled_video_width_,
|
||||
scaled_video_height_, libyuv::kFilterBilinear);
|
||||
|
||||
try {
|
||||
libyuv::I420ToABGR(
|
||||
dst_y.get(), scaled_video_width_, dst_u.get(),
|
||||
(scaled_video_width_ + 1) / 2, dst_v.get(),
|
||||
(scaled_video_width_ + 1) / 2, reinterpret_cast<uint8_t*>(rgba_buffer_),
|
||||
scaled_video_width_ * 4, scaled_video_width_, scaled_video_height_);
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR("I420ToRGBA failed: %s", e.what());
|
||||
return;
|
||||
}
|
||||
libyuv::I420ToABGR(
|
||||
dst_y.get(), scaled_video_width_, dst_u.get(),
|
||||
(scaled_video_width_ + 1) / 2, dst_v.get(), (scaled_video_width_ + 1) / 2,
|
||||
reinterpret_cast<uint8_t*>(rgba_buffer_), scaled_video_width_ * 4,
|
||||
scaled_video_width_, scaled_video_height_);
|
||||
}
|
||||
|
||||
Thumbnail::Thumbnail() {
|
||||
@@ -360,7 +350,7 @@ std::string Thumbnail::AES_decrypt(const std::string& ciphertext,
|
||||
ret =
|
||||
EVP_DecryptFinal_ex(ctx, plaintext + plaintext_len, &plaintext_final_len);
|
||||
if (1 != ret) {
|
||||
LOG_ERROR("Error in EVP_DecryptFinal_ex, ret [{}]", ret);
|
||||
LOG_ERROR("Error in EVP_DecryptFinal_ex");
|
||||
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
return ciphertext;
|
||||
|
||||
Reference in New Issue
Block a user