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

Unified Diff: media/audio/linux/audio_manager_linux.cc

Issue 7117001: Simplify AlsaPcmOutputStream and AudioManagerLinux. Code was thread-safe, but now (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 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/audio/linux/audio_manager_linux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/linux/audio_manager_linux.cc
===================================================================
--- media/audio/linux/audio_manager_linux.cc (revision 88131)
+++ media/audio/linux/audio_manager_linux.cc (working copy)
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/nix/xdg_util.h"
#include "base/process_util.h"
+#include "base/stl_util-inl.h"
#include "media/audio/audio_output_dispatcher.h"
#include "media/audio/fake_audio_input_stream.h"
#include "media/audio/fake_audio_output_stream.h"
@@ -107,9 +108,7 @@
AlsaPcmOutputStream* stream =
new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this,
GetMessageLoop());
-
- base::AutoLock l(lock_);
- active_streams_[stream] = scoped_refptr<AlsaPcmOutputStream>(stream);
+ active_streams_.insert(stream);
return stream;
}
@@ -153,7 +152,9 @@
// Free output dispatchers, closing all remaining open streams.
output_dispatchers_.clear();
- active_streams_.clear();
+ // Delete all the streams. Have to do it manually, we don't have ScopedSet<>,
+ // and we are not using ScopedVector<> because search there is slow.
+ STLDeleteElements(&active_streams_);
}
void AudioManagerLinux::Init() {
@@ -171,8 +172,8 @@
void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) {
if (stream) {
- base::AutoLock l(lock_);
active_streams_.erase(stream);
+ delete stream;
}
}
« no previous file with comments | « media/audio/linux/audio_manager_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698