Adding ChannelStatistics Logs
Bug: webrtc:363353566 Change-Id: I187432794d173175b83efd4a8899199916306dcd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361127 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Tim Na <natim@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42916}
This commit is contained in:
parent
86251a072a
commit
77eba46324
1
AUTHORS
1
AUTHORS
@ -59,6 +59,7 @@ Gustavo Garcia <gustavogb@gmail.com>
|
|||||||
Hans Knoechel <hans@hans-knoechel.de>
|
Hans Knoechel <hans@hans-knoechel.de>
|
||||||
Helmut Januschka <helmut@januschka.com>
|
Helmut Januschka <helmut@januschka.com>
|
||||||
Hugues Ekra <hekra01@gmail.com>
|
Hugues Ekra <hekra01@gmail.com>
|
||||||
|
Hyungjoo Na <element11sodium@gmail.com>
|
||||||
Jake Hilton <jakehilton@gmail.com>
|
Jake Hilton <jakehilton@gmail.com>
|
||||||
James H. Brown <jbrown@burgoyne.com>
|
James H. Brown <jbrown@burgoyne.com>
|
||||||
Jan Grulich <grulja@gmail.com>
|
Jan Grulich <grulja@gmail.com>
|
||||||
|
|||||||
@ -69,6 +69,7 @@ if (is_android) {
|
|||||||
"//api/audio_codecs:builtin_audio_decoder_factory",
|
"//api/audio_codecs:builtin_audio_decoder_factory",
|
||||||
"//api/audio_codecs:builtin_audio_encoder_factory",
|
"//api/audio_codecs:builtin_audio_encoder_factory",
|
||||||
"//api/task_queue:default_task_queue_factory",
|
"//api/task_queue:default_task_queue_factory",
|
||||||
|
"//api/units:time_delta",
|
||||||
"//api/voip:voip_api",
|
"//api/voip:voip_api",
|
||||||
"//api/voip:voip_engine_factory",
|
"//api/voip:voip_engine_factory",
|
||||||
"//rtc_base/network:received_packet",
|
"//rtc_base/network:received_packet",
|
||||||
|
|||||||
@ -16,8 +16,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
|
||||||
#include <unordered_set>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -25,9 +23,12 @@
|
|||||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||||
#include "api/task_queue/default_task_queue_factory.h"
|
#include "api/task_queue/default_task_queue_factory.h"
|
||||||
|
#include "api/units/time_delta.h"
|
||||||
|
#include "api/voip/voip_base.h"
|
||||||
#include "api/voip/voip_codec.h"
|
#include "api/voip/voip_codec.h"
|
||||||
#include "api/voip/voip_engine_factory.h"
|
#include "api/voip/voip_engine_factory.h"
|
||||||
#include "api/voip/voip_network.h"
|
#include "api/voip/voip_network.h"
|
||||||
|
#include "api/voip/voip_statistics.h"
|
||||||
#include "examples/androidvoip/generated_jni/VoipClient_jni.h"
|
#include "examples/androidvoip/generated_jni/VoipClient_jni.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "rtc_base/network.h"
|
#include "rtc_base/network.h"
|
||||||
@ -333,6 +334,28 @@ void AndroidVoipClient::StartSession(JNIEnv* env) {
|
|||||||
});
|
});
|
||||||
Java_VoipClient_onStartSessionCompleted(env_, j_voip_client_,
|
Java_VoipClient_onStartSessionCompleted(env_, j_voip_client_,
|
||||||
/*isSuccessful=*/true);
|
/*isSuccessful=*/true);
|
||||||
|
voip_thread_->PostTask([this, env] { LogChannelStatistics(env); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidVoipClient::LogChannelStatistics(JNIEnv* env) {
|
||||||
|
RUN_ON_VOIP_THREAD(LogChannelStatistics, env)
|
||||||
|
|
||||||
|
if (!channel_)
|
||||||
|
return;
|
||||||
|
webrtc::ChannelStatistics stats;
|
||||||
|
if (voip_engine_->Statistics().GetChannelStatistics(*channel_, stats) ==
|
||||||
|
webrtc::VoipResult::kInvalidArgument)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RTC_LOG(LS_INFO) << "PACKETS SENT: " << stats.packets_sent
|
||||||
|
<< " BYTES SENT: " << stats.bytes_sent
|
||||||
|
<< " PACKETS RECV: " << stats.packets_received
|
||||||
|
<< " BYTES RECV: " << stats.bytes_received
|
||||||
|
<< " JITTER: " << stats.jitter
|
||||||
|
<< " PACKETS LOST: " << stats.packets_lost;
|
||||||
|
|
||||||
|
voip_thread_->PostDelayedTask([this, env] { LogChannelStatistics(env); },
|
||||||
|
webrtc::TimeDelta::Seconds(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidVoipClient::StopSession(JNIEnv* env) {
|
void AndroidVoipClient::StopSession(JNIEnv* env) {
|
||||||
|
|||||||
@ -150,6 +150,9 @@ class AndroidVoipClient : public webrtc::Transport {
|
|||||||
void ReadRTPPacket(const std::vector<uint8_t>& packet_copy);
|
void ReadRTPPacket(const std::vector<uint8_t>& packet_copy);
|
||||||
void ReadRTCPPacket(const std::vector<uint8_t>& packet_copy);
|
void ReadRTCPPacket(const std::vector<uint8_t>& packet_copy);
|
||||||
|
|
||||||
|
// Method to print out ChannelStatistics
|
||||||
|
void LogChannelStatistics(JNIEnv* env);
|
||||||
|
|
||||||
// Used to invoke operations and send/receive RTP/RTCP packets.
|
// Used to invoke operations and send/receive RTP/RTCP packets.
|
||||||
std::unique_ptr<rtc::Thread> voip_thread_;
|
std::unique_ptr<rtc::Thread> voip_thread_;
|
||||||
// Reference to the VoipClient java instance used to
|
// Reference to the VoipClient java instance used to
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user