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

Side by Side Diff: content/renderer/media/audio_renderer_impl.cc

Issue 8294027: Merge r104540 into 874 (m15). (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: '' Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/composite_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/audio_renderer_impl.h" 5 #include "content/renderer/media/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 bytes_per_second_ = params.GetBytesPerSecond(); 90 bytes_per_second_ = params.GetBytesPerSecond();
91 91
92 ChildProcess::current()->io_message_loop()->PostTask( 92 ChildProcess::current()->io_message_loop()->PostTask(
93 FROM_HERE, 93 FROM_HERE,
94 NewRunnableMethod(this, &AudioRendererImpl::CreateStreamTask, params)); 94 NewRunnableMethod(this, &AudioRendererImpl::CreateStreamTask, params));
95 return true; 95 return true;
96 } 96 }
97 97
98 void AudioRendererImpl::OnStop() { 98 void AudioRendererImpl::OnStop() {
99 base::AutoLock auto_lock(lock_); 99 // Since joining with the audio thread can acquire lock_, we make sure to
100 if (stopped_) 100 // Join() with it not under lock.
101 return; 101 base::DelegateSimpleThread* audio_thread = NULL;
102 stopped_ = true; 102 {
103 base::AutoLock auto_lock(lock_);
104 if (stopped_)
105 return;
106 stopped_ = true;
103 107
104 ChildProcess::current()->io_message_loop()->PostTask( 108 DCHECK_EQ(!audio_thread_.get(), !socket_.get());
105 FROM_HERE, 109 if (socket_.get())
106 NewRunnableMethod(this, &AudioRendererImpl::DestroyTask)); 110 socket_->Close();
111 if (audio_thread_.get())
112 audio_thread = audio_thread_.get();
107 113
108 if (audio_thread_.get()) { 114 ChildProcess::current()->io_message_loop()->PostTask(
109 socket_->Close(); 115 FROM_HERE,
110 audio_thread_->Join(); 116 NewRunnableMethod(this, &AudioRendererImpl::DestroyTask));
111 } 117 }
118
119 if (audio_thread)
120 audio_thread->Join();
112 } 121 }
113 122
114 void AudioRendererImpl::NotifyDataAvailableIfNecessary() { 123 void AudioRendererImpl::NotifyDataAvailableIfNecessary() {
115 if (latency_type_ == kHighLatency) { 124 if (latency_type_ == kHighLatency) {
116 // Post a task to render thread to notify a packet reception. 125 // Post a task to render thread to notify a packet reception.
117 ChildProcess::current()->io_message_loop()->PostTask( 126 ChildProcess::current()->io_message_loop()->PostTask(
118 FROM_HERE, 127 FROM_HERE,
119 NewRunnableMethod(this, &AudioRendererImpl::NotifyPacketReadyTask)); 128 NewRunnableMethod(this, &AudioRendererImpl::NotifyPacketReadyTask));
120 } 129 }
121 } 130 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 media::SetActualDataSizeInBytes(shared_memory_.get(), 493 media::SetActualDataSizeInBytes(shared_memory_.get(),
485 shared_memory_size_, 494 shared_memory_size_,
486 size); 495 size);
487 UpdateEarliestEndTime(size, request_delay, time_now); 496 UpdateEarliestEndTime(size, request_delay, time_now);
488 } 497 }
489 } 498 }
490 499
491 void AudioRendererImpl::Send(IPC::Message* message) { 500 void AudioRendererImpl::Send(IPC::Message* message) {
492 filter_->Send(message); 501 filter_->Send(message);
493 } 502 }
OLDNEW
« no previous file with comments | « no previous file | media/base/composite_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698