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

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

Issue 9691001: Audio software mixer. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_track_output_android.h" 5 #include "media/audio/android/audio_track_output_android.h"
6 6
7 #include <algorithm>
8
7 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 12 #include "base/time.h"
11 13
12 using base::android::AttachCurrentThread; 14 using base::android::AttachCurrentThread;
13 using base::android::CheckException; 15 using base::android::CheckException;
14 16
15 static const int kTimerIntervalInMilliseconds = 50; 17 static const int kTimerIntervalInMilliseconds = 50;
16 18
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 68 }
67 69
68 void AudioTrackOutputStream::StreamBuffer::AdvancePosition(uint32 advance) { 70 void AudioTrackOutputStream::StreamBuffer::AdvancePosition(uint32 advance) {
69 current_ += advance; 71 current_ += advance;
70 CHECK(current_ <= data_size_); 72 CHECK(current_ <= data_size_);
71 } 73 }
72 74
73 AudioTrackOutputStream::AudioTrackOutputStream(const AudioParameters& params) 75 AudioTrackOutputStream::AudioTrackOutputStream(const AudioParameters& params)
74 : source_callback_(NULL), 76 : source_callback_(NULL),
75 params_(params.format, 77 params_(params.format,
78 params.use_browser_mixer(),
76 params.sample_rate, 79 params.sample_rate,
77 params.bits_per_sample, 80 params.bits_per_sample,
78 params.samples_per_packet, 81 params.samples_per_packet,
79 params.channels), 82 params.channels),
80 status_(IDLE), 83 status_(IDLE),
81 volume_(0), 84 volume_(0),
82 buffer_size_(0), 85 buffer_size_(0),
83 j_class_(NULL), 86 j_class_(NULL),
84 j_audio_track_(NULL) { 87 j_audio_track_(NULL) {
85 data_buffer_.reset( 88 data_buffer_.reset(
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 reinterpret_cast<const jbyte*>(data_buffer_->ReadBuffer())); 305 reinterpret_cast<const jbyte*>(data_buffer_->ReadBuffer()));
303 data_buffer_->AdvancePosition(need_buffer); 306 data_buffer_->AdvancePosition(need_buffer);
304 307
305 // Invoke method to submit samples. 308 // Invoke method to submit samples.
306 method = env->GetMethodID(j_class_, "write", "([BII)I"); 309 method = env->GetMethodID(j_class_, "write", "([BII)I");
307 env->CallIntMethod(j_audio_track_, method, buf, static_cast<jint>(0), 310 env->CallIntMethod(j_audio_track_, method, buf, static_cast<jint>(0),
308 static_cast<jint>(need_buffer)); 311 static_cast<jint>(need_buffer));
309 CheckException(env); 312 CheckException(env);
310 env->DeleteLocalRef(buf); 313 env->DeleteLocalRef(buf);
311 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698