| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 #else | 111 #else |
| 112 sync_socket_handle = socket_descriptor.fd; | 112 sync_socket_handle = socket_descriptor.fd; |
| 113 #endif | 113 #endif |
| 114 sync_socket_.reset(new base::SyncSocket(sync_socket_handle)); | 114 sync_socket_.reset(new base::SyncSocket(sync_socket_handle)); |
| 115 | 115 |
| 116 // And then delegate the call to the mock method. | 116 // And then delegate the call to the mock method. |
| 117 OnStreamCreated(stream_id, length); | 117 OnStreamCreated(stream_id, length); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void OnStreamStateChanged(const IPC::Message& msg, int stream_id, | 120 void OnStreamStateChanged(const IPC::Message& msg, int stream_id, |
| 121 AudioStreamState state) { | 121 media::AudioOutputIPCDelegate::State state) { |
| 122 if (state == kAudioStreamPlaying) { | 122 switch (state) { |
| 123 OnStreamPlaying(stream_id); | 123 case media::AudioOutputIPCDelegate::kPlaying: |
| 124 } else if (state == kAudioStreamPaused) { | 124 OnStreamPlaying(stream_id); |
| 125 OnStreamPaused(stream_id); | 125 break; |
| 126 } else if (state == kAudioStreamError) { | 126 case media::AudioOutputIPCDelegate::kPaused: |
| 127 OnStreamError(stream_id); | 127 OnStreamPaused(stream_id); |
| 128 } else { | 128 break; |
| 129 FAIL() << "Unknown stream state"; | 129 case media::AudioOutputIPCDelegate::kError: |
| 130 OnStreamError(stream_id); |
| 131 break; |
| 132 default: |
| 133 FAIL() << "Unknown stream state"; |
| 134 break; |
| 130 } | 135 } |
| 131 } | 136 } |
| 132 | 137 |
| 133 void OnStreamVolume(const IPC::Message& msg, int stream_id, double volume) { | 138 void OnStreamVolume(const IPC::Message& msg, int stream_id, double volume) { |
| 134 OnStreamVolume(stream_id, volume); | 139 OnStreamVolume(stream_id, volume); |
| 135 } | 140 } |
| 136 | 141 |
| 137 scoped_ptr<base::SharedMemory> shared_memory_; | 142 scoped_ptr<base::SharedMemory> shared_memory_; |
| 138 scoped_ptr<base::SyncSocket> sync_socket_; | 143 scoped_ptr<base::SyncSocket> sync_socket_; |
| 139 uint32 shared_memory_length_; | 144 uint32 shared_memory_length_; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 EnableRealDevice(); | 403 EnableRealDevice(); |
| 399 | 404 |
| 400 Create(); | 405 Create(); |
| 401 Play(); | 406 Play(); |
| 402 SimulateError(); | 407 SimulateError(); |
| 403 Close(); | 408 Close(); |
| 404 } | 409 } |
| 405 | 410 |
| 406 | 411 |
| 407 // TODO(hclam): Add tests for data conversation in low latency mode. | 412 // TODO(hclam): Add tests for data conversation in low latency mode. |
| OLD | NEW |