Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sora CPP SDK の 2024.8.0-canary.26 の変更に対応 #111

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
- [UPDATE] Sora C++ SDK のバージョンを `2024.8.0` に上げる
- WEBRTC_BUILD_VERSION を `m130.6723.2.0` に上げる
- libwebrtc のモジュール分割に追従するため rtc::CreateRandomString のヘッダを追加
- Sora CPP SDK の absl::optional を std::optional に変更した仕様に追従する
- Sora CPP SDK の absl::nullopt を std::nullopt に変更した仕様に追従する
- CMAKE_VERSION を `3.30.5` に上げる
- BOOST_VERSION を `1.86.0` に上げる
- OPENH264_VERSION を `v2.5.0` に上げる
Expand Down
4 changes: 2 additions & 2 deletions src/dynamic_h264_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int32_t DynamicH264Decoder::Decode(const EncodedImage& input_image,
}

h264_bitstream_parser_.ParseBitstream(input_image);
absl::optional<int> qp = h264_bitstream_parser_.GetLastSliceQp();
std::optional<int> qp = h264_bitstream_parser_.GetLastSliceQp();

std::array<std::uint8_t*, 3> yuv;
SBufferInfo info = {};
Expand Down Expand Up @@ -127,7 +127,7 @@ int32_t DynamicH264Decoder::Decode(const EncodedImage& input_image,
video_frame.set_color_space(*input_image.ColorSpace());
}

callback_->Decoded(video_frame, absl::nullopt, qp);
callback_->Decoded(video_frame, std::nullopt, qp);

return WEBRTC_VIDEO_CODEC_OK;
}
Expand Down
6 changes: 3 additions & 3 deletions src/dynamic_h264_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum DynamicH264EncoderEvent {
kH264EncoderEventMax = 16,
};

int NumberOfThreads(absl::optional<int> encoder_thread_limit,
int NumberOfThreads(std::optional<int> encoder_thread_limit,
int width,
int height,
int number_of_cores) {
Expand Down Expand Up @@ -106,7 +106,7 @@ VideoFrameType ConvertToVideoFrameType(EVideoFrameType type) {
return VideoFrameType::kEmptyFrame;
}

absl::optional<ScalabilityMode> ScalabilityModeFromTemporalLayers(
std::optional<ScalabilityMode> ScalabilityModeFromTemporalLayers(
int num_temporal_layers) {
switch (num_temporal_layers) {
case 0:
Expand All @@ -120,7 +120,7 @@ absl::optional<ScalabilityMode> ScalabilityModeFromTemporalLayers(
default:
RTC_DCHECK_NOTREACHED();
}
return absl::nullopt;
return std::nullopt;
}

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions src/dynamic_h264_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ class DynamicH264Encoder : public VideoEncoder {
std::vector<LayerConfig> configurations_;
std::vector<EncodedImage> encoded_images_;
std::vector<std::unique_ptr<ScalableVideoController>> svc_controllers_;
absl::InlinedVector<absl::optional<ScalabilityMode>, kMaxSimulcastStreams>
absl::InlinedVector<std::optional<ScalabilityMode>, kMaxSimulcastStreams>
scalability_modes_;

const Environment env_;
VideoCodec codec_;
H264PacketizationMode packetization_mode_;
size_t max_payload_size_;
int32_t number_of_cores_;
absl::optional<int> encoder_thread_limit_;
std::optional<int> encoder_thread_limit_;
EncodedImageCallback* encoded_image_callback_;

bool has_reported_init_;
Expand Down
2 changes: 1 addition & 1 deletion src/sora_audio_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void SoraAudioSinkImpl::OnData(
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms) {
std::optional<int64_t> absolute_capture_timestamp_ms) {
if (absolute_capture_timestamp_ms) {
audio_frame_->set_absolute_capture_timestamp_ms(
*absolute_capture_timestamp_ms);
Expand Down
2 changes: 1 addition & 1 deletion src/sora_audio_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SoraAudioSinkImpl : public webrtc::AudioTrackSinkInterface,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms) override;
std::optional<int64_t> absolute_capture_timestamp_ms) override;

/**
* 実装上の留意点:コールバックと Read 関数の共存はパフォーマンスや使い方の面で難しいことが判明したので、
Expand Down
8 changes: 4 additions & 4 deletions src/sora_audio_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SoraAudioSourceInterface::~SoraAudioSourceInterface() {

void SoraAudioSourceInterface::OnData(const int16_t* data,
size_t samples_per_channel,
absl::optional<int64_t> timestamp) {
std::optional<int64_t> timestamp) {
size_t size = samples_per_channel * channels_;
if (buffer_used_ > 0) {
// 先に 10 ms に満たず残したデータを新たなデータと繋げて 10 ms を超える場合は送る
Expand Down Expand Up @@ -116,7 +116,7 @@ void SoraAudioSourceInterface::RemoveSink(
}

void SoraAudioSourceInterface::Add10MsData(const int16_t* data,
absl::optional<int64_t> timestamp) {
std::optional<int64_t> timestamp) {
if (timestamp) {
last_timestamp_ = *timestamp;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ void SoraAudioSource::OnData(const int16_t* data,
}

void SoraAudioSource::OnData(const int16_t* data, size_t samples_per_channel) {
source_->OnData(data, samples_per_channel, absl::nullopt);
source_->OnData(data, samples_per_channel, std::nullopt);
}

void SoraAudioSource::OnData(
Expand All @@ -166,5 +166,5 @@ void SoraAudioSource::OnData(
if (!track_) {
return;
}
source_->OnData(ndarray.data(), ndarray.shape(0), absl::nullopt);
source_->OnData(ndarray.data(), ndarray.shape(0), std::nullopt);
}
4 changes: 2 additions & 2 deletions src/sora_audio_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SoraAudioSourceInterface

void OnData(const int16_t* data,
size_t samples_per_channel,
absl::optional<int64_t> timestamp);
std::optional<int64_t> timestamp);

// MediaSourceInterface implementation.
webrtc::MediaSourceInterface::SourceState state() const override;
Expand All @@ -46,7 +46,7 @@ class SoraAudioSourceInterface
void RemoveSink(webrtc::AudioTrackSinkInterface* sink) override;

private:
void Add10MsData(const int16_t* data, absl::optional<int64_t> timestamp);
void Add10MsData(const int16_t* data, std::optional<int64_t> timestamp);

std::list<AudioObserver*> audio_observers_;
webrtc::Mutex sink_lock_;
Expand Down
2 changes: 1 addition & 1 deletion src/sora_audio_stream_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void SoraAudioStreamSinkImpl::OnData(
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms) {
std::optional<int64_t> absolute_capture_timestamp_ms) {
auto tuned_frame = std::make_unique<webrtc::AudioFrame>();
tuned_frame->UpdateFrame(
0, static_cast<const int16_t*>(audio_data), number_of_frames, sample_rate,
Expand Down
2 changes: 1 addition & 1 deletion src/sora_audio_stream_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class SoraAudioStreamSinkImpl : public webrtc::AudioTrackSinkInterface,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms) override;
std::optional<int64_t> absolute_capture_timestamp_ms) override;
/**
* 音声データが来るたびに呼び出されるコールバック変数です。
*
Expand Down