Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: webrtc/modules/audio_mixer/audio_mixer_impl.cc

Issue 2386383003: AudioMixer interface cleanup suggestions (Closed)
Patch Set: misc Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_mixer/audio_mixer_defines.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_mixer/audio_mixer_impl.cc
diff --git a/webrtc/modules/audio_mixer/audio_mixer_impl.cc b/webrtc/modules/audio_mixer/audio_mixer_impl.cc
index 44e04fa32d4aa6de25d5297b0cdc74154f1368ca..57a6e44f36d32f22e33784ebd7359204ab3ebbc7 100644
--- a/webrtc/modules/audio_mixer/audio_mixer_impl.cc
+++ b/webrtc/modules/audio_mixer/audio_mixer_impl.cc
@@ -23,11 +23,14 @@ namespace {
class SourceFrame {
public:
+ // !!!: Style guide is against abbreviations. Plus these don't make sense. 'p'
+ // for MixerAudioSource?
SourceFrame(MixerAudioSource* p, AudioFrame* a, bool m, bool was_mixed_before)
: audio_source_(p),
audio_frame_(a),
muted_(m),
was_mixed_before_(was_mixed_before) {
+ // !!!: Here would be a good place to check pointers aren't null.
if (!muted_) {
energy_ = NewMixerCalculateEnergy(*a);
}
@@ -44,6 +47,7 @@ class SourceFrame {
energy_(energy),
was_mixed_before_(was_mixed_before) {}
+ // !!!: Capital S here.
// a.shouldMixBefore(b) is used to select mixer participants.
bool shouldMixBefore(const SourceFrame& other) const {
if (muted_ != other.muted_) {
@@ -60,6 +64,7 @@ class SourceFrame {
return energy_ > other.energy_;
}
+ // !!!: You should have accessors for these, so that you can e.g. check that
MixerAudioSource* audio_source_;
AudioFrame* audio_frame_;
bool muted_;
@@ -67,6 +72,7 @@ class SourceFrame {
bool was_mixed_before_;
};
+// !!!: The term is usually "Downmix".
// Remixes a frame between stereo and mono.
void RemixFrame(AudioFrame* frame, size_t number_of_channels) {
RTC_DCHECK(number_of_channels == 1 || number_of_channels == 2);
@@ -97,8 +103,10 @@ int32_t MixFromList(AudioFrame* mixed_audio,
const AudioFrameList& audio_frame_list,
int32_t id,
bool use_limiter) {
+ // !!!: Don't use WEBRTC_TRACE in new code
WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, id,
"MixFromList(mixed_audio, audio_frame_list)");
+ // !!!: Consistently use {} for one-liners, or don't.
if (audio_frame_list.empty())
return 0;
@@ -198,6 +206,7 @@ void AudioMixerImpl::Mix(int sample_rate,
}
if (OutputFrequency() != sample_rate) {
+ // !!!: Dangerous cast!
SetOutputFrequency(static_cast<Frequency>(sample_rate));
}
« no previous file with comments | « webrtc/modules/audio_mixer/audio_mixer_defines.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698