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

Side by Side Diff: webrtc/api/audio/audio_mixer.h

Issue 2420913002: Move audio frame memory handling inside AudioMixer. (Closed)
Patch Set: Rebase. 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 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
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 enum class AudioFrameInfo { 29 enum class AudioFrameInfo {
30 kNormal, // The samples in audio_frame are valid and should be used. 30 kNormal, // The samples in audio_frame are valid and should be used.
31 kMuted, // The samples in audio_frame should not be used, but 31 kMuted, // The samples in audio_frame should not be used, but
32 // should be implicitly interpreted as zero. Other 32 // should be implicitly interpreted as zero. Other
33 // fields in audio_frame may be read and should 33 // fields in audio_frame may be read and should
34 // contain meaningful values. 34 // contain meaningful values.
35 kError, // The audio_frame will not be used. 35 kError, // The audio_frame will not be used.
36 }; 36 };
37 37
38 struct AudioFrameWithInfo { 38 // The AudioFrame pointer should be treated as only valid for the
39 AudioFrame* audio_frame; 39 // duration of this call. The passed AudioFrame is strictly an
40 AudioFrameInfo audio_frame_info; 40 // output parameter and its fields can have any values when being
41 }; 41 // passed to GetAudioFrameWithInfo. Implementing classes may
42 42 // return sound with either one or two interleaved
43 // The implementation of GetAudioFrameWithInfo should update 43 // channels. Implementing classes are responsible for filling all
44 // audio_frame with new audio every time it's called. Implementing 44 // fields of the provided AudioFrame with meaningful values.
45 // classes are allowed to return the same AudioFrame pointer on 45 virtual AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz,
46 // different calls. The pointer must stay valid until the next 46 AudioFrame* audio_frame) = 0;
kwiberg-webrtc 2016/10/14 19:59:32 You never say what the method is supposed to *do*,
aleloi 2016/10/17 11:06:39 I've updated the comment. I guess that it's clear
47 // mixing call or until this audio source is disconnected from the
48 // mixer. The mixer may modify the contents of the passed
49 // AudioFrame pointer at any time until the next call to
50 // GetAudioFrameWithInfo, or until the source is removed from the
51 // mixer.
52 virtual AudioFrameWithInfo GetAudioFrameWithInfo(int sample_rate_hz) = 0;
53 47
54 // A way for a mixer implementation to distinguish participants. 48 // A way for a mixer implementation to distinguish participants.
55 virtual int Ssrc() = 0; 49 virtual int Ssrc() = 0;
56 50
57 protected: 51 protected:
58 virtual ~Source() {} 52 virtual ~Source() {}
59 }; 53 };
60 54
61 // Since the mixer is reference counted, the destructor may be 55 // Since the mixer is reference counted, the destructor may be
62 // called from any thread. 56 // called from any thread.
(...skipping 10 matching lines...) Expand all
73 // mixed result is placed in the provided AudioFrame. Will only be 67 // mixed result is placed in the provided AudioFrame. Will only be
74 // called from a single thread. The rate and channels arguments 68 // called from a single thread. The rate and channels arguments
75 // specify the rate and number of channels of the mix result. 69 // specify the rate and number of channels of the mix result.
76 virtual void Mix(int sample_rate_hz, 70 virtual void Mix(int sample_rate_hz,
77 size_t number_of_channels, 71 size_t number_of_channels,
78 AudioFrame* audio_frame_for_mixing) = 0; 72 AudioFrame* audio_frame_for_mixing) = 0;
79 }; 73 };
80 } // namespace webrtc 74 } // namespace webrtc
81 75
82 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ 76 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_mixer/audio_mixer_impl.h » ('j') | webrtc/modules/audio_mixer/audio_mixer_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698