Chromium Code Reviews| 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 #include "media/audio/audio_output_controller.h" | 5 #include "media/audio/audio_output_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 state_ = kError; | 134 state_ = kError; |
| 135 DoStopCloseAndClearStream(NULL); | 135 DoStopCloseAndClearStream(NULL); |
| 136 | 136 |
| 137 // TODO(hclam): Define error types. | 137 // TODO(hclam): Define error types. |
| 138 handler_->OnError(this, 0); | 138 handler_->OnError(this, 0); |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Everything started okay, so register for state change callbacks if we have | 142 // Everything started okay, so register for state change callbacks if we have |
| 143 // not already done so. | 143 // not already done so. |
| 144 audio_manager_->AddOutputDeviceChangeListener(this); | 144 if (state_ != kRecreating) |
|
miu
2013/01/04 21:57:56
This will leave us in a state where AOC is not reg
justinlin
2013/01/04 22:31:02
Right. Hmm, I saw a DCHECK failure due to this (ob
| |
| 145 audio_manager_->AddOutputDeviceChangeListener(this); | |
| 145 | 146 |
| 146 // We have successfully opened the stream. Set the initial volume. | 147 // We have successfully opened the stream. Set the initial volume. |
| 147 stream_->SetVolume(volume_); | 148 stream_->SetVolume(volume_); |
| 148 | 149 |
| 149 // Finally set the state to kCreated. | 150 // Finally set the state to kCreated. |
| 150 State original_state = state_; | 151 State original_state = state_; |
| 151 state_ = kCreated; | 152 state_ = kCreated; |
| 152 | 153 |
| 153 // And then report we have been created if we haven't done so already. | 154 // And then report we have been created if we haven't done so already. |
| 154 if (original_state != kRecreating) | 155 if (original_state != kRecreating) |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 case kPausedWhenStarting: | 388 case kPausedWhenStarting: |
| 388 case kPaused: | 389 case kPaused: |
| 389 // From the outside these three states are equivalent. | 390 // From the outside these three states are equivalent. |
| 390 return; | 391 return; |
| 391 default: | 392 default: |
| 392 NOTREACHED() << "Invalid original state."; | 393 NOTREACHED() << "Invalid original state."; |
| 393 } | 394 } |
| 394 } | 395 } |
| 395 | 396 |
| 396 } // namespace media | 397 } // namespace media |
| OLD | NEW |