| 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));
|
| }
|
|
|
|
|