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

Side by Side Diff: webrtc/modules/audio_device/android/audio_track_jni.cc

Issue 1460043002: Don't call the Pass methods of rtc::Buffer, rtc::scoped_ptr, and rtc::ScopedVector (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Restore the Pass methods Created 5 years 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 /* 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
11 #include "webrtc/modules/audio_device/android/audio_manager.h" 11 #include "webrtc/modules/audio_device/android/audio_manager.h"
12 #include "webrtc/modules/audio_device/android/audio_track_jni.h" 12 #include "webrtc/modules/audio_device/android/audio_track_jni.h"
13 13
14 #include <utility>
15
14 #include <android/log.h> 16 #include <android/log.h>
15 17
16 #include "webrtc/base/arraysize.h" 18 #include "webrtc/base/arraysize.h"
17 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
18 #include "webrtc/base/format_macros.h" 20 #include "webrtc/base/format_macros.h"
19 21
20 #define TAG "AudioTrackJni" 22 #define TAG "AudioTrackJni"
21 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) 23 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
22 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) 24 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
23 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) 25 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
24 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) 26 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
25 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) 27 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
26 28
27 namespace webrtc { 29 namespace webrtc {
28 30
29 // AudioTrackJni::JavaAudioTrack implementation. 31 // AudioTrackJni::JavaAudioTrack implementation.
30 AudioTrackJni::JavaAudioTrack::JavaAudioTrack( 32 AudioTrackJni::JavaAudioTrack::JavaAudioTrack(
31 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_track) 33 NativeRegistration* native_reg,
32 : audio_track_(audio_track.Pass()), 34 rtc::scoped_ptr<GlobalRef> audio_track)
35 : audio_track_(std::move(audio_track)),
33 init_playout_(native_reg->GetMethodId("initPlayout", "(II)V")), 36 init_playout_(native_reg->GetMethodId("initPlayout", "(II)V")),
34 start_playout_(native_reg->GetMethodId("startPlayout", "()Z")), 37 start_playout_(native_reg->GetMethodId("startPlayout", "()Z")),
35 stop_playout_(native_reg->GetMethodId("stopPlayout", "()Z")), 38 stop_playout_(native_reg->GetMethodId("stopPlayout", "()Z")),
36 set_stream_volume_(native_reg->GetMethodId("setStreamVolume", "(I)Z")), 39 set_stream_volume_(native_reg->GetMethodId("setStreamVolume", "(I)Z")),
37 get_stream_max_volume_(native_reg->GetMethodId( 40 get_stream_max_volume_(
38 "getStreamMaxVolume", "()I")), 41 native_reg->GetMethodId("getStreamMaxVolume", "()I")),
39 get_stream_volume_(native_reg->GetMethodId("getStreamVolume", "()I")) { 42 get_stream_volume_(native_reg->GetMethodId("getStreamVolume", "()I")) {}
40 }
41 43
42 AudioTrackJni::JavaAudioTrack::~JavaAudioTrack() {} 44 AudioTrackJni::JavaAudioTrack::~JavaAudioTrack() {}
43 45
44 void AudioTrackJni::JavaAudioTrack::InitPlayout(int sample_rate, int channels) { 46 void AudioTrackJni::JavaAudioTrack::InitPlayout(int sample_rate, int channels) {
45 audio_track_->CallVoidMethod(init_playout_, sample_rate, channels); 47 audio_track_->CallVoidMethod(init_playout_, sample_rate, channels);
46 } 48 }
47 49
48 bool AudioTrackJni::JavaAudioTrack::StartPlayout() { 50 bool AudioTrackJni::JavaAudioTrack::StartPlayout() {
49 return audio_track_->CallBooleanMethod(start_playout_); 51 return audio_track_->CallBooleanMethod(start_playout_);
50 } 52 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return; 251 return;
250 } 252 }
251 RTC_DCHECK_EQ(static_cast<size_t>(samples), frames_per_buffer_); 253 RTC_DCHECK_EQ(static_cast<size_t>(samples), frames_per_buffer_);
252 // Copy decoded data into common byte buffer to ensure that it can be 254 // Copy decoded data into common byte buffer to ensure that it can be
253 // written to the Java based audio track. 255 // written to the Java based audio track.
254 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_); 256 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_);
255 RTC_DCHECK_EQ(length, kBytesPerFrame * samples); 257 RTC_DCHECK_EQ(length, kBytesPerFrame * samples);
256 } 258 }
257 259
258 } // namespace webrtc 260 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/audio_record_jni.cc ('k') | webrtc/modules/audio_processing/test/audio_file_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698