Skip to content

Commit

Permalink
VPL のセッションは共通化してはいけなかった
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Feb 4, 2025
1 parent 1fa3dfb commit 53f4e71
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
6 changes: 0 additions & 6 deletions examples/sumomo/src/sumomo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ int main(int argc, char* argv[]) {
// 表示して終了する系の処理はここに書く
if (show_video_codec_capability) {
sora::VideoCodecCapabilityConfig config;
config.vpl_session = sora::VplSession::Create();
config.cuda_context = sora::CudaContext::Create();
config.openh264_path = openh264;
auto capability = sora::GetVideoCodecCapability(config);
Expand Down Expand Up @@ -614,11 +613,6 @@ int main(int argc, char* argv[]) {
context_config.video_codec_factory_config.capability_config
.openh264_path = openh264;
}
if (context_config.video_codec_factory_config.preference->HasImplementation(
sora::VideoCodecImplementation::kIntelVpl)) {
context_config.video_codec_factory_config.capability_config.vpl_session =
sora::VplSession::Create();
}
if (context_config.video_codec_factory_config.preference->HasImplementation(
sora::VideoCodecImplementation::kNvidiaVideoCodecSdk)) {
context_config.video_codec_factory_config.capability_config.cuda_context =
Expand Down
1 change: 0 additions & 1 deletion include/sora/sora_video_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ VideoCodecCapability tag_invoke(
struct VideoCodecCapabilityConfig {
VideoCodecCapabilityConfig();
std::shared_ptr<CudaContext> cuda_context;
std::shared_ptr<VplSession> vpl_session;
std::optional<std::string> openh264_path;
void* jni_env = nullptr;
};
Expand Down
2 changes: 1 addition & 1 deletion src/sora_video_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ VideoCodecCapability GetVideoCodecCapability(
cap.engines.push_back(GetOpenH264VideoCodecCapability(config.openh264_path));

#if defined(USE_VPL_ENCODER)
cap.engines.push_back(GetVplVideoCodecCapability(config.vpl_session));
cap.engines.push_back(GetVplVideoCodecCapability(VplSession::Create()));
#endif

#if defined(USE_NVCODEC_ENCODER)
Expand Down
16 changes: 6 additions & 10 deletions src/sora_video_codec_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ std::optional<SoraVideoCodecFactory> CreateVideoCodecFactory(
VideoEncoderConfig(codec.type, create_video_encoder, 16));
} else if (*codec.encoder == VideoCodecImplementation::kIntelVpl) {
#if defined(USE_VPL_ENCODER)
assert(config.capability_config.vpl_session);
auto create_video_encoder = [vpl_session =
config.capability_config.vpl_session](
const webrtc::SdpVideoFormat& format) {
auto create_video_encoder = [](const webrtc::SdpVideoFormat& format) {
return VplVideoEncoder::Create(
vpl_session, webrtc::PayloadStringToCodecType(format.name));
VplSession::Create(),
webrtc::PayloadStringToCodecType(format.name));
};
encoder_factory_config.encoders.push_back(
VideoEncoderConfig(codec.type, create_video_encoder, 16));
Expand Down Expand Up @@ -173,12 +171,10 @@ std::optional<SoraVideoCodecFactory> CreateVideoCodecFactory(
VideoDecoderConfig(codec.type, create_video_decoder));
} else if (*codec.decoder == VideoCodecImplementation::kIntelVpl) {
#if defined(USE_VPL_ENCODER)
assert(config.capability_config.vpl_session);
auto create_video_decoder = [vpl_session =
config.capability_config.vpl_session](
const webrtc::SdpVideoFormat& format) {
auto create_video_decoder = [](const webrtc::SdpVideoFormat& format) {
return VplVideoDecoder::Create(
vpl_session, webrtc::PayloadStringToCodecType(format.name));
VplSession::Create(),
webrtc::PayloadStringToCodecType(format.name));
};
decoder_factory_config.decoders.push_back(
VideoDecoderConfig(codec.type, create_video_decoder));
Expand Down

0 comments on commit 53f4e71

Please sign in to comment.