diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/audio_input_controller.cc | 4 | ||||
-rw-r--r-- | media/audio/audio_input_controller.h | 4 | ||||
-rw-r--r-- | media/audio/audio_output_controller.cc | 10 | ||||
-rw-r--r-- | media/audio/audio_output_controller.h | 4 | ||||
-rw-r--r-- | media/audio/linux/alsa_output.cc | 16 | ||||
-rw-r--r-- | media/audio/linux/alsa_output.h | 4 | ||||
-rw-r--r-- | media/audio/linux/audio_manager_linux.cc | 4 | ||||
-rw-r--r-- | media/audio/linux/audio_manager_linux.h | 4 | ||||
-rw-r--r-- | media/base/message_loop_factory_impl.cc | 4 | ||||
-rw-r--r-- | media/base/message_loop_factory_impl.h | 2 | ||||
-rw-r--r-- | media/base/pipeline_impl.cc | 84 | ||||
-rw-r--r-- | media/base/pipeline_impl.h | 2 | ||||
-rw-r--r-- | media/filters/audio_renderer_base.cc | 14 | ||||
-rw-r--r-- | media/filters/audio_renderer_base.h | 4 | ||||
-rw-r--r-- | media/filters/ffmpeg_glue.cc | 14 | ||||
-rw-r--r-- | media/filters/ffmpeg_glue.h | 4 | ||||
-rw-r--r-- | media/filters/file_data_source.cc | 6 | ||||
-rw-r--r-- | media/filters/file_data_source.h | 4 | ||||
-rw-r--r-- | media/filters/video_renderer_base.cc | 30 |
19 files changed, 109 insertions, 109 deletions
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index 4f08c46..1e23f53 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -110,7 +110,7 @@ void AudioInputController::DoRecord() { return; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = kRecording; } @@ -143,7 +143,7 @@ void AudioInputController::DoReportError(int code) { void AudioInputController::OnData(AudioInputStream* stream, const uint8* data, uint32 size) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (state_ != kRecording) return; } diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h index 8afb3bd..581a90d 100644 --- a/media/audio/audio_input_controller.h +++ b/media/audio/audio_input_controller.h @@ -5,9 +5,9 @@ #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "media/audio/audio_io.h" #include "media/audio/audio_manager.h" @@ -121,7 +121,7 @@ class AudioInputController : // is not required for reading on the audio input controller thread. State state_; - Lock lock_; + base::Lock lock_; // The audio input controller thread that this object runs on. base::Thread thread_; diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc index 6ab8f3f..5347c50 100644 --- a/media/audio/audio_output_controller.cc +++ b/media/audio/audio_output_controller.cc @@ -129,7 +129,7 @@ void AudioOutputController::SetVolume(double volume) { void AudioOutputController::EnqueueData(const uint8* data, uint32 size) { // Write data to the push source and ask for more data if needed. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); pending_request_ = false; // If |size| is set to 0, it indicates that the audio source doesn't have // more data right now, and so it doesn't make sense to send additional @@ -178,7 +178,7 @@ void AudioOutputController::DoCreate(AudioParameters params) { // If in normal latency mode then start buffering. if (!LowLatencyMode()) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); SubmitOnMoreData_Locked(); } } @@ -228,7 +228,7 @@ void AudioOutputController::DoFlush() { if (!sync_reader_) { if (state_ != kPaused) return; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); buffer_.Clear(); } } @@ -281,7 +281,7 @@ uint32 AudioOutputController::OnMoreData( uint32 max_size, AudioBuffersState buffers_state) { // If regular latency mode is used. if (!sync_reader_) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Save current buffers state. buffers_state_ = buffers_state; @@ -326,7 +326,7 @@ void AudioOutputController::SubmitOnMoreData_Locked() { // If we need more data then call the event handler to ask for more data. // It is okay that we don't lock in this block because the parameters are // correct and in the worst case we are just asking more data than needed. - AutoUnlock auto_unlock(lock_); + base::AutoUnlock auto_unlock(lock_); handler_->OnMoreData(this, buffers_state); } diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h index 0a191e3..3778171 100644 --- a/media/audio/audio_output_controller.h +++ b/media/audio/audio_output_controller.h @@ -5,9 +5,9 @@ #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "media/audio/audio_buffers_state.h" #include "media/audio/audio_io.h" @@ -187,7 +187,7 @@ class AudioOutputController AudioBuffersState buffers_state_; // The |lock_| must be acquired whenever we access |buffer_|. - Lock lock_; + base::Lock lock_; media::SeekableBuffer buffer_; diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 6df30b4..338ff08 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -837,7 +837,7 @@ AlsaPcmOutputStream::SharedData::SharedData( } bool AlsaPcmOutputStream::SharedData::CanTransitionTo(InternalState to) { - AutoLock l(lock_); + base::AutoLock l(lock_); return CanTransitionTo_Locked(to); } @@ -874,7 +874,7 @@ AlsaPcmOutputStream::InternalState AlsaPcmOutputStream::SharedData::TransitionTo(InternalState to) { DCHECK_EQ(MessageLoop::current(), state_transition_loop_); - AutoLock l(lock_); + base::AutoLock l(lock_); if (!CanTransitionTo_Locked(to)) { NOTREACHED() << "Cannot transition from: " << state_ << " to: " << to; state_ = kInError; @@ -885,24 +885,24 @@ AlsaPcmOutputStream::SharedData::TransitionTo(InternalState to) { } AlsaPcmOutputStream::InternalState AlsaPcmOutputStream::SharedData::state() { - AutoLock l(lock_); + base::AutoLock l(lock_); return state_; } float AlsaPcmOutputStream::SharedData::volume() { - AutoLock l(lock_); + base::AutoLock l(lock_); return volume_; } void AlsaPcmOutputStream::SharedData::set_volume(float v) { - AutoLock l(lock_); + base::AutoLock l(lock_); volume_ = v; } uint32 AlsaPcmOutputStream::SharedData::OnMoreData( AudioOutputStream* stream, uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { - AutoLock l(lock_); + base::AutoLock l(lock_); if (source_callback_) { return source_callback_->OnMoreData(stream, dest, max_size, buffers_state); } @@ -912,7 +912,7 @@ uint32 AlsaPcmOutputStream::SharedData::OnMoreData( void AlsaPcmOutputStream::SharedData::OnError(AudioOutputStream* stream, int code) { - AutoLock l(lock_); + base::AutoLock l(lock_); if (source_callback_) { source_callback_->OnError(stream, code); } @@ -923,6 +923,6 @@ void AlsaPcmOutputStream::SharedData::OnError(AudioOutputStream* stream, void AlsaPcmOutputStream::SharedData::set_source_callback( AudioSourceCallback* callback) { DCHECK_EQ(MessageLoop::current(), state_transition_loop_); - AutoLock l(lock_); + base::AutoLock l(lock_); source_callback_ = callback; } diff --git a/media/audio/linux/alsa_output.h b/media/audio/linux/alsa_output.h index 25ff055..f2999c1 100644 --- a/media/audio/linux/alsa_output.h +++ b/media/audio/linux/alsa_output.h @@ -40,9 +40,9 @@ #include <string> #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "media/audio/audio_io.h" #include "media/audio/audio_parameters.h" @@ -193,7 +193,7 @@ class AlsaPcmOutputStream : void set_source_callback(AudioSourceCallback* callback); private: - Lock lock_; + base::Lock lock_; InternalState state_; float volume_; // Volume level from 0.0 to 1.0. diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc index c875c08..4c92a6f 100644 --- a/media/audio/linux/audio_manager_linux.cc +++ b/media/audio/linux/audio_manager_linux.cc @@ -62,7 +62,7 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream( new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this, GetMessageLoop()); - AutoLock l(lock_); + base::AutoLock l(lock_); active_streams_[stream] = scoped_refptr<AlsaPcmOutputStream>(stream); return stream; } @@ -125,7 +125,7 @@ void AudioManagerLinux::UnMuteAll() { void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) { if (stream) { - AutoLock l(lock_); + base::AutoLock l(lock_); active_streams_.erase(stream); } } diff --git a/media/audio/linux/audio_manager_linux.h b/media/audio/linux/audio_manager_linux.h index 4ae3b64..b657966 100644 --- a/media/audio/linux/audio_manager_linux.h +++ b/media/audio/linux/audio_manager_linux.h @@ -7,9 +7,9 @@ #include <map> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "media/audio/audio_manager_base.h" @@ -40,7 +40,7 @@ class AudioManagerLinux : public AudioManagerBase { private: scoped_ptr<AlsaWrapper> wrapper_; - Lock lock_; + base::Lock lock_; std::map<AlsaPcmOutputStream*, scoped_refptr<AlsaPcmOutputStream> > active_streams_; diff --git a/media/base/message_loop_factory_impl.cc b/media/base/message_loop_factory_impl.cc index bcf3bf8..ebe64a4 100644 --- a/media/base/message_loop_factory_impl.cc +++ b/media/base/message_loop_factory_impl.cc @@ -9,7 +9,7 @@ namespace media { MessageLoopFactoryImpl::MessageLoopFactoryImpl() {} MessageLoopFactoryImpl::~MessageLoopFactoryImpl() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (ThreadMap::iterator iter = thread_map_.begin(); iter != thread_map_.end(); @@ -30,7 +30,7 @@ MessageLoop* MessageLoopFactoryImpl::GetMessageLoop(const std::string& name) { return NULL; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); ThreadMap::iterator it = thread_map_.find(name); if (it != thread_map_.end()) diff --git a/media/base/message_loop_factory_impl.h b/media/base/message_loop_factory_impl.h index 1c8a61a..e7576ba 100644 --- a/media/base/message_loop_factory_impl.h +++ b/media/base/message_loop_factory_impl.h @@ -25,7 +25,7 @@ class MessageLoopFactoryImpl : public MessageLoopFactory { private: // Lock used to serialize access for the following data members. - Lock lock_; + base::Lock lock_; typedef std::map<std::string, base::Thread*> ThreadMap; ThreadMap thread_map_; diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index 022198c..d039664 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc @@ -35,7 +35,7 @@ PipelineImpl::PipelineImpl(MessageLoop* message_loop) } PipelineImpl::~PipelineImpl() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(!running_) << "Stop() must complete before destroying object"; DCHECK(!stop_pending_); DCHECK(!seek_pending_); @@ -55,7 +55,7 @@ void PipelineImpl::Init(PipelineCallback* ended_callback, bool PipelineImpl::Start(FilterCollection* collection, const std::string& url, PipelineCallback* start_callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); scoped_ptr<PipelineCallback> callback(start_callback); scoped_ptr<FilterCollection> filter_collection(collection); @@ -81,7 +81,7 @@ bool PipelineImpl::Start(FilterCollection* collection, } void PipelineImpl::Stop(PipelineCallback* stop_callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); scoped_ptr<PipelineCallback> callback(stop_callback); if (!running_) { VLOG(1) << "Media pipeline has already stopped"; @@ -95,7 +95,7 @@ void PipelineImpl::Stop(PipelineCallback* stop_callback) { void PipelineImpl::Seek(base::TimeDelta time, PipelineCallback* seek_callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); scoped_ptr<PipelineCallback> callback(seek_callback); if (!running_) { VLOG(1) << "Media pipeline must be running"; @@ -108,7 +108,7 @@ void PipelineImpl::Seek(base::TimeDelta time, } bool PipelineImpl::IsRunning() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return running_; } @@ -116,7 +116,7 @@ bool PipelineImpl::IsInitialized() const { // TODO(scherkus): perhaps replace this with a bool that is set/get under the // lock, because this is breaching the contract that |state_| is only accessed // on |message_loop_|. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); switch (state_) { case kPausing: case kFlushing: @@ -131,19 +131,19 @@ bool PipelineImpl::IsInitialized() const { } bool PipelineImpl::IsNetworkActive() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return network_activity_; } bool PipelineImpl::IsRendered(const std::string& major_mime_type) const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); bool is_rendered = (rendered_mime_types_.find(major_mime_type) != rendered_mime_types_.end()); return is_rendered; } float PipelineImpl::GetPlaybackRate() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return playback_rate_; } @@ -152,7 +152,7 @@ void PipelineImpl::SetPlaybackRate(float playback_rate) { return; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); playback_rate_ = playback_rate; if (running_) { message_loop_->PostTask(FROM_HERE, @@ -162,7 +162,7 @@ void PipelineImpl::SetPlaybackRate(float playback_rate) { } float PipelineImpl::GetVolume() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return volume_; } @@ -171,7 +171,7 @@ void PipelineImpl::SetVolume(float volume) { return; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); volume_ = volume; if (running_) { message_loop_->PostTask(FROM_HERE, @@ -184,7 +184,7 @@ base::TimeDelta PipelineImpl::GetCurrentTime() const { // TODO(scherkus): perhaps replace checking state_ == kEnded with a bool that // is set/get under the lock, because this is breaching the contract that // |state_| is only accessed on |message_loop_|. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return GetCurrentTime_Locked(); } @@ -197,7 +197,7 @@ base::TimeDelta PipelineImpl::GetCurrentTime_Locked() const { } base::TimeDelta PipelineImpl::GetBufferedTime() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // If media is fully loaded, then return duration. if (loaded_ || total_bytes_ == buffered_bytes_) { @@ -237,45 +237,45 @@ base::TimeDelta PipelineImpl::GetBufferedTime() { } base::TimeDelta PipelineImpl::GetMediaDuration() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return duration_; } int64 PipelineImpl::GetBufferedBytes() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return buffered_bytes_; } int64 PipelineImpl::GetTotalBytes() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return total_bytes_; } void PipelineImpl::GetVideoSize(size_t* width_out, size_t* height_out) const { CHECK(width_out); CHECK(height_out); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); *width_out = video_width_; *height_out = video_height_; } bool PipelineImpl::IsStreaming() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return streaming_; } bool PipelineImpl::IsLoaded() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return loaded_; } PipelineError PipelineImpl::GetError() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return error_; } void PipelineImpl::SetCurrentReadPosition(int64 offset) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // The current read position should never be ahead of the buffered byte // position but threading issues between BufferedDataSource::DoneRead_Locked() @@ -289,12 +289,12 @@ void PipelineImpl::SetCurrentReadPosition(int64 offset) { } int64 PipelineImpl::GetCurrentReadPosition() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return current_bytes_; } void PipelineImpl::ResetState() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); const base::TimeDelta kZero; running_ = false; stop_pending_ = false; @@ -411,7 +411,7 @@ base::TimeDelta PipelineImpl::GetDuration() const { void PipelineImpl::SetTime(base::TimeDelta time) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // If we were waiting for a valid timestamp and such timestamp arrives, we // need to clear the flag for waiting and start the clock. @@ -428,25 +428,25 @@ void PipelineImpl::SetTime(base::TimeDelta time) { void PipelineImpl::SetDuration(base::TimeDelta duration) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); duration_ = duration; } void PipelineImpl::SetBufferedTime(base::TimeDelta buffered_time) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); buffered_time_ = buffered_time; } void PipelineImpl::SetTotalBytes(int64 total_bytes) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); total_bytes_ = total_bytes; } void PipelineImpl::SetBufferedBytes(int64 buffered_bytes) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // See comments in SetCurrentReadPosition() about capping. if (buffered_bytes < current_bytes_) @@ -456,14 +456,14 @@ void PipelineImpl::SetBufferedBytes(int64 buffered_bytes) { void PipelineImpl::SetVideoSize(size_t width, size_t height) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); video_width_ = width; video_height_ = height; } void PipelineImpl::SetStreaming(bool streaming) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); streaming_ = streaming; } @@ -475,14 +475,14 @@ void PipelineImpl::NotifyEnded() { void PipelineImpl::SetLoaded(bool loaded) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); loaded_ = loaded; } void PipelineImpl::SetNetworkActivity(bool network_activity) { DCHECK(IsRunning()); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); network_activity_ = network_activity; } message_loop_->PostTask(FROM_HERE, @@ -499,13 +499,13 @@ void PipelineImpl::DisableAudioRenderer() { void PipelineImpl::InsertRenderedMimeType(const std::string& major_mime_type) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); rendered_mime_types_.insert(major_mime_type); } bool PipelineImpl::HasRenderedMimeTypes() const { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return !rendered_mime_types_.empty(); } @@ -682,7 +682,7 @@ void PipelineImpl::StopTask(PipelineCallback* stop_callback) { // going to error state and calling |error_callback_|. This converts // the teardown in progress from an error teardown into one that acts // like the error never occurred. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); error_ = PIPELINE_OK; error_caused_teardown_ = false; } @@ -709,7 +709,7 @@ void PipelineImpl::ErrorChangedTask(PipelineError error) { return; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); error_ = error; error_caused_teardown_ = true; @@ -719,7 +719,7 @@ void PipelineImpl::ErrorChangedTask(PipelineError error) { void PipelineImpl::PlaybackRateChangedTask(float playback_rate) { DCHECK_EQ(MessageLoop::current(), message_loop_); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); clock_->SetPlaybackRate(playback_rate); } @@ -770,7 +770,7 @@ void PipelineImpl::SeekTask(base::TimeDelta time, // Kick off seeking! { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // If we are waiting for a clock update, the clock hasn't been played yet. if (!waiting_for_clock_update_) clock_->Pause(); @@ -826,7 +826,7 @@ void PipelineImpl::DisableAudioRendererTask() { // |rendered_mime_types_| is read through public methods so we need to lock // this variable. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); rendered_mime_types_.erase(mime_type::kMajorTypeAudio); audio_disabled_ = true; @@ -857,7 +857,7 @@ void PipelineImpl::FilterStateTransitionTask() { // to the next state if needed. set_state(FindNextState(state_)); if (state_ == kSeeking) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); clock_->SetTime(seek_timestamp_); } @@ -888,7 +888,7 @@ void PipelineImpl::FilterStateTransitionTask() { seek_timestamp_ = base::TimeDelta(); seek_pending_ = false; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // We use audio stream to update the clock. So if there is such a stream, // we pause the clock until we receive a valid timestamp. waiting_for_clock_update_ = diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h index 09d4950..addd1ce 100644 --- a/media/base/pipeline_impl.h +++ b/media/base/pipeline_impl.h @@ -277,7 +277,7 @@ class PipelineImpl : public Pipeline, public FilterHost { MessageLoop* message_loop_; // Lock used to serialize access for the following data members. - mutable Lock lock_; + mutable base::Lock lock_; // Whether or not the pipeline is running. bool running_; diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc index d330521..9d7783f 100644 --- a/media/filters/audio_renderer_base.cc +++ b/media/filters/audio_renderer_base.cc @@ -28,7 +28,7 @@ AudioRendererBase::~AudioRendererBase() { } void AudioRendererBase::Play(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPaused, state_); scoped_ptr<FilterCallback> c(callback); state_ = kPlaying; @@ -36,7 +36,7 @@ void AudioRendererBase::Play(FilterCallback* callback) { } void AudioRendererBase::Pause(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPlaying, state_); pause_callback_.reset(callback); state_ = kPaused; @@ -53,7 +53,7 @@ void AudioRendererBase::Pause(FilterCallback* callback) { void AudioRendererBase::Stop(FilterCallback* callback) { OnStop(); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = kStopped; algorithm_.reset(NULL); } @@ -64,7 +64,7 @@ void AudioRendererBase::Stop(FilterCallback* callback) { } void AudioRendererBase::Seek(base::TimeDelta time, FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPaused, state_); DCHECK_EQ(0u, pending_reads_) << "Pending reads should have completed"; state_ = kSeeking; @@ -129,7 +129,7 @@ void AudioRendererBase::Initialize(AudioDecoder* decoder, } bool AudioRendererBase::HasEnded() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (rendered_end_of_stream_) { DCHECK(algorithm_->IsQueueEmpty()) << "Audio queue should be empty if we have rendered end of stream"; @@ -138,7 +138,7 @@ bool AudioRendererBase::HasEnded() { } void AudioRendererBase::ConsumeAudioSamples(scoped_refptr<Buffer> buffer_in) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ == kPaused || state_ == kSeeking || state_ == kPlaying); DCHECK_GT(pending_reads_, 0u); --pending_reads_; @@ -191,7 +191,7 @@ uint32 AudioRendererBase::FillBuffer(uint8* dest, base::TimeDelta last_fill_buffer_time; size_t dest_written = 0; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Mute audio by returning 0 when not playing. if (state_ != kPlaying) { diff --git a/media/filters/audio_renderer_base.h b/media/filters/audio_renderer_base.h index c0af81a..6c77acb 100644 --- a/media/filters/audio_renderer_base.h +++ b/media/filters/audio_renderer_base.h @@ -20,7 +20,7 @@ #include <deque> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "media/base/buffers.h" #include "media/base/filters.h" #include "media/filters/audio_renderer_algorithm_base.h" @@ -102,7 +102,7 @@ class AudioRendererBase : public AudioRenderer { // Algorithm for scaling audio. scoped_ptr<AudioRendererAlgorithmBase> algorithm_; - Lock lock_; + base::Lock lock_; // Simple state tracking variable. enum State { diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc index 663fff7..fede662 100644 --- a/media/filters/ffmpeg_glue.cc +++ b/media/filters/ffmpeg_glue.cc @@ -88,21 +88,21 @@ int CloseContext(URLContext* h) { int LockManagerOperation(void** lock, enum AVLockOp op) { switch (op) { case AV_LOCK_CREATE: - *lock = new Lock(); + *lock = new base::Lock(); if (!*lock) return 1; return 0; case AV_LOCK_OBTAIN: - static_cast<Lock*>(*lock)->Acquire(); + static_cast<base::Lock*>(*lock)->Acquire(); return 0; case AV_LOCK_RELEASE: - static_cast<Lock*>(*lock)->Release(); + static_cast<base::Lock*>(*lock)->Release(); return 0; case AV_LOCK_DESTROY: - delete static_cast<Lock*>(*lock); + delete static_cast<base::Lock*>(*lock); *lock = NULL; return 0; } @@ -151,7 +151,7 @@ FFmpegGlue* FFmpegGlue::GetInstance() { } std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); std::string key = GetProtocolKey(protocol); if (protocols_.find(key) == protocols_.end()) { protocols_[key] = protocol; @@ -160,7 +160,7 @@ std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { } void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (ProtocolMap::iterator cur, iter = protocols_.begin(); iter != protocols_.end();) { cur = iter; @@ -173,7 +173,7 @@ void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { void FFmpegGlue::GetProtocol(const std::string& key, FFmpegURLProtocol** protocol) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); ProtocolMap::iterator iter = protocols_.find(key); if (iter == protocols_.end()) { *protocol = NULL; diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h index 4f991d1..aa12670 100644 --- a/media/filters/ffmpeg_glue.h +++ b/media/filters/ffmpeg_glue.h @@ -29,8 +29,8 @@ #include <map> #include <string> -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" namespace media { @@ -93,7 +93,7 @@ class FFmpegGlue { std::string GetProtocolKey(FFmpegURLProtocol* protocol); // Mutual exclusion while adding/removing items from the map. - Lock lock_; + base::Lock lock_; // Map between keys and FFmpegProtocol references. typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; diff --git a/media/filters/file_data_source.cc b/media/filters/file_data_source.cc index 3fd1a04..64c61fb 100644 --- a/media/filters/file_data_source.cc +++ b/media/filters/file_data_source.cc @@ -50,7 +50,7 @@ void FileDataSource::Initialize(const std::string& url, } void FileDataSource::Stop(FilterCallback* callback) { - AutoLock l(lock_); + base::AutoLock l(lock_); if (file_) { file_util::CloseFile(file_); file_ = NULL; @@ -69,7 +69,7 @@ const MediaFormat& FileDataSource::media_format() { void FileDataSource::Read(int64 position, size_t size, uint8* data, ReadCallback* read_callback) { DCHECK(file_); - AutoLock l(lock_); + base::AutoLock l(lock_); scoped_ptr<ReadCallback> callback(read_callback); if (file_) { #if defined(OS_WIN) @@ -101,7 +101,7 @@ void FileDataSource::Read(int64 position, size_t size, uint8* data, bool FileDataSource::GetSize(int64* size_out) { DCHECK(size_out); DCHECK(file_); - AutoLock l(lock_); + base::AutoLock l(lock_); *size_out = file_size_; return (NULL != file_); } diff --git a/media/filters/file_data_source.h b/media/filters/file_data_source.h index f6aed76..7be9a5a 100644 --- a/media/filters/file_data_source.h +++ b/media/filters/file_data_source.h @@ -8,7 +8,7 @@ #include <string> #include "base/gtest_prod_util.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "media/base/filters.h" namespace media { @@ -54,7 +54,7 @@ class FileDataSource : public DataSource { // TODO(ralphl): Ideally this would use asynchronous I/O or we will know // that we will block for a short period of time in reads. Otherwise, we can // hang the pipeline Stop. - Lock lock_; + base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(FileDataSource); }; diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc index c870df5..410e18f 100644 --- a/media/filters/video_renderer_base.cc +++ b/media/filters/video_renderer_base.cc @@ -39,7 +39,7 @@ VideoRendererBase::VideoRendererBase() } VideoRendererBase::~VideoRendererBase() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ == kUninitialized || state_ == kStopped); } @@ -78,7 +78,7 @@ bool VideoRendererBase::ParseMediaFormat( } void VideoRendererBase::Play(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPrerolled, state_); scoped_ptr<FilterCallback> c(callback); state_ = kPlaying; @@ -86,7 +86,7 @@ void VideoRendererBase::Play(FilterCallback* callback) { } void VideoRendererBase::Pause(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ != kUninitialized || state_ == kError); AutoCallbackRunner done_runner(callback); state_ = kPaused; @@ -95,7 +95,7 @@ void VideoRendererBase::Pause(FilterCallback* callback) { void VideoRendererBase::Flush(FilterCallback* callback) { DCHECK_EQ(state_, kPaused); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); flush_callback_.reset(callback); state_ = kFlushing; @@ -107,7 +107,7 @@ void VideoRendererBase::Stop(FilterCallback* callback) { DCHECK_EQ(pending_reads_, 0); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = kStopped; // Clean up our thread if present. @@ -116,7 +116,7 @@ void VideoRendererBase::Stop(FilterCallback* callback) { // thread waiting for a read to complete. frame_available_.Signal(); { - AutoUnlock auto_unlock(lock_); + base::AutoUnlock auto_unlock(lock_); base::PlatformThread::Join(thread_); } thread_ = base::kNullThreadHandle; @@ -128,12 +128,12 @@ void VideoRendererBase::Stop(FilterCallback* callback) { } void VideoRendererBase::SetPlaybackRate(float playback_rate) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); playback_rate_ = playback_rate; } void VideoRendererBase::Seek(base::TimeDelta time, FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // There is a race condition between filters to receive SeekTask(). // It turns out we could receive buffer from decoder before seek() // is called on us. so we do the following: @@ -158,7 +158,7 @@ void VideoRendererBase::Seek(base::TimeDelta time, FilterCallback* callback) { void VideoRendererBase::Initialize(VideoDecoder* decoder, FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(decoder); DCHECK(callback); DCHECK_EQ(kUninitialized, state_); @@ -210,7 +210,7 @@ void VideoRendererBase::Initialize(VideoDecoder* decoder, } bool VideoRendererBase::HasEnded() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return state_ == kEnded; } @@ -220,7 +220,7 @@ void VideoRendererBase::ThreadMain() { base::TimeDelta remaining_time; for (;;) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); const base::TimeDelta kIdleTimeDelta = base::TimeDelta::FromMilliseconds(kIdleMilliseconds); @@ -317,7 +317,7 @@ void VideoRendererBase::ThreadMain() { ScheduleRead_Locked(); } if (new_frame_available) { - AutoUnlock auto_unlock(lock_); + base::AutoUnlock auto_unlock(lock_); // Notify subclass that |current_frame_| has been updated. OnFrameAvailable(); } @@ -326,7 +326,7 @@ void VideoRendererBase::ThreadMain() { } void VideoRendererBase::GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(!pending_paint_ && !pending_paint_with_last_available_); if (!current_frame_.get() || current_frame_->IsEndOfStream()) { @@ -352,7 +352,7 @@ void VideoRendererBase::GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out) { } void VideoRendererBase::PutCurrentFrame(scoped_refptr<VideoFrame> frame) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Note that we do not claim |pending_paint_| when we return NULL frame, in // that case, |current_frame_| could be changed before PutCurrentFrame. @@ -376,7 +376,7 @@ void VideoRendererBase::PutCurrentFrame(scoped_refptr<VideoFrame> frame) { } void VideoRendererBase::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Decoder could reach seek state before our Seek() get called. // We will enter kSeeking |