Commit 55566630 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Fix empty closure crash in AudioStreamConsumer::ProcessAudioPacket

WebRTCAudioSinkAdapter passes an empty done closure to AudioStreamConsumer.
Different from a DoNothing closure, calling an empty closure will end up
crashing the app. This CL fixes AudioStreamConsumer so that it only runs
the done closure if it is not null.

Bug: 748710
Change-Id: Ied6301b54e694f8d62618e7ed4e16fa2811a4202
Reviewed-on: https://chromium-review.googlesource.com/765010Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515771}
parent 63fb79e4
...@@ -10,7 +10,9 @@ void AudioStreamConsumer::ProcessAudioPacket( ...@@ -10,7 +10,9 @@ void AudioStreamConsumer::ProcessAudioPacket(
std::unique_ptr<AudioPacket> packet, std::unique_ptr<AudioPacket> packet,
const base::Closure& done) { const base::Closure& done) {
AddAudioPacket(std::move(packet)); AddAudioPacket(std::move(packet));
done.Run(); if (done) {
done.Run();
}
} }
} // namespace remoting } // namespace remoting
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