| 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 "ppapi/shared_impl/ppb_audio_shared.h" | 5 #include "ppapi/shared_impl/ppb_audio_shared.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "ppapi/nacl_irt/public/irt_ppapi.h" | 9 #include "ppapi/nacl_irt/public/irt_ppapi.h" |
| 10 #include "ppapi/shared_impl/ppapi_globals.h" | 10 #include "ppapi/shared_impl/ppapi_globals.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } else if (callback_1_0_) { | 44 } else if (callback_1_0_) { |
| 45 callback_1_0_(sample_buffer, buffer_size_in_bytes, user_data); | 45 callback_1_0_(sample_buffer, buffer_size_in_bytes, user_data); |
| 46 } else { | 46 } else { |
| 47 NOTREACHED(); | 47 NOTREACHED(); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 PPB_Audio_Shared::PPB_Audio_Shared() | 51 PPB_Audio_Shared::PPB_Audio_Shared() |
| 52 : playing_(false), | 52 : playing_(false), |
| 53 shared_memory_size_(0), | 53 shared_memory_size_(0), |
| 54 nacl_thread_id_(0), |
| 54 nacl_thread_active_(false), | 55 nacl_thread_active_(false), |
| 55 user_data_(NULL), | 56 user_data_(NULL), |
| 56 client_buffer_size_bytes_(0), | 57 client_buffer_size_bytes_(0), |
| 57 bytes_per_second_(0), | 58 bytes_per_second_(0), |
| 58 buffer_index_(0) { | 59 buffer_index_(0) { |
| 59 } | 60 } |
| 60 | 61 |
| 61 PPB_Audio_Shared::~PPB_Audio_Shared() { | 62 PPB_Audio_Shared::~PPB_Audio_Shared() { |
| 62 // Shut down the socket to escape any hanging |Receive|s. | 63 // Shut down the socket to escape any hanging |Receive|s. |
| 63 if (socket_.get()) | 64 if (socket_.get()) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Let the other end know which buffer we just filled. The buffer index is | 230 // Let the other end know which buffer we just filled. The buffer index is |
| 230 // used to ensure the other end is getting the buffer it expects. For more | 231 // used to ensure the other end is getting the buffer it expects. For more |
| 231 // details on how this works see AudioSyncReader::WaitUntilDataIsReady(). | 232 // details on how this works see AudioSyncReader::WaitUntilDataIsReady(). |
| 232 size_t bytes_sent = socket_->Send(&buffer_index_, sizeof(buffer_index_)); | 233 size_t bytes_sent = socket_->Send(&buffer_index_, sizeof(buffer_index_)); |
| 233 if (bytes_sent != sizeof(buffer_index_)) | 234 if (bytes_sent != sizeof(buffer_index_)) |
| 234 break; | 235 break; |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 | 238 |
| 238 } // namespace ppapi | 239 } // namespace ppapi |
| OLD | NEW |