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 "content/browser/renderer_host/media/audio_sync_reader.h" | 5 #include "content/browser/renderer_host/media/audio_sync_reader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // media::AudioOutputController::SyncReader implementations. | 52 // media::AudioOutputController::SyncReader implementations. |
53 void AudioSyncReader::UpdatePendingBytes(uint32 bytes) { | 53 void AudioSyncReader::UpdatePendingBytes(uint32 bytes) { |
54 // Zero out the entire output buffer to avoid stuttering/repeating-buffers | 54 // Zero out the entire output buffer to avoid stuttering/repeating-buffers |
55 // in the anomalous case if the renderer is unable to keep up with real-time. | 55 // in the anomalous case if the renderer is unable to keep up with real-time. |
56 output_bus_->Zero(); | 56 output_bus_->Zero(); |
57 socket_->Send(&bytes, sizeof(bytes)); | 57 socket_->Send(&bytes, sizeof(bytes)); |
58 ++buffer_index_; | 58 ++buffer_index_; |
59 } | 59 } |
60 | 60 |
61 void AudioSyncReader::Read(const AudioBus* source, AudioBus* dest) { | 61 void AudioSyncReader::Read(AudioBus* dest) { |
62 ++renderer_callback_count_; | 62 ++renderer_callback_count_; |
63 if (!WaitUntilDataIsReady()) { | 63 if (!WaitUntilDataIsReady()) { |
64 ++renderer_missed_callback_count_; | 64 ++renderer_missed_callback_count_; |
65 dest->Zero(); | 65 dest->Zero(); |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 if (mute_audio_) | 69 if (mute_audio_) |
70 dest->Zero(); | 70 dest->Zero(); |
71 else | 71 else |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 base::TimeDelta::FromMilliseconds(1), | 147 base::TimeDelta::FromMilliseconds(1), |
148 base::TimeDelta::FromMilliseconds(1000), | 148 base::TimeDelta::FromMilliseconds(1000), |
149 50); | 149 50); |
150 return false; | 150 return false; |
151 } | 151 } |
152 | 152 |
153 return true; | 153 return true; |
154 } | 154 } |
155 | 155 |
156 } // namespace content | 156 } // namespace content |
OLD | NEW |