OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void set_volume(float volume) { | 62 void set_volume(float volume) { |
63 DCHECK(CalledOnValidThread()); | 63 DCHECK(CalledOnValidThread()); |
64 volume_ = volume; | 64 volume_ = volume; |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 bool playing_; | 68 bool playing_; |
69 float volume_; | 69 float volume_; |
70 }; | 70 }; |
71 | 71 |
| 72 |
| 73 // Returns platform specific optimal buffer size for rendering audio. |
| 74 static int GetOptimalBufferSize(int sample_rate, int hardware_buffer_size); |
| 75 |
72 WebRtcAudioRenderer( | 76 WebRtcAudioRenderer( |
73 const scoped_refptr<webrtc::MediaStreamInterface>& media_stream, | 77 const scoped_refptr<webrtc::MediaStreamInterface>& media_stream, |
74 int source_render_view_id, | 78 int source_render_view_id, |
75 int source_render_frame_id, | 79 int source_render_frame_id, |
76 int session_id, | 80 int session_id, |
77 int sample_rate, | 81 int sample_rate, |
78 int frames_per_buffer); | 82 int frames_per_buffer); |
79 | 83 |
80 // Initialize function called by clients like WebRtcAudioDeviceImpl. | 84 // Initialize function called by clients like WebRtcAudioDeviceImpl. |
81 // Stop() has to be called before |source| is deleted. | 85 // Stop() has to be called before |source| is deleted. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // Used for triggering new UMA histogram. Counts number of render | 236 // Used for triggering new UMA histogram. Counts number of render |
233 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. | 237 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. |
234 int render_callback_count_; | 238 int render_callback_count_; |
235 | 239 |
236 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 240 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
237 }; | 241 }; |
238 | 242 |
239 } // namespace content | 243 } // namespace content |
240 | 244 |
241 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 245 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
OLD | NEW |