Commit b000449a authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Do not use ConvertToBaseCallback needlessly in AudioDestination ctor

This method is needed when convert a CrossThreadFunction [1] to pass
it out of Blink. In this particular case, AudioDestination can pass
a CrossThreadFunction instance to blink::MediaMultiChannelResampler
without converting it back to base::RepeatingCallback.

BUG=None

R=jbroman@chromium.org

[1] third_party/blink/renderer/platform/wtf/functional.h

Change-Id: Ifc5d19049dd3e4b295dd6e88d72d2d5d99ee49b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599712
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657363}
parent da8cacf9
...@@ -109,9 +109,9 @@ AudioDestination::AudioDestination(AudioIOCallback& callback, ...@@ -109,9 +109,9 @@ AudioDestination::AudioDestination(AudioIOCallback& callback,
resampler_.reset(new MediaMultiChannelResampler( resampler_.reset(new MediaMultiChannelResampler(
MaxChannelCount(), scale_factor, audio_utilities::kRenderQuantumFrames, MaxChannelCount(), scale_factor, audio_utilities::kRenderQuantumFrames,
ConvertToBaseCallback(
CrossThreadBind(&AudioDestination::ProvideResamplerInput, CrossThreadBind(&AudioDestination::ProvideResamplerInput,
CrossThreadUnretained(this))))); CrossThreadUnretained(this))));
resampler_bus_ = resampler_bus_ =
media::AudioBus::CreateWrapper(render_bus_->NumberOfChannels()); media::AudioBus::CreateWrapper(render_bus_->NumberOfChannels());
for (unsigned int i = 0; i < render_bus_->NumberOfChannels(); ++i) { for (unsigned int i = 0; i < render_bus_->NumberOfChannels(); ++i) {
......
...@@ -15,8 +15,8 @@ MediaMultiChannelResampler::MediaMultiChannelResampler( ...@@ -15,8 +15,8 @@ MediaMultiChannelResampler::MediaMultiChannelResampler(
int channels, int channels,
double io_sample_rate_ratio, double io_sample_rate_ratio,
size_t request_frames, size_t request_frames,
const ReadCB& read_cb) ReadCB read_cb)
: read_cb_(read_cb) { : read_cb_(std::move(read_cb)) {
resampler_.reset(new media::MultiChannelResampler( resampler_.reset(new media::MultiChannelResampler(
channels, io_sample_rate_ratio, request_frames, channels, io_sample_rate_ratio, request_frames,
base::BindRepeating(&MediaMultiChannelResampler::ProvideResamplerInput, base::BindRepeating(&MediaMultiChannelResampler::ProvideResamplerInput,
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "media/base/multi_channel_resampler.h" #include "media/base/multi_channel_resampler.h"
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace media { namespace media {
class AudioBus; class AudioBus;
...@@ -29,7 +30,8 @@ class PLATFORM_EXPORT MediaMultiChannelResampler { ...@@ -29,7 +30,8 @@ class PLATFORM_EXPORT MediaMultiChannelResampler {
// to be completely filled with data upon return; zero padded if not enough // to be completely filled with data upon return; zero padded if not enough
// frames are available to satisfy the request. |frame_delay| is the number // frames are available to satisfy the request. |frame_delay| is the number
// of output frames already processed and can be used to estimate delay. // of output frames already processed and can be used to estimate delay.
typedef base::RepeatingCallback<void(int frame_delay, AudioBus* audio_bus)> typedef WTF::CrossThreadRepeatingFunction<void(int frame_delay,
AudioBus* audio_bus)>
ReadCB; ReadCB;
public: public:
...@@ -40,7 +42,7 @@ class PLATFORM_EXPORT MediaMultiChannelResampler { ...@@ -40,7 +42,7 @@ class PLATFORM_EXPORT MediaMultiChannelResampler {
MediaMultiChannelResampler(int channels, MediaMultiChannelResampler(int channels,
double io_sample_rate_ratio, double io_sample_rate_ratio,
size_t request_frames, size_t request_frames,
const ReadCB& read_cb); ReadCB read_cb);
// Resamples |frames| of data from |read_cb_| into AudioBus. // Resamples |frames| of data from |read_cb_| into AudioBus.
void Resample(int frames, media::AudioBus* audio_bus); void Resample(int frames, media::AudioBus* audio_bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment