Skip to content

Commit

Permalink
ハードウェアエンコーダを利用するかどうかを設定する UseHardwareEncoder オプションを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Aug 30, 2023
1 parent 729cd9c commit 3637e4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## develop

- [ADD] ハードウェアエンコーダを利用するかどうかを設定する `UseHardwareEncoder` オプションを追加
- @melpon
- [UPDATE] SoraClientContext を利用してコードを短くする
- @melpon

Expand Down
12 changes: 8 additions & 4 deletions Sora/Sora.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ public class Config
public string ProxyAgent = "";

public ForwardingFilter ForwardingFilter;

public bool? UseHardwareEncoder;
}

IntPtr p;
Expand Down Expand Up @@ -270,14 +272,14 @@ public void Connect(Config config)
cc.signaling_notify_metadata = config.SignalingNotifyMetadata;
cc.role = role;
cc.enable_multistream = config.Multistream != null;
cc.multistream = config.Multistream == null ? false : config.Multistream.Value;
cc.multistream = config.Multistream.GetValueOrDefault();
cc.enable_spotlight = config.Spotlight != null;
cc.spotlight = config.Spotlight == null ? false : config.Spotlight.Value;
cc.spotlight = config.Spotlight.GetValueOrDefault();
cc.spotlight_number = config.SpotlightNumber;
cc.spotlight_focus_rid = config.SpotlightFocusRid == null ? "" : config.SpotlightFocusRid.Value.ToString().ToLower();
cc.spotlight_unfocus_rid = config.SpotlightUnfocusRid == null ? "" : config.SpotlightUnfocusRid.Value.ToString().ToLower();
cc.enable_simulcast = config.Simulcast != null;
cc.simulcast = config.Simulcast == null ? false : config.Simulcast.Value;
cc.simulcast = config.Simulcast.GetValueOrDefault();
cc.simulcast_rid = config.SimulcastRid == null ? "" : config.SimulcastRid.Value.ToString().ToLower();
cc.insecure = config.Insecure;
cc.capturer_type = (int)config.CapturerType;
Expand All @@ -300,7 +302,7 @@ public void Connect(Config config)
cc.audio_codec_type = config.AudioCodecType.ToString();
cc.audio_codec_lyra_bitrate = config.AudioCodecLyraBitrate;
cc.enable_audio_codec_lyra_usedtx = config.AudioCodecLyraUsedtx != null;
cc.audio_codec_lyra_usedtx = config.AudioCodecLyraUsedtx == null ? false : config.AudioCodecLyraUsedtx.Value;
cc.audio_codec_lyra_usedtx = config.AudioCodecLyraUsedtx.GetValueOrDefault();
cc.check_lyra_version = config.CheckLyraVersion;
cc.audio_bit_rate = config.AudioBitRate;
cc.audio_streaming_language_code = config.AudioStreamingLanguageCode;
Expand Down Expand Up @@ -372,6 +374,8 @@ public void Connect(Config config)
cc.forwarding_filter.rules.Add(ccrs);
}
}
cc.enable_use_hardware_encoder = config.UseHardwareEncoder != null;
cc.use_hardware_encoder = config.UseHardwareEncoder.GetValueOrDefault();

sora_connect(p, Jsonif.Json.ToJson(cc));
}
Expand Down
2 changes: 2 additions & 0 deletions proto/sora_conf_internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@ message ConnectConfig {
string signaling_notify_metadata = 49;
bool enable_forwarding_filter = 50;
ForwardingFilter forwarding_filter = 51;
bool enable_use_hardware_encoder = 52;
bool use_hardware_encoder = 53;
}
1 change: 1 addition & 0 deletions src/sora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void Sora::DoConnect(const sora_conf::internal::ConnectConfig& cc,

sora::SoraClientContextConfig client_config;
client_config.use_audio_device = false;
client_config.use_hardware_encoder = cc.use_hardware_encoder;
client_config.configure_media_dependencies =
[&, this](const webrtc::PeerConnectionFactoryDependencies& dependencies,
cricket::MediaEngineDependencies& media_dependencies) {
Expand Down

0 comments on commit 3637e4e

Please sign in to comment.