|
1 | | -#ifndef AUDIO_FRAME_HXX |
2 | | -#define AUDIO_FRAME_HXX |
| 1 | +#ifndef LIB_WEBRTC_RTC_AUDIO_FRAME_HXX |
| 2 | +#define LIB_WEBRTC_RTC_AUDIO_FRAME_HXX |
3 | 3 |
|
4 | | -#include "media_manager_types.h" |
| 4 | +#include "rtc_types.h" |
5 | 5 |
|
6 | | -namespace b2bua { |
| 6 | +namespace libwebrtc { |
7 | 7 |
|
8 | | -class AudioFrame { |
| 8 | +class RTCAudioFrame : public RefCountInterface { |
9 | 9 | public: |
10 | | - /** |
11 | | - * @brief Creates a new instance of AudioFrame. |
12 | | - * @return AudioFrame*: a pointer to the newly created AudioFrame. |
13 | | - */ |
14 | | - MEDIA_MANAGER_API static AudioFrame* Create(); |
| 10 | + LIB_WEBRTC_API static scoped_refptr<RTCAudioFrame> Create(); |
15 | 11 |
|
16 | | - /** |
17 | | - * @brief Creates a new instance of AudioFrame with specified parameters. |
18 | | - * @param id: the unique identifier of the frame. |
19 | | - * @param timestamp: the timestamp of the frame. |
20 | | - * @param data: a pointer to the audio data buffer. |
21 | | - * @param samples_per_channel: the number of samples per channel. |
22 | | - * @param sample_rate_hz: the sample rate in Hz. |
23 | | - * @param num_channels: the number of audio channels. |
24 | | - * @return AudioFrame*: a pointer to the newly created AudioFrame. |
25 | | - */ |
26 | | - MEDIA_MANAGER_API static AudioFrame* Create(int id, uint32_t timestamp, |
27 | | - const int16_t* data, |
28 | | - size_t samples_per_channel, |
29 | | - int sample_rate_hz, |
30 | | - size_t num_channels = 1); |
31 | | - |
32 | | - /** |
33 | | - * @brief Releases the memory of this AudioFrame. |
34 | | - */ |
35 | | - virtual void Release() = 0; |
| 12 | + LIB_WEBRTC_API static scoped_refptr<RTCAudioFrame> Create( |
| 13 | + uint32_t timestamp, const int16_t* data, size_t samples_per_channel, |
| 14 | + int sample_rate_hz, size_t num_channels = 1); |
36 | 15 |
|
37 | 16 | public: |
38 | | - /** |
39 | | - * @brief Updates the audio frame with specified parameters. |
40 | | - * @param id: the unique identifier of the frame. |
41 | | - * @param timestamp: the timestamp of the frame. |
42 | | - * @param data: a pointer to the audio data buffer. |
43 | | - * @param samples_per_channel: the number of samples per channel. |
44 | | - * @param sample_rate_hz: the sample rate in Hz. |
45 | | - * @param num_channels: the number of audio channels. |
46 | | - */ |
47 | | - virtual void UpdateFrame(int id, uint32_t timestamp, const int16_t* data, |
| 17 | + virtual void UpdateFrame(uint32_t timestamp, const int16_t* data, |
48 | 18 | size_t samples_per_channel, int sample_rate_hz, |
49 | 19 | size_t num_channels = 1) = 0; |
50 | 20 |
|
51 | | - /** |
52 | | - * @brief Copies the contents of another AudioFrame. |
53 | | - * @param src: the source AudioFrame to copy from. |
54 | | - */ |
55 | | - virtual void CopyFrom(const AudioFrame& src) = 0; |
| 21 | + virtual void CopyFrom(const scoped_refptr<RTCAudioFrame> src) = 0; |
56 | 22 |
|
57 | | - /** |
58 | | - * @brief Adds another AudioFrame to this one. |
59 | | - * @param frame_to_add: the AudioFrame to add. |
60 | | - */ |
61 | | - virtual void Add(const AudioFrame& frame_to_add) = 0; |
| 23 | + virtual void Add(const scoped_refptr<RTCAudioFrame> frame_to_add) = 0; |
62 | 24 |
|
63 | | - /** |
64 | | - * @brief Mutes the audio data in this AudioFrame. |
65 | | - */ |
66 | 25 | virtual void Mute() = 0; |
67 | 26 |
|
68 | | - /** |
69 | | - * @brief Returns a pointer to the audio data buffer. |
70 | | - * @return const int16_t*: a pointer to the audio data buffer. |
71 | | - */ |
72 | 27 | virtual const int16_t* data() = 0; |
73 | 28 |
|
74 | | - /** |
75 | | - * @brief Returns the number of samples per channel. |
76 | | - * @return size_t: the number of samples per channel. |
77 | | - */ |
78 | 29 | virtual size_t samples_per_channel() = 0; |
79 | 30 |
|
80 | | - /** |
81 | | - * @brief Returns the sample rate in Hz. |
82 | | - * @return int: the sample rate in Hz. |
83 | | - */ |
84 | 31 | virtual int sample_rate_hz() = 0; |
85 | 32 |
|
86 | | - /** |
87 | | - * @brief Returns the number of audio channels. |
88 | | - * @return size_t: the number of audio channels. |
89 | | - */ |
90 | 33 | virtual size_t num_channels() = 0; |
91 | 34 |
|
92 | | - /** |
93 | | - * @brief Returns the timestamp of the AudioFrame. |
94 | | - * @return uint32_t: the timestamp of the AudioFrame. |
95 | | - */ |
96 | 35 | virtual uint32_t timestamp() = 0; |
97 | | - |
98 | | - /** |
99 | | - * @brief Returns the unique identifier of the AudioFrame. |
100 | | - * @return int: the unique identifier of the AudioFrame. |
101 | | - */ |
102 | | - |
103 | | - virtual int id() = 0; |
104 | 36 | }; |
105 | 37 |
|
106 | | -}; // namespace b2bua |
| 38 | +} // namespace libwebrtc |
107 | 39 |
|
108 | 40 | #endif |
0 commit comments