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

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

Issue 10184011: Remove unused parameter "stream" from all variants of OnMoreData(). (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
« no previous file with comments | « no previous file | media/audio/android/opensles_output.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_track_output_android.h" 5 #include "media/audio/android/audio_track_output_android.h"
6 6
7 #include <algorithm> // std::min
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 namespace media { 17 namespace media {
16 18
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 283
282 int need_buffer = static_cast<int>(buffer_size_ - position); 284 int need_buffer = static_cast<int>(buffer_size_ - position);
283 CHECK(need_buffer >= 0 && need_buffer <= buffer_size_); 285 CHECK(need_buffer >= 0 && need_buffer <= buffer_size_);
284 286
285 if (!need_buffer) 287 if (!need_buffer)
286 return; 288 return;
287 289
288 // Fill the internal buffer first. 290 // Fill the internal buffer first.
289 if (!data_buffer_->data_len()) { 291 if (!data_buffer_->data_len()) {
290 uint32 src_data_size = source_callback_->OnMoreData( 292 uint32 src_data_size = source_callback_->OnMoreData(
291 this,
292 data_buffer_->GetWritableBuffer(), 293 data_buffer_->GetWritableBuffer(),
293 data_buffer_->buffer_size(), 294 data_buffer_->buffer_size(),
294 AudioBuffersState()); 295 AudioBuffersState());
295 data_buffer_->ResetBuffer(src_data_size); 296 data_buffer_->ResetBuffer(src_data_size);
296 } 297 }
297 need_buffer = std::min(need_buffer, 298 need_buffer = std::min(need_buffer,
298 static_cast<int>(data_buffer_->data_len())); 299 static_cast<int>(data_buffer_->data_len()));
299 300
300 // Prepare a Java array that contains the samples. 301 // Prepare a Java array that contains the samples.
301 jbyteArray buf = env->NewByteArray(need_buffer); 302 jbyteArray buf = env->NewByteArray(need_buffer);
302 env->SetByteArrayRegion( 303 env->SetByteArrayRegion(
303 buf, 0, need_buffer, 304 buf, 0, need_buffer,
304 reinterpret_cast<const jbyte*>(data_buffer_->ReadBuffer())); 305 reinterpret_cast<const jbyte*>(data_buffer_->ReadBuffer()));
305 data_buffer_->AdvancePosition(need_buffer); 306 data_buffer_->AdvancePosition(need_buffer);
306 307
307 // Invoke method to submit samples. 308 // Invoke method to submit samples.
308 method = env->GetMethodID(j_class_, "write", "([BII)I"); 309 method = env->GetMethodID(j_class_, "write", "([BII)I");
309 env->CallIntMethod(j_audio_track_, method, buf, static_cast<jint>(0), 310 env->CallIntMethod(j_audio_track_, method, buf, static_cast<jint>(0),
310 static_cast<jint>(need_buffer)); 311 static_cast<jint>(need_buffer));
311 CheckException(env); 312 CheckException(env);
312 env->DeleteLocalRef(buf); 313 env->DeleteLocalRef(buf);
313 } 314 }
314 315
315 } // namespace media 316 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/audio/android/opensles_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698