| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) | 23 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) |
| 24 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) | 24 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) |
| 25 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) | 25 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) |
| 26 | 26 |
| 27 namespace webrtc { | 27 namespace webrtc { |
| 28 | 28 |
| 29 // AudioTrackJni::JavaAudioTrack implementation. | 29 // AudioTrackJni::JavaAudioTrack implementation. |
| 30 AudioTrackJni::JavaAudioTrack::JavaAudioTrack( | 30 AudioTrackJni::JavaAudioTrack::JavaAudioTrack( |
| 31 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_track) | 31 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_track) |
| 32 : audio_track_(audio_track.Pass()), | 32 : audio_track_(audio_track.Pass()), |
| 33 init_playout_(native_reg->GetMethodId("InitPlayout", "(II)V")), | 33 init_playout_(native_reg->GetMethodId("initPlayout", "(II)V")), |
| 34 start_playout_(native_reg->GetMethodId("StartPlayout", "()Z")), | 34 start_playout_(native_reg->GetMethodId("startPlayout", "()Z")), |
| 35 stop_playout_(native_reg->GetMethodId("StopPlayout", "()Z")), | 35 stop_playout_(native_reg->GetMethodId("stopPlayout", "()Z")), |
| 36 set_stream_volume_(native_reg->GetMethodId("SetStreamVolume", "(I)Z")), | 36 set_stream_volume_(native_reg->GetMethodId("setStreamVolume", "(I)Z")), |
| 37 get_stream_max_volume_(native_reg->GetMethodId( | 37 get_stream_max_volume_(native_reg->GetMethodId( |
| 38 "GetStreamMaxVolume", "()I")), | 38 "getStreamMaxVolume", "()I")), |
| 39 get_stream_volume_(native_reg->GetMethodId("GetStreamVolume", "()I")) { | 39 get_stream_volume_(native_reg->GetMethodId("getStreamVolume", "()I")) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 AudioTrackJni::JavaAudioTrack::~JavaAudioTrack() {} | 42 AudioTrackJni::JavaAudioTrack::~JavaAudioTrack() {} |
| 43 | 43 |
| 44 void AudioTrackJni::JavaAudioTrack::InitPlayout(int sample_rate, int channels) { | 44 void AudioTrackJni::JavaAudioTrack::InitPlayout(int sample_rate, int channels) { |
| 45 audio_track_->CallVoidMethod(init_playout_, sample_rate, channels); | 45 audio_track_->CallVoidMethod(init_playout_, sample_rate, channels); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool AudioTrackJni::JavaAudioTrack::StartPlayout() { | 48 bool AudioTrackJni::JavaAudioTrack::StartPlayout() { |
| 49 return audio_track_->CallBooleanMethod(start_playout_); | 49 return audio_track_->CallBooleanMethod(start_playout_); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 RTC_DCHECK_EQ(static_cast<size_t>(samples), frames_per_buffer_); | 249 RTC_DCHECK_EQ(static_cast<size_t>(samples), frames_per_buffer_); |
| 250 // Copy decoded data into common byte buffer to ensure that it can be | 250 // Copy decoded data into common byte buffer to ensure that it can be |
| 251 // written to the Java based audio track. | 251 // written to the Java based audio track. |
| 252 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_); | 252 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_); |
| 253 RTC_DCHECK_EQ(length, kBytesPerFrame * samples); | 253 RTC_DCHECK_EQ(length, kBytesPerFrame * samples); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace webrtc | 256 } // namespace webrtc |
| OLD | NEW |