| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
| 8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
| 9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
| 10 #include "mojo/public/cpp/application/application_runner.h" | 10 #include "mojo/public/cpp/application/application_runner.h" |
| 11 #include "mojo/public/cpp/application/connect.h" |
| 11 #include "mojo/public/cpp/system/data_pipe.h" | 12 #include "mojo/public/cpp/system/data_pipe.h" |
| 12 #include "mojo/public/cpp/system/wait.h" | 13 #include "mojo/public/cpp/system/wait.h" |
| 13 #include "mojo/public/cpp/utility/run_loop.h" | 14 #include "mojo/public/cpp/utility/run_loop.h" |
| 14 #include "mojo/services/media/audio/interfaces/audio_server.mojom.h" | 15 #include "mojo/services/media/audio/interfaces/audio_server.mojom.h" |
| 15 #include "mojo/services/media/audio/interfaces/audio_track.mojom.h" | 16 #include "mojo/services/media/audio/interfaces/audio_track.mojom.h" |
| 16 #include "mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.h" | 17 #include "mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.h" |
| 17 #include "mojo/services/media/common/cpp/linear_transform.h" | 18 #include "mojo/services/media/common/cpp/linear_transform.h" |
| 18 #include "mojo/services/media/common/cpp/local_time.h" | 19 #include "mojo/services/media/common/cpp/local_time.h" |
| 19 #include "mojo/services/network/interfaces/network_service.mojom.h" | 20 #include "mojo/services/network/interfaces/network_service.mojom.h" |
| 20 #include "mojo/services/network/interfaces/url_loader.mojom.h" | 21 #include "mojo/services/network/interfaces/url_loader.mojom.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 const std::set<uint16_t> PlayWAVApp::VALID_FRAME_RATES({ | 151 const std::set<uint16_t> PlayWAVApp::VALID_FRAME_RATES({ |
| 151 8000, 16000, 24000, 32000, 48000, | 152 8000, 16000, 24000, 32000, 48000, |
| 152 11025, 22050, 44100, | 153 11025, 22050, 44100, |
| 153 }); | 154 }); |
| 154 | 155 |
| 155 const std::set<uint16_t> PlayWAVApp::VALID_BITS_PER_SAMPLES({ | 156 const std::set<uint16_t> PlayWAVApp::VALID_BITS_PER_SAMPLES({ |
| 156 8, 16, | 157 8, 16, |
| 157 }); | 158 }); |
| 158 | 159 |
| 159 void PlayWAVApp::Initialize(ApplicationImpl* app) { | 160 void PlayWAVApp::Initialize(ApplicationImpl* app) { |
| 160 app->ConnectToServiceDeprecated("mojo:audio_server", &audio_server_); | 161 ConnectToService(app->shell(), "mojo:audio_server", GetProxy(&audio_server_)); |
| 161 audio_server_.set_connection_error_handler([this]() { | 162 audio_server_.set_connection_error_handler([this]() { |
| 162 OnConnectionError("audio_server"); | 163 OnConnectionError("audio_server"); |
| 163 }); | 164 }); |
| 164 | 165 |
| 165 app->ConnectToServiceDeprecated("mojo:network_service", &network_service_); | 166 ConnectToService(app->shell(), "mojo:network_service", |
| 167 GetProxy(&network_service_)); |
| 166 audio_server_.set_connection_error_handler([this]() { | 168 audio_server_.set_connection_error_handler([this]() { |
| 167 OnConnectionError("network_service"); | 169 OnConnectionError("network_service"); |
| 168 }); | 170 }); |
| 169 | 171 |
| 170 network_service_->CreateURLLoader(GetProxy(&url_loader_)); | 172 network_service_->CreateURLLoader(GetProxy(&url_loader_)); |
| 171 url_loader_.set_connection_error_handler([this]() { | 173 url_loader_.set_connection_error_handler([this]() { |
| 172 OnConnectionError("url_loader"); | 174 OnConnectionError("url_loader"); |
| 173 }); | 175 }); |
| 174 | 176 |
| 175 playout_complete_cbk_ = PacketCbk([this](MediaConsumer::SendResult res) { | 177 playout_complete_cbk_ = PacketCbk([this](MediaConsumer::SendResult res) { |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } // namespace audio | 553 } // namespace audio |
| 552 } // namespace media | 554 } // namespace media |
| 553 } // namespace mojo | 555 } // namespace mojo |
| 554 | 556 |
| 555 MojoResult MojoMain(MojoHandle app_request) { | 557 MojoResult MojoMain(MojoHandle app_request) { |
| 556 mojo::ApplicationRunner runner( | 558 mojo::ApplicationRunner runner( |
| 557 std::unique_ptr<mojo::media::audio::examples::PlayWAVApp>( | 559 std::unique_ptr<mojo::media::audio::examples::PlayWAVApp>( |
| 558 new mojo::media::audio::examples::PlayWAVApp())); | 560 new mojo::media::audio::examples::PlayWAVApp())); |
| 559 return runner.Run(app_request); | 561 return runner.Run(app_request); |
| 560 } | 562 } |
| OLD | NEW |