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

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

Issue 2689483006: Switch browser side audio capture path to use base time primitives. (Closed)
Patch Set: Bloop Created 3 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_record_input.h" 5 #include "media/audio/android/audio_record_input.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "jni/AudioRecordInput_jni.h" 8 #include "jni/AudioRecordInput_jni.h"
9 #include "media/audio/android/audio_manager_android.h" 9 #include "media/audio/android/audio_manager_android.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 // static 51 // static
52 bool AudioRecordInputStream::RegisterAudioRecordInput(JNIEnv* env) { 52 bool AudioRecordInputStream::RegisterAudioRecordInput(JNIEnv* env) {
53 return RegisterNativesImpl(env); 53 return RegisterNativesImpl(env);
54 } 54 }
55 55
56 void AudioRecordInputStream::OnData(JNIEnv* env, 56 void AudioRecordInputStream::OnData(JNIEnv* env,
57 const JavaParamRef<jobject>& obj, 57 const JavaParamRef<jobject>& obj,
58 jint size, 58 jint size,
59 jint hardware_delay_bytes) { 59 jint hardware_delay_ms) {
60 DCHECK(direct_buffer_address_); 60 DCHECK(direct_buffer_address_);
61 DCHECK_EQ(size, 61 DCHECK_EQ(size,
62 audio_bus_->frames() * audio_bus_->channels() * bytes_per_sample_); 62 audio_bus_->frames() * audio_bus_->channels() * bytes_per_sample_);
63 // Passing zero as the volume parameter indicates there is no access to a 63 // Passing zero as the volume parameter indicates there is no access to a
64 // hardware volume slider. 64 // hardware volume slider.
65 audio_bus_->FromInterleaved( 65 audio_bus_->FromInterleaved(direct_buffer_address_, audio_bus_->frames(),
66 direct_buffer_address_, audio_bus_->frames(), bytes_per_sample_); 66 bytes_per_sample_);
67 callback_->OnData(this, audio_bus_.get(), hardware_delay_bytes, 0.0); 67 callback_->OnData(this, audio_bus_.get(),
68 base::TimeDelta::FromMilliseconds(hardware_delay_ms),
69 base::TimeTicks::Now(), 0.0);
68 } 70 }
69 71
70 bool AudioRecordInputStream::Open() { 72 bool AudioRecordInputStream::Open() {
71 DVLOG(2) << __PRETTY_FUNCTION__; 73 DVLOG(2) << __PRETTY_FUNCTION__;
72 DCHECK(thread_checker_.CalledOnValidThread()); 74 DCHECK(thread_checker_.CalledOnValidThread());
73 return Java_AudioRecordInput_open(base::android::AttachCurrentThread(), 75 return Java_AudioRecordInput_open(base::android::AttachCurrentThread(),
74 j_audio_record_); 76 j_audio_record_);
75 } 77 }
76 78
77 void AudioRecordInputStream::Start(AudioInputCallback* callback) { 79 void AudioRecordInputStream::Start(AudioInputCallback* callback) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 NOTIMPLEMENTED(); 142 NOTIMPLEMENTED();
141 return false; 143 return false;
142 } 144 }
143 145
144 bool AudioRecordInputStream::IsMuted() { 146 bool AudioRecordInputStream::IsMuted() {
145 NOTIMPLEMENTED(); 147 NOTIMPLEMENTED();
146 return false; 148 return false;
147 } 149 }
148 150
149 } // namespace media 151 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698