Improves logging in MediaChannel
This CL changes the style of logging for an API which is essential when WebRTC is used in Chrome. By changing the format, we can more easily tie in (search for tags etc.) logs from WebRTC with logs in Chrome. See e.g. https://chromium-review.googlesource.com/c/chromium/src/+/2093443 for more details. I decided to use a new private method to avoid using rtc::StringBuilder. The idea was to make the log statements less complex and more condensed. Tbr: mbonadei Bug: webrtc:11493 Change-Id: I46b4a933ad62ac1db376743b4a41b62c5f8c6ac6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172841 Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31808}
This commit is contained in:
parent
3ea3e0c345
commit
c6cf902034
@ -11,7 +11,6 @@
|
||||
#include "media/engine/webrtc_voice_engine.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -43,6 +42,7 @@
|
||||
#include "rtc_base/race_checker.h"
|
||||
#include "rtc_base/strings/audio_format_to_string.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/strings/string_format.h"
|
||||
#include "rtc_base/third_party/base64/base64.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
@ -2051,14 +2051,19 @@ bool WebRtcVoiceMediaChannel::SetLocalSource(uint32_t ssrc,
|
||||
|
||||
bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) {
|
||||
RTC_DCHECK(worker_thread_checker_.IsCurrent());
|
||||
RTC_LOG(LS_INFO) << rtc::StringFormat("WRVMC::%s({ssrc=%u}, {volume=%.2f})",
|
||||
__func__, ssrc, volume);
|
||||
const auto it = recv_streams_.find(ssrc);
|
||||
if (it == recv_streams_.end()) {
|
||||
RTC_LOG(LS_WARNING) << "SetOutputVolume: no recv stream " << ssrc;
|
||||
RTC_LOG(LS_WARNING) << rtc::StringFormat(
|
||||
"WRVMC::%s => (WARNING: no receive stream for SSRC %u)", __func__,
|
||||
ssrc);
|
||||
return false;
|
||||
}
|
||||
it->second->SetOutputVolume(volume);
|
||||
RTC_LOG(LS_INFO) << "SetOutputVolume() to " << volume
|
||||
<< " for recv stream with ssrc " << ssrc;
|
||||
RTC_LOG(LS_INFO) << rtc::StringFormat(
|
||||
"WRVMC::%s => (stream with SSRC %u now uses volume %.2f)", __func__, ssrc,
|
||||
volume);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "rtc_base/location.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/strings/string_format.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/thread_checker.h"
|
||||
|
||||
@ -102,6 +103,8 @@ bool RemoteAudioSource::remote() const {
|
||||
void RemoteAudioSource::SetVolume(double volume) {
|
||||
RTC_DCHECK_GE(volume, 0);
|
||||
RTC_DCHECK_LE(volume, 10);
|
||||
RTC_LOG(LS_INFO) << rtc::StringFormat("RAS::%s({volume=%.2f})", __func__,
|
||||
volume);
|
||||
for (auto* observer : audio_observers_) {
|
||||
observer->OnSetVolume(volume);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user