| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/task_runner.h" | 8 #include "base/task_runner.h" |
| 9 | 9 |
| 10 #include "services/media/audio/audio_output_manager.h" | 10 #include "services/media/audio/audio_output_manager.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 size_t size_before = tracks_.size(); | 51 size_t size_before = tracks_.size(); |
| 52 (*tracks_.begin())->Shutdown(); | 52 (*tracks_.begin())->Shutdown(); |
| 53 size_t size_after = tracks_.size(); | 53 size_t size_after = tracks_.size(); |
| 54 DCHECK_LT(size_after, size_before); | 54 DCHECK_LT(size_after, size_before); |
| 55 } | 55 } |
| 56 | 56 |
| 57 output_manager_.Shutdown(); | 57 output_manager_.Shutdown(); |
| 58 DoPacketCleanup(); | 58 DoPacketCleanup(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AudioServerImpl::CreateTrack(InterfaceRequest<AudioTrack> track) { | 61 void AudioServerImpl::CreateTrack(InterfaceRequest<AudioTrack> track, |
| 62 tracks_.insert(AudioTrackImpl::Create(track.Pass(), this)); | 62 InterfaceRequest<MediaRenderer> renderer) { |
| 63 tracks_.insert(AudioTrackImpl::Create(track.Pass(), renderer.Pass(), this)); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void AudioServerImpl::DoPacketCleanup() { | 66 void AudioServerImpl::DoPacketCleanup() { |
| 66 // In order to minimize the time we spend in the lock, we allocate a new | 67 // In order to minimize the time we spend in the lock, we allocate a new |
| 67 // queue, then lock, swap and clear the sched flag, and finally clean out the | 68 // queue, then lock, swap and clear the sched flag, and finally clean out the |
| 68 // queue (which has the side effect of triggering all of the send packet | 69 // queue (which has the side effect of triggering all of the send packet |
| 69 // callbacks). | 70 // callbacks). |
| 70 // | 71 // |
| 71 // Note: this is only safe because we know that we are executing on a single | 72 // Note: this is only safe because we know that we are executing on a single |
| 72 // threaded task runner. Without this guarantee, it might be possible call | 73 // threaded task runner. Without this guarantee, it might be possible call |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (!cleanup_scheduled_ && !shutting_down_) { | 106 if (!cleanup_scheduled_ && !shutting_down_) { |
| 106 DCHECK(task_runner_); | 107 DCHECK(task_runner_); |
| 107 cleanup_scheduled_ = task_runner_->PostTask(FROM_HERE, cleanup_closure_); | 108 cleanup_scheduled_ = task_runner_->PostTask(FROM_HERE, cleanup_closure_); |
| 108 DCHECK(cleanup_scheduled_); | 109 DCHECK(cleanup_scheduled_); |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace audio | 113 } // namespace audio |
| 113 } // namespace media | 114 } // namespace media |
| 114 } // namespace mojo | 115 } // namespace mojo |
| OLD | NEW |