diff --git a/include/sora/sora_video_decoder_factory.h b/include/sora/sora_video_decoder_factory.h index 44e7249a..7518e332 100644 --- a/include/sora/sora_video_decoder_factory.h +++ b/include/sora/sora_video_decoder_factory.h @@ -5,7 +5,7 @@ #include // WebRTC -#include +#include #include #include @@ -64,12 +64,12 @@ class SoraVideoDecoderFactory : public webrtc::VideoDecoderFactory { // ハードウェアデコーダを出来るだけ使おうとして、見つからなければソフトウェアデコーダを使う設定を返す SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( - webrtc::Environment& env, std::shared_ptr cuda_context = nullptr, - void* jni_env = nullptr); + void* jni_env = nullptr, + webrtc::Environment env = webrtc::CreateEnvironment()); // ソフトウェアデコーダのみを使う設定を返す SoraVideoDecoderFactoryConfig GetSoftwareOnlyVideoDecoderFactoryConfig( - webrtc::Environment& env); + webrtc::Environment env = webrtc::CreateEnvironment()); } // namespace sora diff --git a/src/sora_client_context.cpp b/src/sora_client_context.cpp index 7c65f1c0..91ed6dfa 100644 --- a/src/sora_client_context.cpp +++ b/src/sora_client_context.cpp @@ -105,8 +105,8 @@ std::shared_ptr SoraClientContext::Create( auto env = webrtc::CreateEnvironment(); auto config = c->config_.use_hardware_encoder - ? sora::GetDefaultVideoDecoderFactoryConfig( - env, cuda_context, jni_env) + ? sora::GetDefaultVideoDecoderFactoryConfig(cuda_context, + jni_env, env) : sora::GetSoftwareOnlyVideoDecoderFactoryConfig(env); dependencies.video_decoder_factory = absl::make_unique(std::move(config)); diff --git a/src/sora_peer_connection_factory.cpp b/src/sora_peer_connection_factory.cpp index 1c427fa7..643aacbe 100644 --- a/src/sora_peer_connection_factory.cpp +++ b/src/sora_peer_connection_factory.cpp @@ -14,7 +14,7 @@ class PeerConnectionFactoryWithContext : public webrtc::PeerConnectionFactory { PeerConnectionFactoryWithContext( webrtc::PeerConnectionFactoryDependencies dependencies) : PeerConnectionFactoryWithContext( - // TODO(enm10k): environment を外部から設定できるようにする + // SDK の外部から webrtc::Environment を設定したくなるまで、ここで初期化する webrtc::ConnectionContext::Create(webrtc::CreateEnvironment(), &dependencies), &dependencies) {} diff --git a/src/sora_video_decoder_factory.cpp b/src/sora_video_decoder_factory.cpp index cf916144..e747b6f2 100644 --- a/src/sora_video_decoder_factory.cpp +++ b/src/sora_video_decoder_factory.cpp @@ -109,9 +109,9 @@ std::unique_ptr SoraVideoDecoderFactory::Create( } SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( - webrtc::Environment& env, std::shared_ptr cuda_context, - void* jni_env) { + void* jni_env, + webrtc::Environment env) { auto config = GetSoftwareOnlyVideoDecoderFactoryConfig(env); #if defined(__APPLE__) @@ -252,7 +252,7 @@ SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( } SoraVideoDecoderFactoryConfig GetSoftwareOnlyVideoDecoderFactoryConfig( - webrtc::Environment& env) { + webrtc::Environment env) { SoraVideoDecoderFactoryConfig config; config.decoders.push_back(VideoDecoderConfig( webrtc::kVideoCodecVP8,