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

Side by Side Diff: media/audio/audio_low_latency_input_output_unittest.cc

Issue 1911913002: Convert //media/audio from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 | « media/audio/audio_logging.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory>
9
8 #include "base/environment.h" 10 #include "base/environment.h"
9 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
14 #include "base/test/test_timeouts.h" 15 #include "base/test/test_timeouts.h"
15 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "media/audio/audio_io.h" 19 #include "media/audio/audio_io.h"
19 #include "media/audio/audio_manager_base.h" 20 #include "media/audio/audio_manager_base.h"
20 #include "media/audio/audio_unittest_util.h" 21 #include "media/audio/audio_unittest_util.h"
21 #include "media/audio/fake_audio_log_factory.h" 22 #include "media/audio/fake_audio_log_factory.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 protected: 255 protected:
255 // Converts from bytes to milliseconds taking the sample rate and size 256 // Converts from bytes to milliseconds taking the sample rate and size
256 // of an audio frame into account. 257 // of an audio frame into account.
257 int BytesToMilliseconds(uint32_t delay_bytes) const { 258 int BytesToMilliseconds(uint32_t delay_bytes) const {
258 return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5); 259 return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5);
259 } 260 }
260 261
261 private: 262 private:
262 base::Lock lock_; 263 base::Lock lock_;
263 scoped_ptr<media::SeekableBuffer> buffer_; 264 std::unique_ptr<media::SeekableBuffer> buffer_;
264 int sample_rate_; 265 int sample_rate_;
265 int samples_per_packet_; 266 int samples_per_packet_;
266 int channels_; 267 int channels_;
267 int frame_size_; 268 int frame_size_;
268 double frames_to_ms_; 269 double frames_to_ms_;
269 scoped_ptr<AudioDelayState[]> delay_states_; 270 std::unique_ptr<AudioDelayState[]> delay_states_;
270 size_t input_elements_to_write_; 271 size_t input_elements_to_write_;
271 size_t output_elements_to_write_; 272 size_t output_elements_to_write_;
272 base::TimeTicks previous_write_time_; 273 base::TimeTicks previous_write_time_;
273 }; 274 };
274 275
275 class AudioInputStreamTraits { 276 class AudioInputStreamTraits {
276 public: 277 public:
277 typedef AudioInputStream StreamType; 278 typedef AudioInputStream StreamType;
278 279
279 static AudioParameters GetDefaultAudioStreamParameters( 280 static AudioParameters GetDefaultAudioStreamParameters(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 434
434 // All Close() operations that run on the mocked audio thread, 435 // All Close() operations that run on the mocked audio thread,
435 // should be synchronous and not post additional close tasks to 436 // should be synchronous and not post additional close tasks to
436 // mocked the audio thread. Hence, there is no need to call 437 // mocked the audio thread. Hence, there is no need to call
437 // message_loop()->RunUntilIdle() after the Close() methods. 438 // message_loop()->RunUntilIdle() after the Close() methods.
438 aos->Close(); 439 aos->Close();
439 ais->Close(); 440 ais->Close();
440 } 441 }
441 442
442 } // namespace media 443 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_logging.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698