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

Side by Side Diff: examples/audio_play_test/play_tone.cc

Issue 1902183002: Motown: Change media type (stream type) representation (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changes per review feedback. 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 | « no previous file | examples/audio_play_test/play_wav.cc » ('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 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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | examples/audio_play_test/play_wav.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698