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

Side by Side Diff: media/audio/android/audio_manager_android.cc

Issue 2466463005: Support (E)AC3 passthrough
Patch Set: Add unit tests Created 3 years, 6 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 #include "media/audio/android/audio_manager_android.h" 5 #include "media/audio/android/audio_manager_android.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "jni/AudioManagerAndroid_jni.h" 16 #include "jni/AudioManagerAndroid_jni.h"
17 #include "media/audio/android/audio_record_input.h" 17 #include "media/audio/android/audio_record_input.h"
18 #include "media/audio/android/audio_track_output_stream.h"
18 #include "media/audio/android/opensles_input.h" 19 #include "media/audio/android/opensles_input.h"
19 #include "media/audio/android/opensles_output.h" 20 #include "media/audio/android/opensles_output.h"
20 #include "media/audio/audio_device_description.h" 21 #include "media/audio/audio_device_description.h"
21 #include "media/audio/audio_manager.h" 22 #include "media/audio/audio_manager.h"
22 #include "media/audio/fake_audio_input_stream.h" 23 #include "media/audio/fake_audio_input_stream.h"
23 #include "media/base/audio_parameters.h" 24 #include "media/base/audio_parameters.h"
24 #include "media/base/channel_layout.h" 25 #include "media/base/channel_layout.h"
25 26
26 using base::android::AppendJavaStringArrayToStringVector; 27 using base::android::AppendJavaStringArrayToStringVector;
27 using base::android::AttachCurrentThread; 28 using base::android::AttachCurrentThread;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // the Android audio manager. 233 // the Android audio manager.
233 const SLint32 stream_type = communication_mode_is_on_ ? 234 const SLint32 stream_type = communication_mode_is_on_ ?
234 SL_ANDROID_STREAM_VOICE : SL_ANDROID_STREAM_MEDIA; 235 SL_ANDROID_STREAM_VOICE : SL_ANDROID_STREAM_MEDIA;
235 return new OpenSLESOutputStream(this, params, stream_type); 236 return new OpenSLESOutputStream(this, params, stream_type);
236 } 237 }
237 238
238 AudioOutputStream* AudioManagerAndroid::MakeBitstreamOutputStream( 239 AudioOutputStream* AudioManagerAndroid::MakeBitstreamOutputStream(
239 const AudioParameters& params, 240 const AudioParameters& params,
240 const std::string& device_id, 241 const std::string& device_id,
241 const LogCallback& log_callback) { 242 const LogCallback& log_callback) {
242 // TODO(tsunghung): add output stream for audio bitstream formats. 243 DCHECK(params.IsBitstreamFormat());
243 NOTREACHED(); 244 return new AudioTrackOutputStream(this, params);
244 return nullptr;
245 } 245 }
246 246
247 AudioInputStream* AudioManagerAndroid::MakeLinearInputStream( 247 AudioInputStream* AudioManagerAndroid::MakeLinearInputStream(
248 const AudioParameters& params, 248 const AudioParameters& params,
249 const std::string& device_id, 249 const std::string& device_id,
250 const LogCallback& log_callback) { 250 const LogCallback& log_callback) {
251 // TODO(henrika): add support for device selection if/when any client 251 // TODO(henrika): add support for device selection if/when any client
252 // needs it. 252 // needs it.
253 DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!"; 253 DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
254 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 254 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 output_volume_override_ = volume; 430 output_volume_override_ = volume;
431 431
432 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 432 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
433 for (OutputStreams::iterator it = streams_.begin(); 433 for (OutputStreams::iterator it = streams_.begin();
434 it != streams_.end(); ++it) { 434 it != streams_.end(); ++it) {
435 (*it)->SetVolume(volume); 435 (*it)->SetVolume(volume);
436 } 436 }
437 } 437 }
438 438
439 } // namespace media 439 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698