| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // THREAD SAFETY | 5 // THREAD SAFETY |
| 6 // | 6 // |
| 7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used | 7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used |
| 8 // from the audio thread. We DCHECK on this assumption whenever we can. | 8 // from the audio thread. We DCHECK on this assumption whenever we can. |
| 9 // | 9 // |
| 10 // SEMANTICS OF Close() | 10 // SEMANTICS OF Close() |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::TimeDelta::FromMicroseconds(kMinLatencyMicros), | 146 base::TimeDelta::FromMicroseconds(kMinLatencyMicros), |
| 147 FramesToTimeDelta(params.frames_per_buffer() * 2, sample_rate_))), | 147 FramesToTimeDelta(params.frames_per_buffer() * 2, sample_rate_))), |
| 148 bytes_per_output_frame_(bytes_per_frame_), | 148 bytes_per_output_frame_(bytes_per_frame_), |
| 149 alsa_buffer_frames_(0), | 149 alsa_buffer_frames_(0), |
| 150 stop_stream_(false), | 150 stop_stream_(false), |
| 151 wrapper_(wrapper), | 151 wrapper_(wrapper), |
| 152 manager_(manager), | 152 manager_(manager), |
| 153 message_loop_(base::MessageLoop::current()), | 153 message_loop_(base::MessageLoop::current()), |
| 154 playback_handle_(NULL), | 154 playback_handle_(NULL), |
| 155 frames_per_packet_(packet_size_ / bytes_per_frame_), | 155 frames_per_packet_(packet_size_ / bytes_per_frame_), |
| 156 weak_factory_(this), | |
| 157 state_(kCreated), | 156 state_(kCreated), |
| 158 volume_(1.0f), | 157 volume_(1.0f), |
| 159 source_callback_(NULL), | 158 source_callback_(NULL), |
| 160 audio_bus_(AudioBus::Create(params)) { | 159 audio_bus_(AudioBus::Create(params)), |
| 160 weak_factory_(this) { |
| 161 DCHECK(manager_->GetTaskRunner()->BelongsToCurrentThread()); | 161 DCHECK(manager_->GetTaskRunner()->BelongsToCurrentThread()); |
| 162 DCHECK_EQ(audio_bus_->frames() * bytes_per_frame_, packet_size_); | 162 DCHECK_EQ(audio_bus_->frames() * bytes_per_frame_, packet_size_); |
| 163 | 163 |
| 164 // Sanity check input values. | 164 // Sanity check input values. |
| 165 if (!params.IsValid()) { | 165 if (!params.IsValid()) { |
| 166 LOG(WARNING) << "Unsupported audio parameters."; | 166 LOG(WARNING) << "Unsupported audio parameters."; |
| 167 TransitionTo(kInError); | 167 TransitionTo(kInError); |
| 168 } | 168 } |
| 169 | 169 |
| 170 if (pcm_format_ == SND_PCM_FORMAT_UNKNOWN) { | 170 if (pcm_format_ == SND_PCM_FORMAT_UNKNOWN) { |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 755 } |
| 756 | 756 |
| 757 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 757 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
| 758 // release ownership of the currently registered callback. | 758 // release ownership of the currently registered callback. |
| 759 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 759 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
| 760 DCHECK(IsOnAudioThread()); | 760 DCHECK(IsOnAudioThread()); |
| 761 source_callback_ = callback; | 761 source_callback_ = callback; |
| 762 } | 762 } |
| 763 | 763 |
| 764 } // namespace media | 764 } // namespace media |
| OLD | NEW |