OLD | NEW |
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 Loading... |
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. See: crbug.com/737047 | |
59 const size_t kFIFOSize = 8192; | 53 const size_t kFIFOSize = 8192; |
60 | 54 |
61 std::unique_ptr<AudioDestination> AudioDestination::Create( | 55 std::unique_ptr<AudioDestination> AudioDestination::Create( |
62 AudioIOCallback& callback, | 56 AudioIOCallback& callback, |
63 unsigned number_of_output_channels, | 57 unsigned number_of_output_channels, |
64 const WebAudioLatencyHint& latency_hint, | 58 const WebAudioLatencyHint& latency_hint, |
65 RefPtr<SecurityOrigin> security_origin) { | 59 RefPtr<SecurityOrigin> security_origin) { |
66 return WTF::WrapUnique( | 60 return WTF::WrapUnique( |
67 new AudioDestination(callback, number_of_output_channels, latency_hint, | 61 new AudioDestination(callback, number_of_output_channels, latency_hint, |
68 std::move(security_origin))); | 62 std::move(security_origin))); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 DCHECK(is_buffer_size_valid); | 253 DCHECK(is_buffer_size_valid); |
260 return is_buffer_size_valid; | 254 return is_buffer_size_valid; |
261 } | 255 } |
262 | 256 |
263 bool AudioDestination::IsRenderingThread() { | 257 bool AudioDestination::IsRenderingThread() { |
264 return static_cast<ThreadIdentifier>(rendering_thread_->ThreadId()) == | 258 return static_cast<ThreadIdentifier>(rendering_thread_->ThreadId()) == |
265 CurrentThread(); | 259 CurrentThread(); |
266 } | 260 } |
267 | 261 |
268 } // namespace blink | 262 } // namespace blink |
OLD | NEW |