From 12ef13a1ce363959dedabfa6ecc6abf3b3dc70ae Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 20 Nov 2023 21:58:45 +0900 Subject: [PATCH] =?UTF-8?q?type:=20req-stats=20=E3=81=AE=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=92=E5=85=A5=E3=82=8C=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sora_signaling.cpp | 25 ++++++++++++++----------- test/hello.cpp | 24 ++++++++++++------------ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/sora_signaling.cpp b/src/sora_signaling.cpp index 9a78fb7d..7fd77953 100644 --- a/src/sora_signaling.cpp +++ b/src/sora_signaling.cpp @@ -1647,17 +1647,20 @@ void SoraSignaling::OnMessage( } if (label == "stats") { - pc_->GetStats( - RTCStatsCallback::Create( - [self = shared_from_this()]( - const rtc::scoped_refptr& - 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& + report) { + if (self->state_ != State::Connected) { + return; + } + self->DoSendPong(report); + }) + .get()); + } return; } diff --git a/test/hello.cpp b/test/hello.cpp index fc4f9b3a..e00f93c2 100644 --- a/test/hello.cpp +++ b/test/hello.cpp @@ -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));