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

Side by Side Diff: media/audio/simple_sources.h

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: Fix cast + windows build 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
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 #ifndef MEDIA_AUDIO_SIMPLE_SOURCES_H_ 5 #ifndef MEDIA_AUDIO_SIMPLE_SOURCES_H_
6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_ 6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 uint32_t frames_skipped) override; 65 uint32_t frames_skipped) override;
66 void OnError(AudioOutputStream* stream) override; 66 void OnError(AudioOutputStream* stream) override;
67 67
68 private: 68 private:
69 AudioParameters params_; 69 AudioParameters params_;
70 base::FilePath path_to_wav_file_; 70 base::FilePath path_to_wav_file_;
71 71
72 // The WAV data at |path_to_wav_file_| is read into memory and kept here. 72 // The WAV data at |path_to_wav_file_| is read into memory and kept here.
73 // This memory needs to survive for the lifetime of |wav_audio_handler_|, 73 // This memory needs to survive for the lifetime of |wav_audio_handler_|,
74 // so declare it first. Do not access this member directly. 74 // so declare it first. Do not access this member directly.
75 scoped_ptr<char[]> raw_wav_data_; 75 std::unique_ptr<char[]> raw_wav_data_;
danakj 2016/04/22 22:47:37 include memory
dcheng 2016/04/22 23:13:20 Done.
76 76
77 scoped_ptr<WavAudioHandler> wav_audio_handler_; 77 std::unique_ptr<WavAudioHandler> wav_audio_handler_;
78 scoped_ptr<AudioConverter> file_audio_converter_; 78 std::unique_ptr<AudioConverter> file_audio_converter_;
79 int wav_file_read_pos_; 79 int wav_file_read_pos_;
80 bool load_failed_; 80 bool load_failed_;
81 81
82 // Provides audio data from wav_audio_handler_ into the file audio converter. 82 // Provides audio data from wav_audio_handler_ into the file audio converter.
83 double ProvideInput(AudioBus* audio_bus, 83 double ProvideInput(AudioBus* audio_bus,
84 base::TimeDelta buffer_delay) override; 84 base::TimeDelta buffer_delay) override;
85 85
86 // Loads the wav file on the first OnMoreData invocation. 86 // Loads the wav file on the first OnMoreData invocation.
87 void LoadWavFile(const base::FilePath& path_to_wav_file); 87 void LoadWavFile(const base::FilePath& path_to_wav_file);
88 }; 88 };
89 89
90 class BeepingSource : public AudioOutputStream::AudioSourceCallback { 90 class BeepingSource : public AudioOutputStream::AudioSourceCallback {
91 public: 91 public:
92 BeepingSource(const AudioParameters& params); 92 BeepingSource(const AudioParameters& params);
93 ~BeepingSource() override; 93 ~BeepingSource() override;
94 94
95 // Implementation of AudioSourceCallback. 95 // Implementation of AudioSourceCallback.
96 int OnMoreData(AudioBus* audio_bus, 96 int OnMoreData(AudioBus* audio_bus,
97 uint32_t total_bytes_delay, 97 uint32_t total_bytes_delay,
98 uint32_t frames_skipped) override; 98 uint32_t frames_skipped) override;
99 void OnError(AudioOutputStream* stream) override; 99 void OnError(AudioOutputStream* stream) override;
100 100
101 static void BeepOnce(); 101 static void BeepOnce();
102 private: 102 private:
103 int buffer_size_; 103 int buffer_size_;
104 scoped_ptr<uint8_t[]> buffer_; 104 std::unique_ptr<uint8_t[]> buffer_;
105 AudioParameters params_; 105 AudioParameters params_;
106 base::TimeTicks last_callback_time_; 106 base::TimeTicks last_callback_time_;
107 base::TimeDelta interval_from_last_beep_; 107 base::TimeDelta interval_from_last_beep_;
108 int beep_duration_in_buffers_; 108 int beep_duration_in_buffers_;
109 int beep_generated_in_buffers_; 109 int beep_generated_in_buffers_;
110 int beep_period_in_frames_; 110 int beep_period_in_frames_;
111 }; 111 };
112 112
113 } // namespace media 113 } // namespace media
114 114
115 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_ 115 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698