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

Side by Side Diff: webrtc/modules/audio_mixer/audio_mixer_defines.h

Issue 2302483002: Style changes in Audio Mixer (Closed)
Patch Set: Includes and order of includes. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_
12 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ 12 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_
13 13
14 #include <memory>
15
14 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
15 #include "webrtc/modules/include/module_common_types.h" 17 #include "webrtc/modules/include/module_common_types.h"
16 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
17 19
18 namespace webrtc { 20 namespace webrtc {
19 class NewMixHistory; 21
22 class NewMixHistory {
23 public:
24 NewMixHistory();
25 ~NewMixHistory();
26
27 // Returns true if the audio source is being mixed.
28 bool IsMixed() const;
29
30 // Returns true if the audio source was mixed previous mix
31 // iteration.
32 bool WasMixed() const;
33
34 // Updates the mixed status.
35 int32_t SetIsMixed(bool mixed);
36
37 void ResetMixedStatus();
38
39 private:
40 bool is_mixed_;
41 };
20 42
21 // A callback class that all mixer participants must inherit from/implement. 43 // A callback class that all mixer participants must inherit from/implement.
22 class MixerAudioSource { 44 class MixerAudioSource {
23 public: 45 public:
24 enum class AudioFrameInfo { 46 enum class AudioFrameInfo {
25 kNormal, // The samples in audio_frame are valid and should be used. 47 kNormal, // The samples in audio_frame are valid and should be used.
26 kMuted, // The samples in audio_frame should not be used, but should be 48 kMuted, // The samples in audio_frame should not be used, but should be
27 // implicitly interpreted as zero. Other fields in audio_frame 49 // implicitly interpreted as zero. Other fields in audio_frame
28 // may be read and should contain meaningful values. 50 // may be read and should contain meaningful values.
29 kError // audio_frame will not be used. 51 kError // audio_frame will not be used.
30 }; 52 };
31 53
32 struct AudioFrameWithMuted { 54 struct AudioFrameWithMuted {
33 AudioFrame* audio_frame; 55 AudioFrame* audio_frame;
34 AudioFrameInfo audio_frame_info; 56 AudioFrameInfo audio_frame_info;
35 }; 57 };
36 58
37 // The implementation of GetAudioFrameWithMuted should update 59 // The implementation of GetAudioFrameWithMuted should update
38 // audio_frame with new audio every time it's called. Implementing 60 // audio_frame with new audio every time it's called. Implementing
39 // classes are allowed to return the same AudioFrame pointer on 61 // classes are allowed to return the same AudioFrame pointer on
40 // different calls. The pointer must stay valid until the next 62 // different calls. The pointer must stay valid until the next
41 // mixing call or until this audio source is disconnected from the 63 // mixing call or until this audio source is disconnected from the
42 // mixer. 64 // mixer.
43 virtual AudioFrameWithMuted GetAudioFrameWithMuted(int32_t id, 65 virtual AudioFrameWithMuted GetAudioFrameWithMuted(int32_t id,
44 int sample_rate_hz) = 0; 66 int sample_rate_hz) = 0;
45 67
46 // Returns true if the participant was mixed this mix iteration. 68 // Returns true if the participant was mixed this mix iteration.
47 bool IsMixed() const; 69 bool IsMixed() const;
48 70
49 NewMixHistory* mix_history_; 71 std::unique_ptr<NewMixHistory> mix_history_;
50 72
51 protected: 73 protected:
52 MixerAudioSource(); 74 MixerAudioSource();
53 virtual ~MixerAudioSource(); 75 virtual ~MixerAudioSource();
54 }; 76 };
55 } // namespace webrtc 77 } // namespace webrtc
56 78
57 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ 79 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698