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

Side by Side Diff: services/media/audio/platform/generic/standard_output_base.cc

Issue 2051923002: Motown: Fix unique_ptrs to arrays so deallocation is done properly (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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 <limits> 5 #include <limits>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "services/media/audio/audio_track_impl.h" 8 #include "services/media/audio/audio_track_impl.h"
9 #include "services/media/audio/audio_track_to_output_link.h" 9 #include "services/media/audio/audio_track_to_output_link.h"
10 #include "services/media/audio/platform/generic/mixer.h" 10 #include "services/media/audio/platform/generic/mixer.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 // If we have a mix job, then we must have an output formatter, and an 81 // If we have a mix job, then we must have an output formatter, and an
82 // intermediate buffer allocated, and it must be large enough for the mix 82 // intermediate buffer allocated, and it must be large enough for the mix
83 // job we were given. 83 // job we were given.
84 DCHECK(mix_buf_); 84 DCHECK(mix_buf_);
85 DCHECK(output_formatter_); 85 DCHECK(output_formatter_);
86 DCHECK_LE(cur_mix_job_.buf_frames, mix_buf_frames_); 86 DCHECK_LE(cur_mix_job_.buf_frames, mix_buf_frames_);
87 87
88 // Fill the intermediate buffer with silence. 88 // Fill the intermediate buffer with silence.
89 size_t bytes_to_zero = sizeof(*mix_buf_) 89 size_t bytes_to_zero = sizeof(int32_t)
90 * cur_mix_job_.buf_frames 90 * cur_mix_job_.buf_frames
91 * output_formatter_->channels(); 91 * output_formatter_->channels();
92 ::memset(mix_buf_.get(), 0, bytes_to_zero); 92 ::memset(mix_buf_.get(), 0, bytes_to_zero);
93 93
94 // Mix each track into the intermediate buffer, then clip/format into the 94 // Mix each track into the intermediate buffer, then clip/format into the
95 // final buffer. 95 // final buffer.
96 ForeachTrack(setup_mix_, process_mix_); 96 ForeachTrack(setup_mix_, process_mix_);
97 output_formatter_->ProduceOutput(mix_buf_.get(), 97 output_formatter_->ProduceOutput(mix_buf_.get(),
98 cur_mix_job_.buf, 98 cur_mix_job_.buf,
99 cur_mix_job_.buf_frames); 99 cur_mix_job_.buf_frames);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 step_size = static_cast<uint32_t>(tmp_step_size); 538 step_size = static_cast<uint32_t>(tmp_step_size);
539 } 539 }
540 540
541 // Done, update our generation. 541 // Done, update our generation.
542 out_frames_to_track_frames_gen = job.local_to_output_gen; 542 out_frames_to_track_frames_gen = job.local_to_output_gen;
543 } 543 }
544 544
545 } // namespace audio 545 } // namespace audio
546 } // namespace media 546 } // namespace media
547 } // namespace mojo 547 } // namespace mojo
OLDNEW
« no previous file with comments | « services/media/audio/platform/generic/standard_output_base.h ('k') | services/media/audio/platform/linux/alsa_output.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698