OLD | NEW |
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 <math.h> | 5 #include <math.h> |
6 #include <memory> | 6 #include <memory> |
7 | 7 |
8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 // Grab the rate control interface for our audio renderer. | 116 // Grab the rate control interface for our audio renderer. |
117 audio_track_->GetRateControl(GetProxy(&rate_control_)); | 117 audio_track_->GetRateControl(GetProxy(&rate_control_)); |
118 rate_control_.set_connection_error_handler([this]() { | 118 rate_control_.set_connection_error_handler([this]() { |
119 OnConnectionError("rate_control"); | 119 OnConnectionError("rate_control"); |
120 }); | 120 }); |
121 | 121 |
122 // Configure our sink for 16-bit 48KHz mono. | 122 // Configure our sink for 16-bit 48KHz mono. |
123 AudioTrackConfigurationPtr cfg = AudioTrackConfiguration::New(); | 123 AudioTrackConfigurationPtr cfg = AudioTrackConfiguration::New(); |
124 | 124 |
125 LpcmMediaTypeDetailsPtr pcm_cfg = LpcmMediaTypeDetails::New(); | 125 AudioMediaTypeDetailsPtr pcm_cfg = AudioMediaTypeDetails::New(); |
126 pcm_cfg->sample_format = LpcmSampleFormat::SIGNED_16; | 126 pcm_cfg->sample_format = AudioSampleFormat::SIGNED_16; |
127 pcm_cfg->channels = 1; | 127 pcm_cfg->channels = 1; |
128 pcm_cfg->frames_per_second = SAMP_FREQ; | 128 pcm_cfg->frames_per_second = SAMP_FREQ; |
129 | 129 |
130 cfg->media_type = MediaType::New(); | 130 cfg->media_type = MediaType::New(); |
131 cfg->media_type->scheme = MediaTypeScheme::LPCM; | 131 cfg->media_type->medium = MediaTypeMedium::AUDIO; |
132 cfg->media_type->details = MediaTypeDetails::New(); | 132 cfg->media_type->details = MediaTypeDetails::New(); |
133 cfg->media_type->details->set_lpcm(pcm_cfg.Pass()); | 133 cfg->media_type->details->set_audio(pcm_cfg.Pass()); |
| 134 cfg->media_type->encoding = MediaType::kAudioEncodingLpcm; |
134 | 135 |
135 MediaConsumerPtr pipe; | 136 MediaConsumerPtr pipe; |
136 audio_track_->Configure(cfg.Pass(), GetProxy(&pipe)); | 137 audio_track_->Configure(cfg.Pass(), GetProxy(&pipe)); |
137 | 138 |
138 // Now that the configuration request is in-flight and we our media pipe | 139 // Now that the configuration request is in-flight and we our media pipe |
139 // proxy, pass its interface to our circular buffer helper, set up our | 140 // proxy, pass its interface to our circular buffer helper, set up our |
140 // high/low water marks, register our callback, and start to buffer our audio. | 141 // high/low water marks, register our callback, and start to buffer our audio. |
141 audio_pipe_.reset(new CircularBufferMediaPipeAdapter(pipe.Pass())); | 142 audio_pipe_.reset(new CircularBufferMediaPipeAdapter(pipe.Pass())); |
142 audio_pipe_->Init(USecToBytes(BUF_DEPTH_USEC)); | 143 audio_pipe_->Init(USecToBytes(BUF_DEPTH_USEC)); |
143 audio_pipe_->SetSignalCallback( | 144 audio_pipe_->SetSignalCallback( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } // namespace audio | 247 } // namespace audio |
247 } // namespace media | 248 } // namespace media |
248 } // namespace mojo | 249 } // namespace mojo |
249 | 250 |
250 MojoResult MojoMain(MojoHandle app_request) { | 251 MojoResult MojoMain(MojoHandle app_request) { |
251 mojo::ApplicationRunner runner( | 252 mojo::ApplicationRunner runner( |
252 std::unique_ptr<mojo::media::audio::examples::PlayToneApp>( | 253 std::unique_ptr<mojo::media::audio::examples::PlayToneApp>( |
253 new mojo::media::audio::examples::PlayToneApp())); | 254 new mojo::media::audio::examples::PlayToneApp())); |
254 return runner.Run(app_request); | 255 return runner.Run(app_request); |
255 } | 256 } |
OLD | NEW |