diff --git a/include/sora/sora_client_context.h b/include/sora/sora_client_context.h index d8a21e4..bfa2dc3 100644 --- a/include/sora/sora_client_context.h +++ b/include/sora/sora_client_context.h @@ -2,7 +2,6 @@ #define SORA_SORA_CLIENT_CONTEXT_H_ // WebRTC -#include #include #include #include diff --git a/include/sora/sora_video_decoder_factory.h b/include/sora/sora_video_decoder_factory.h index 6b8a356..2ba98fe 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 @@ -65,7 +65,7 @@ class SoraVideoDecoderFactory : public webrtc::VideoDecoderFactory { // ハードウェアデコーダを出来るだけ使おうとして、見つからなければソフトウェアデコーダを使う設定を返す SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( std::shared_ptr cuda_context = nullptr, - void* jni_env = nullptr); + void* env = nullptr); // ソフトウェアデコーダのみを使う設定を返す SoraVideoDecoderFactoryConfig GetSoftwareOnlyVideoDecoderFactoryConfig(); diff --git a/src/sora_client_context.cpp b/src/sora_client_context.cpp index ba68f01..d91bfc8 100644 --- a/src/sora_client_context.cpp +++ b/src/sora_client_context.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -62,7 +63,7 @@ std::shared_ptr SoraClientContext::Create( absl::make_unique( dependencies.task_queue_factory.get()); - void* jni_env = sora::GetJNIEnv(); + void* env = sora::GetJNIEnv(); dependencies.adm = c->worker_thread_->BlockingCall([&] { sora::AudioDeviceModuleConfig config; @@ -91,7 +92,7 @@ std::shared_ptr SoraClientContext::Create( { auto config = c->config_.use_hardware_encoder ? sora::GetDefaultVideoEncoderFactoryConfig( - cuda_context, jni_env, c->config_.openh264) + cuda_context, env, c->config_.openh264) : sora::GetSoftwareOnlyVideoEncoderFactoryConfig( c->config_.openh264); config.use_simulcast_adapter = true; @@ -103,7 +104,7 @@ std::shared_ptr SoraClientContext::Create( { auto config = c->config_.use_hardware_encoder - ? sora::GetDefaultVideoDecoderFactoryConfig(cuda_context, jni_env) + ? sora::GetDefaultVideoDecoderFactoryConfig(cuda_context, env) : sora::GetSoftwareOnlyVideoDecoderFactoryConfig(); dependencies.video_decoder_factory = absl::make_unique(std::move(config)); diff --git a/src/sora_video_decoder_factory.cpp b/src/sora_video_decoder_factory.cpp index b944656..9c83b6a 100644 --- a/src/sora_video_decoder_factory.cpp +++ b/src/sora_video_decoder_factory.cpp @@ -2,7 +2,7 @@ // WebRTC #include -#include +#include #include #include #include @@ -110,7 +110,7 @@ std::unique_ptr SoraVideoDecoderFactory::Create( SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( std::shared_ptr cuda_context, - void* jni_env) { + void* env) { auto config = GetSoftwareOnlyVideoDecoderFactoryConfig(); #if defined(__APPLE__) @@ -119,10 +119,10 @@ SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( #endif #if defined(SORA_CPP_SDK_ANDROID) - if (jni_env != nullptr) { + if (env != nullptr) { config.decoders.insert(config.decoders.begin(), VideoDecoderConfig(CreateAndroidVideoDecoderFactory( - static_cast(jni_env)))); + static_cast(env)))); } #endif @@ -251,6 +251,7 @@ SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( } SoraVideoDecoderFactoryConfig GetSoftwareOnlyVideoDecoderFactoryConfig() { + // SDK の外部から webrtc::Environment を設定したくなるまで、ここで初期化する auto env = webrtc::CreateEnvironment(); SoraVideoDecoderFactoryConfig config; config.decoders.push_back(VideoDecoderConfig(