Skip to content

Commit

Permalink
不要な差分を元に戻す
Browse files Browse the repository at this point in the history
  • Loading branch information
enm10k committed May 10, 2024
1 parent 9d5eb9b commit ecec7db
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion include/sora/sora_client_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define SORA_SORA_CLIENT_CONTEXT_H_

// WebRTC
#include <api/environment/environment_factory.h>
#include <api/peer_connection_interface.h>
#include <media/engine/webrtc_media_engine.h>
#include <pc/connection_context.h>
Expand Down
4 changes: 2 additions & 2 deletions include/sora/sora_video_decoder_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <vector>

// WebRTC
#include <api/environment/environment_factory.h>
#include <api/environment/environment.h>
#include <api/video/video_codec_type.h>
#include <api/video_codecs/video_decoder_factory.h>

Expand Down Expand Up @@ -65,7 +65,7 @@ class SoraVideoDecoderFactory : public webrtc::VideoDecoderFactory {
// ハードウェアデコーダを出来るだけ使おうとして、見つからなければソフトウェアデコーダを使う設定を返す
SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig(
std::shared_ptr<CudaContext> cuda_context = nullptr,
void* jni_env = nullptr);
void* env = nullptr);
// ソフトウェアデコーダのみを使う設定を返す
SoraVideoDecoderFactoryConfig GetSoftwareOnlyVideoDecoderFactoryConfig();

Expand Down
7 changes: 4 additions & 3 deletions src/sora_client_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <api/audio_codecs/builtin_audio_encoder_factory.h>
#include <api/create_peerconnection_factory.h>
#include <api/enable_media.h>
#include <api/environment/environment_factory.h>
#include <api/rtc_event_log/rtc_event_log_factory.h>
#include <api/task_queue/default_task_queue_factory.h>
#include <call/call_config.h>
Expand Down Expand Up @@ -62,7 +63,7 @@ std::shared_ptr<SoraClientContext> SoraClientContext::Create(
absl::make_unique<webrtc::RtcEventLogFactory>(
dependencies.task_queue_factory.get());

void* jni_env = sora::GetJNIEnv();
void* env = sora::GetJNIEnv();

dependencies.adm = c->worker_thread_->BlockingCall([&] {
sora::AudioDeviceModuleConfig config;
Expand Down Expand Up @@ -91,7 +92,7 @@ std::shared_ptr<SoraClientContext> 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;
Expand All @@ -103,7 +104,7 @@ std::shared_ptr<SoraClientContext> 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<sora::SoraVideoDecoderFactory>(std::move(config));
Expand Down
9 changes: 5 additions & 4 deletions src/sora_video_decoder_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// WebRTC
#include <absl/strings/match.h>
#include <api/environment/environment.h>
#include <api/environment/environment_factory.h>
#include <api/video_codecs/sdp_video_format.h>
#include <media/base/codec.h>
#include <media/base/media_constants.h>
Expand Down Expand Up @@ -110,7 +110,7 @@ std::unique_ptr<webrtc::VideoDecoder> SoraVideoDecoderFactory::Create(

SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig(
std::shared_ptr<CudaContext> cuda_context,
void* jni_env) {
void* env) {
auto config = GetSoftwareOnlyVideoDecoderFactoryConfig();

#if defined(__APPLE__)
Expand All @@ -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<JNIEnv*>(jni_env))));
static_cast<JNIEnv*>(env))));
}
#endif

Expand Down Expand Up @@ -251,6 +251,7 @@ SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig(
}

SoraVideoDecoderFactoryConfig GetSoftwareOnlyVideoDecoderFactoryConfig() {
// SDK の外部から webrtc::Environment を設定したくなるまで、ここで初期化する
auto env = webrtc::CreateEnvironment();
SoraVideoDecoderFactoryConfig config;
config.decoders.push_back(VideoDecoderConfig(
Expand Down

0 comments on commit ecec7db

Please sign in to comment.