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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioDestination.cpp

Issue 2908073002: Make OS audio buffer size limits visible. (Closed)
Patch Set: Updates based on reviewer feedback. Created 3 years, 6 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "public/platform/WebThread.h" 43 #include "public/platform/WebThread.h"
44 44
45 namespace blink { 45 namespace blink {
46 46
47 // FIFO Size. 47 // FIFO Size.
48 // 48 //
49 // TODO(hongchan): This was estimated based on the largest callback buffer size 49 // TODO(hongchan): This was estimated based on the largest callback buffer size
50 // that we would ever need. The current UMA stats indicates that this is, in 50 // that we would ever need. The current UMA stats indicates that this is, in
51 // fact, probably too small. There are Android devices out there with a size of 51 // fact, probably too small. There are Android devices out there with a size of
52 // 8000 or so. We might need to make this larger. See: crbug.com/670747 52 // 8000 or so. We might need to make this larger. See: crbug.com/670747
53 // TODO(andrew.macpherson): This either needs to be bigger since some OSes allow
54 // buffer sizes of 8192 via latencyHint now or else we need to do some
55 // validation of the latencyHint 'exact' size before passing it to
56 // CreateAudioDevice. Clamping may be tricky though as the buffer size is
57 // dependent on the sample rate for some platforms and we're passing in a time
58 // value and not a buffer size in the latencyHint.
hongchan 2017/06/15 16:22:03 Could you file a bug and add the URL in your comme
Andrew MacPherson 2017/06/19 12:36:18 No problem, I'll take care of this when I push the
53 const size_t kFIFOSize = 8192; 59 const size_t kFIFOSize = 8192;
o1ka 2017/06/15 15:33:37 Should we set it to limits::kMaxAudioBufferSize? O
Andrew MacPherson 2017/06/19 12:36:18 It would need to be kMaxAudioBufferSize + AudioUti
54 60
55 std::unique_ptr<AudioDestination> AudioDestination::Create( 61 std::unique_ptr<AudioDestination> AudioDestination::Create(
56 AudioIOCallback& callback, 62 AudioIOCallback& callback,
57 unsigned number_of_output_channels, 63 unsigned number_of_output_channels,
58 const WebAudioLatencyHint& latency_hint, 64 const WebAudioLatencyHint& latency_hint,
59 PassRefPtr<SecurityOrigin> security_origin) { 65 PassRefPtr<SecurityOrigin> security_origin) {
60 return WTF::WrapUnique( 66 return WTF::WrapUnique(
61 new AudioDestination(callback, number_of_output_channels, latency_hint, 67 new AudioDestination(callback, number_of_output_channels, latency_hint,
62 std::move(security_origin))); 68 std::move(security_origin)));
63 } 69 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 DCHECK(is_buffer_size_valid); 259 DCHECK(is_buffer_size_valid);
254 return is_buffer_size_valid; 260 return is_buffer_size_valid;
255 } 261 }
256 262
257 bool AudioDestination::IsRenderingThread() { 263 bool AudioDestination::IsRenderingThread() {
258 return static_cast<ThreadIdentifier>(rendering_thread_->ThreadId()) == 264 return static_cast<ThreadIdentifier>(rendering_thread_->ThreadId()) ==
259 CurrentThread(); 265 CurrentThread();
260 } 266 }
261 267
262 } // namespace blink 268 } // namespace blink
OLDNEW
« media/base/audio_latency.cc ('K') | « media/base/mac/audio_util_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698