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

Unified Diff: media/base/audio_fifo.cc

Issue 337163004: Remove the atomic operations from media::AudioFifo, making it truly thread-unsafe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/audio_fifo.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_fifo.cc
diff --git a/media/base/audio_fifo.cc b/media/base/audio_fifo.cc
index b6e8f806e056ca5d2e58e22a7b677cb569c8ef8d..bdc7ddf78d0312b962c3fbc59ab13fcd25f8802a 100644
--- a/media/base/audio_fifo.cc
+++ b/media/base/audio_fifo.cc
@@ -6,9 +6,6 @@
#include "base/logging.h"
-using base::subtle::Atomic32;
-using base::subtle::NoBarrier_Store;
-
namespace media {
// Given current position in the FIFO, the maximum number of elements in the
@@ -52,7 +49,6 @@ AudioFifo::~AudioFifo() {}
int AudioFifo::frames() const {
int delta = frames_pushed_ - frames_consumed_;
- base::subtle::MemoryBarrier();
return delta;
}
@@ -83,12 +79,7 @@ void AudioFifo::Push(const AudioBus* source) {
}
}
- // Ensure the data is *really* written before updating |frames_pushed_|.
- base::subtle::MemoryBarrier();
-
- Atomic32 new_frames_pushed = frames_pushed_ + source_size;
- NoBarrier_Store(&frames_pushed_, new_frames_pushed);
-
+ frames_pushed_ += source_size;
DCHECK_LE(frames(), max_frames());
write_pos_ = UpdatePos(write_pos_, source_size, max_frames());
}
@@ -128,9 +119,7 @@ void AudioFifo::Consume(AudioBus* destination,
}
}
- Atomic32 new_frames_consumed = frames_consumed_ + frames_to_consume;
- NoBarrier_Store(&frames_consumed_, new_frames_consumed);
-
+ frames_consumed_ += frames_to_consume;
read_pos_ = UpdatePos(read_pos_, frames_to_consume, max_frames());
}
« no previous file with comments | « media/base/audio_fifo.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698