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

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

Issue 2097953002: Motown: Rename MediaProducer/Consumer to MediaPacketProducer/Consumer (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixed #ifndef guards Created 4 years, 5 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_impl_base.h" 9 #include "mojo/public/cpp/application/application_impl_base.h"
10 #include "mojo/public/cpp/application/connect.h" 10 #include "mojo/public/cpp/application/connect.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 pcm_cfg->channels = 1; 134 pcm_cfg->channels = 1;
135 pcm_cfg->frames_per_second = SAMP_FREQ; 135 pcm_cfg->frames_per_second = SAMP_FREQ;
136 136
137 MediaTypePtr media_type = MediaType::New(); 137 MediaTypePtr media_type = MediaType::New();
138 media_type->medium = MediaTypeMedium::AUDIO; 138 media_type->medium = MediaTypeMedium::AUDIO;
139 media_type->details = MediaTypeDetails::New(); 139 media_type->details = MediaTypeDetails::New();
140 media_type->details->set_audio(pcm_cfg.Pass()); 140 media_type->details->set_audio(pcm_cfg.Pass());
141 media_type->encoding = MediaType::kAudioEncodingLpcm; 141 media_type->encoding = MediaType::kAudioEncodingLpcm;
142 142
143 media_renderer_->SetMediaType(media_type.Pass()); 143 media_renderer_->SetMediaType(media_type.Pass());
144 MediaConsumerPtr pipe; 144 MediaPacketConsumerPtr pipe;
145 media_renderer_->GetConsumer(GetProxy(&pipe)); 145 media_renderer_->GetPacketConsumer(GetProxy(&pipe));
146 146
147 // Now that the configuration request is in-flight and we our media pipe 147 // Now that the configuration request is in-flight and we our media pipe
148 // proxy, pass its interface to our circular buffer helper, set up our 148 // proxy, pass its interface to our circular buffer helper, set up our
149 // high/low water marks, register our callback, and start to buffer our audio. 149 // high/low water marks, register our callback, and start to buffer our audio.
150 audio_pipe_.reset(new CircularBufferMediaPipeAdapter(pipe.Pass())); 150 audio_pipe_.reset(new CircularBufferMediaPipeAdapter(pipe.Pass()));
151 audio_pipe_->Init(USecToBytes(BUF_DEPTH_USEC)); 151 audio_pipe_->Init(USecToBytes(BUF_DEPTH_USEC));
152 audio_pipe_->SetSignalCallback( 152 audio_pipe_->SetSignalCallback(
153 [this](MediaResult res) -> void { 153 [this](MediaResult res) -> void {
154 GenerateToneCbk(res); 154 GenerateToneCbk(res);
155 }); 155 });
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 } // namespace examples 250 } // namespace examples
251 } // namespace audio 251 } // namespace audio
252 } // namespace media 252 } // namespace media
253 } // namespace mojo 253 } // namespace mojo
254 254
255 MojoResult MojoMain(MojoHandle app_request) { 255 MojoResult MojoMain(MojoHandle app_request) {
256 mojo::media::audio::examples::PlayToneApp play_tone_app; 256 mojo::media::audio::examples::PlayToneApp play_tone_app;
257 return mojo::RunApplication(app_request, &play_tone_app); 257 return mojo::RunApplication(app_request, &play_tone_app);
258 } 258 }
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