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

Unified Diff: media/cast/audio_sender/audio_encoder.cc

Issue 132783002: Fix for AudioEncoder crash when using cast.streaming API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/audio_sender/audio_encoder.cc
diff --git a/media/cast/audio_sender/audio_encoder.cc b/media/cast/audio_sender/audio_encoder.cc
index c71329a52e5e075190590faec9a45268cd500c27..bc778d099aef14c5052a7eb3908b4f7bc4464a9b 100644
--- a/media/cast/audio_sender/audio_encoder.cc
+++ b/media/cast/audio_sender/audio_encoder.cc
@@ -59,7 +59,7 @@ class AudioEncoder::ImplBase {
const base::TimeTicks& recorded_time,
const base::Closure& done_callback) {
int src_pos = 0;
- while (src_pos < audio_bus->frames()) {
+ while (audio_bus && src_pos < audio_bus->frames()) {
const int num_samples_to_xfer =
std::min(samples_per_10ms_ - buffer_fill_end_,
audio_bus->frames() - src_pos);
@@ -72,7 +72,8 @@ class AudioEncoder::ImplBase {
if (src_pos == audio_bus->frames()) {
cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
done_callback);
- // Note: |audio_bus| is now invalid..
+ // Note: |audio_bus| is invalid once done_callback is invoked.
+ audio_bus = NULL;
}
if (buffer_fill_end_ == samples_per_10ms_) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698