Skip to content

Commit

Permalink
type: req-stats のチェックを入れる
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Nov 20, 2023
1 parent b38a478 commit 12ef13a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
25 changes: 14 additions & 11 deletions src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1647,17 +1647,20 @@ void SoraSignaling::OnMessage(
}

if (label == "stats") {
pc_->GetStats(
RTCStatsCallback::Create(
[self = shared_from_this()](
const rtc::scoped_refptr<const webrtc::RTCStatsReport>&
report) {
if (self->state_ != State::Connected) {
return;
}
self->DoSendPong(report);
})
.get());
const std::string type = json.at("type").as_string().c_str();
if (type == "req-stats") {
pc_->GetStats(
RTCStatsCallback::Create(
[self = shared_from_this()](
const rtc::scoped_refptr<const webrtc::RTCStatsReport>&
report) {
if (self->state_ != State::Connected) {
return;
}
self->DoSendPong(report);
})
.get());
}
return;
}

Expand Down
24 changes: 12 additions & 12 deletions test/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ void HelloSora::Run() {
audio_track_id,
pc_factory()->CreateAudioSource(cricket::AudioOptions()).get());

if (config_.mode == HelloSoraConfig::Mode::Hello) {
sora::CameraDeviceCapturerConfig cam_config;
cam_config.width = 1024;
cam_config.height = 768;
cam_config.fps = 30;
cam_config.jni_env = env;
cam_config.application_context = GetAndroidApplicationContext(env);
video_source_ = sora::CreateCameraDeviceCapturer(cam_config);
std::string video_track_id = rtc::CreateRandomString(16);
video_track_ =
pc_factory()->CreateVideoTrack(video_track_id, video_source_.get());
}
//if (config_.mode == HelloSoraConfig::Mode::Hello) {
// sora::CameraDeviceCapturerConfig cam_config;
// cam_config.width = 1024;
// cam_config.height = 768;
// cam_config.fps = 30;
// cam_config.jni_env = env;
// cam_config.application_context = GetAndroidApplicationContext(env);
// video_source_ = sora::CreateCameraDeviceCapturer(cam_config);
// std::string video_track_id = rtc::CreateRandomString(16);
// video_track_ =
// pc_factory()->CreateVideoTrack(video_track_id, video_source_.get());
//}

ioc_.reset(new boost::asio::io_context(1));

Expand Down

0 comments on commit 12ef13a

Please sign in to comment.