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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp

Issue 2013623002: Set channelCount and maxChannelCount correctly for OfflineAudioContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 : AudioDestinationHandler(node, renderTarget->sampleRate()) 42 : AudioDestinationHandler(node, renderTarget->sampleRate())
43 , m_renderTarget(renderTarget) 43 , m_renderTarget(renderTarget)
44 , m_renderThread(adoptPtr(Platform::current()->createThread("offline audio r enderer"))) 44 , m_renderThread(adoptPtr(Platform::current()->createThread("offline audio r enderer")))
45 , m_framesProcessed(0) 45 , m_framesProcessed(0)
46 , m_framesToProcess(0) 46 , m_framesToProcess(0)
47 , m_isRenderingStarted(false) 47 , m_isRenderingStarted(false)
48 , m_shouldSuspend(false) 48 , m_shouldSuspend(false)
49 { 49 {
50 m_renderBus = AudioBus::create(renderTarget->numberOfChannels(), renderQuant umSize); 50 m_renderBus = AudioBus::create(renderTarget->numberOfChannels(), renderQuant umSize);
51 m_framesToProcess = m_renderTarget->length(); 51 m_framesToProcess = m_renderTarget->length();
52
53 // Node-specific defaults.
54 m_channelCount = m_renderTarget->numberOfChannels();
55 m_channelCountMode = Explicit;
56 m_channelInterpretation = AudioBus::Speakers;
52 } 57 }
53 58
54 PassRefPtr<OfflineAudioDestinationHandler> OfflineAudioDestinationHandler::creat e(AudioNode& node, AudioBuffer* renderTarget) 59 PassRefPtr<OfflineAudioDestinationHandler> OfflineAudioDestinationHandler::creat e(AudioNode& node, AudioBuffer* renderTarget)
55 { 60 {
56 return adoptRef(new OfflineAudioDestinationHandler(node, renderTarget)); 61 return adoptRef(new OfflineAudioDestinationHandler(node, renderTarget));
57 } 62 }
58 63
59 OfflineAudioDestinationHandler::~OfflineAudioDestinationHandler() 64 OfflineAudioDestinationHandler::~OfflineAudioDestinationHandler()
60 { 65 {
61 ASSERT(!isInitialized()); 66 ASSERT(!isInitialized());
(...skipping 22 matching lines...) Expand all
84 m_renderThread.clear(); 89 m_renderThread.clear();
85 90
86 AudioHandler::uninitialize(); 91 AudioHandler::uninitialize();
87 } 92 }
88 93
89 OfflineAudioContext* OfflineAudioDestinationHandler::context() const 94 OfflineAudioContext* OfflineAudioDestinationHandler::context() const
90 { 95 {
91 return static_cast<OfflineAudioContext*>(AudioDestinationHandler::context()) ; 96 return static_cast<OfflineAudioContext*>(AudioDestinationHandler::context()) ;
92 } 97 }
93 98
99 unsigned long OfflineAudioDestinationHandler::maxChannelCount() const
100 {
101 return m_channelCount;
102 }
103
94 void OfflineAudioDestinationHandler::startRendering() 104 void OfflineAudioDestinationHandler::startRendering()
95 { 105 {
96 ASSERT(isMainThread()); 106 ASSERT(isMainThread());
97 ASSERT(m_renderThread); 107 ASSERT(m_renderThread);
98 ASSERT(m_renderTarget); 108 ASSERT(m_renderTarget);
99 109
100 if (!m_renderTarget) 110 if (!m_renderTarget)
101 return; 111 return;
102 112
103 // Rendering was not started. Starting now. 113 // Rendering was not started. Starting now.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 { 318 {
309 setHandler(OfflineAudioDestinationHandler::create(*this, renderTarget)); 319 setHandler(OfflineAudioDestinationHandler::create(*this, renderTarget));
310 } 320 }
311 321
312 OfflineAudioDestinationNode* OfflineAudioDestinationNode::create(AbstractAudioCo ntext* context, AudioBuffer* renderTarget) 322 OfflineAudioDestinationNode* OfflineAudioDestinationNode::create(AbstractAudioCo ntext* context, AudioBuffer* renderTarget)
313 { 323 {
314 return new OfflineAudioDestinationNode(*context, renderTarget); 324 return new OfflineAudioDestinationNode(*context, renderTarget);
315 } 325 }
316 326
317 } // namespace blink 327 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698