Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: media/audio/mac/audio_low_latency_output_mac.cc

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix various compiler errors Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/mac/audio_low_latency_output_mac.h" 5 #include "media/audio/mac/audio_low_latency_output_mac.h"
6 6
7 #include <CoreServices/CoreServices.h> 7 #include <CoreServices/CoreServices.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/mac_logging.h" 11 #include "base/mac/mac_logging.h"
12 #include "media/audio/audio_util.h" 12 #include "media/audio/audio_util.h"
13 #include "media/audio/mac/audio_manager_mac.h" 13 #include "media/audio/mac/audio_manager_mac.h"
14 14
15 namespace media {
16
15 // Reorder PCM from AAC layout to Core Audio 5.1 layout. 17 // Reorder PCM from AAC layout to Core Audio 5.1 layout.
16 // TODO(fbarchard): Switch layout when ffmpeg is updated. 18 // TODO(fbarchard): Switch layout when ffmpeg is updated.
17 template<class Format> 19 template<class Format>
18 static void SwizzleCoreAudioLayout5_1(Format* b, uint32 filled) { 20 static void SwizzleCoreAudioLayout5_1(Format* b, uint32 filled) {
19 static const int kNumSurroundChannels = 6; 21 static const int kNumSurroundChannels = 6;
20 Format aac[kNumSurroundChannels]; 22 Format aac[kNumSurroundChannels];
21 for (uint32 i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { 23 for (uint32 i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) {
22 memcpy(aac, b, sizeof(aac)); 24 memcpy(aac, b, sizeof(aac));
23 b[0] = aac[1]; // L 25 b[0] = aac[1]; // L
24 b[1] = aac[2]; // R 26 b[1] = aac[2]; // R
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Get the delay between the moment getting the callback and the scheduled 339 // Get the delay between the moment getting the callback and the scheduled
338 // time stamp that tells when the data is going to be played out. 340 // time stamp that tells when the data is going to be played out.
339 UInt64 output_time_ns = AudioConvertHostTimeToNanos( 341 UInt64 output_time_ns = AudioConvertHostTimeToNanos(
340 output_time_stamp->mHostTime); 342 output_time_stamp->mHostTime);
341 UInt64 now_ns = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime()); 343 UInt64 now_ns = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime());
342 double delay_frames = static_cast<double> 344 double delay_frames = static_cast<double>
343 (1e-9 * (output_time_ns - now_ns) * format_.mSampleRate); 345 (1e-9 * (output_time_ns - now_ns) * format_.mSampleRate);
344 346
345 return (delay_frames + hardware_latency_frames_); 347 return (delay_frames + hardware_latency_frames_);
346 } 348 }
349
350 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698