Commit 25d7709b authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in content/renderer/media/webrtc*

This patch was generated by running the rewrite_scoped_refptr clang tool
on a Linux build.

BUG=110610

Review URL: https://codereview.chromium.org/503683003

Cr-Commit-Position: refs/heads/master@{#292096}
parent 88d96e66
...@@ -151,21 +151,21 @@ void MediaStreamRemoteVideoSource::StartSourceImpl( ...@@ -151,21 +151,21 @@ void MediaStreamRemoteVideoSource::StartSourceImpl(
const media::VideoCaptureParams& params, const media::VideoCaptureParams& params,
const VideoCaptureDeliverFrameCB& frame_callback) { const VideoCaptureDeliverFrameCB& frame_callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!delegate_); DCHECK(!delegate_.get());
delegate_ = new RemoteVideoSourceDelegate(io_message_loop(), frame_callback); delegate_ = new RemoteVideoSourceDelegate(io_message_loop(), frame_callback);
remote_track_->AddRenderer(delegate_); remote_track_->AddRenderer(delegate_.get());
OnStartDone(MEDIA_DEVICE_OK); OnStartDone(MEDIA_DEVICE_OK);
} }
void MediaStreamRemoteVideoSource::StopSourceImpl() { void MediaStreamRemoteVideoSource::StopSourceImpl() {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(state() != MediaStreamVideoSource::ENDED); DCHECK(state() != MediaStreamVideoSource::ENDED);
remote_track_->RemoveRenderer(delegate_); remote_track_->RemoveRenderer(delegate_.get());
} }
webrtc::VideoRendererInterface* webrtc::VideoRendererInterface*
MediaStreamRemoteVideoSource::RenderInterfaceForTest() { MediaStreamRemoteVideoSource::RenderInterfaceForTest() {
return delegate_; return delegate_.get();
} }
void MediaStreamRemoteVideoSource::OnChanged() { void MediaStreamRemoteVideoSource::OnChanged() {
......
...@@ -35,12 +35,11 @@ class MediaStreamRemoteVideoSourceTest ...@@ -35,12 +35,11 @@ class MediaStreamRemoteVideoSourceTest
MediaStreamRemoteVideoSourceTest() MediaStreamRemoteVideoSourceTest()
: child_process_(new ChildProcess()), : child_process_(new ChildProcess()),
mock_factory_(new MockPeerConnectionDependencyFactory()), mock_factory_(new MockPeerConnectionDependencyFactory()),
webrtc_video_track_( webrtc_video_track_(mock_factory_->CreateLocalVideoTrack(
mock_factory_->CreateLocalVideoTrack( "test",
"test", static_cast<cricket::VideoCapturer*>(NULL))),
static_cast<cricket::VideoCapturer*>(NULL))), remote_source_(new MediaStreamRemoteVideoSourceUnderTest(
remote_source_( webrtc_video_track_.get())),
new MediaStreamRemoteVideoSourceUnderTest(webrtc_video_track_)),
number_of_successful_constraints_applied_(0), number_of_successful_constraints_applied_(0),
number_of_failed_constraints_applied_(0) { number_of_failed_constraints_applied_(0) {
webkit_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), webkit_source_.initialize(base::UTF8ToUTF16("dummy_source_id"),
......
...@@ -180,7 +180,7 @@ PeerConnectionDependencyFactory::PeerConnectionDependencyFactory( ...@@ -180,7 +180,7 @@ PeerConnectionDependencyFactory::PeerConnectionDependencyFactory(
PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() { PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() {
CleanupPeerConnectionFactory(); CleanupPeerConnectionFactory();
if (aec_dump_message_filter_) if (aec_dump_message_filter_.get())
aec_dump_message_filter_->RemoveDelegate(this); aec_dump_message_filter_->RemoveDelegate(this);
} }
...@@ -224,7 +224,7 @@ bool PeerConnectionDependencyFactory::InitializeMediaStreamAudioSource( ...@@ -224,7 +224,7 @@ bool PeerConnectionDependencyFactory::InitializeMediaStreamAudioSource(
// be called multiple times which is likely also a bug. // be called multiple times which is likely also a bug.
return false; return false;
} }
source_data->SetAudioCapturer(capturer); source_data->SetAudioCapturer(capturer.get());
// Creates a LocalAudioSource object which holds audio options. // Creates a LocalAudioSource object which holds audio options.
// TODO(xians): The option should apply to the track instead of the source. // TODO(xians): The option should apply to the track instead of the source.
...@@ -237,7 +237,7 @@ bool PeerConnectionDependencyFactory::InitializeMediaStreamAudioSource( ...@@ -237,7 +237,7 @@ bool PeerConnectionDependencyFactory::InitializeMediaStreamAudioSource(
DLOG(WARNING) << "Failed to create rtc LocalAudioSource."; DLOG(WARNING) << "Failed to create rtc LocalAudioSource.";
return false; return false;
} }
source_data->SetLocalAudioSource(rtc_source); source_data->SetLocalAudioSource(rtc_source.get());
return true; return true;
} }
...@@ -248,7 +248,7 @@ PeerConnectionDependencyFactory::CreateVideoCapturer( ...@@ -248,7 +248,7 @@ PeerConnectionDependencyFactory::CreateVideoCapturer(
// before we can use an instance of a WebRtcVideoCapturerAdapter. This is // before we can use an instance of a WebRtcVideoCapturerAdapter. This is
// since the base class of WebRtcVideoCapturerAdapter is a // since the base class of WebRtcVideoCapturerAdapter is a
// cricket::VideoCapturer and it uses the libjingle thread wrappers. // cricket::VideoCapturer and it uses the libjingle thread wrappers.
if (!GetPcFactory()) if (!GetPcFactory().get())
return NULL; return NULL;
return new WebRtcVideoCapturerAdapter(is_screeencast); return new WebRtcVideoCapturerAdapter(is_screeencast);
} }
...@@ -265,9 +265,9 @@ PeerConnectionDependencyFactory::CreateVideoSource( ...@@ -265,9 +265,9 @@ PeerConnectionDependencyFactory::CreateVideoSource(
const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& const scoped_refptr<webrtc::PeerConnectionFactoryInterface>&
PeerConnectionDependencyFactory::GetPcFactory() { PeerConnectionDependencyFactory::GetPcFactory() {
if (!pc_factory_) if (!pc_factory_.get())
CreatePeerConnectionFactory(); CreatePeerConnectionFactory();
CHECK(pc_factory_); CHECK(pc_factory_.get());
return pc_factory_; return pc_factory_;
} }
...@@ -326,12 +326,12 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() { ...@@ -326,12 +326,12 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() {
scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories = scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories =
RenderThreadImpl::current()->GetGpuFactories(); RenderThreadImpl::current()->GetGpuFactories();
if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) { if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) {
if (gpu_factories) if (gpu_factories.get())
decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
} }
if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
if (gpu_factories) if (gpu_factories.get())
encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
} }
...@@ -348,7 +348,7 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() { ...@@ -348,7 +348,7 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() {
audio_device_.get(), audio_device_.get(),
encoder_factory.release(), encoder_factory.release(),
decoder_factory.release())); decoder_factory.release()));
CHECK(factory); CHECK(factory.get());
pc_factory_ = factory; pc_factory_ = factory;
webrtc::PeerConnectionFactoryInterface::Options factory_options; webrtc::PeerConnectionFactoryInterface::Options factory_options;
...@@ -364,7 +364,7 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() { ...@@ -364,7 +364,7 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() {
// In unit tests not creating a message filter, |aec_dump_message_filter_| // In unit tests not creating a message filter, |aec_dump_message_filter_|
// will be NULL. We can just ignore that. Other unit tests and browser tests // will be NULL. We can just ignore that. Other unit tests and browser tests
// ensure that we do get the filter when we should. // ensure that we do get the filter when we should.
if (aec_dump_message_filter_) if (aec_dump_message_filter_.get())
aec_dump_message_filter_->AddDelegate(this); aec_dump_message_filter_->AddDelegate(this);
} }
} }
...@@ -381,7 +381,7 @@ PeerConnectionDependencyFactory::CreatePeerConnection( ...@@ -381,7 +381,7 @@ PeerConnectionDependencyFactory::CreatePeerConnection(
webrtc::PeerConnectionObserver* observer) { webrtc::PeerConnectionObserver* observer) {
CHECK(web_frame); CHECK(web_frame);
CHECK(observer); CHECK(observer);
if (!GetPcFactory()) if (!GetPcFactory().get())
return NULL; return NULL;
scoped_refptr<P2PPortAllocatorFactory> pa_factory = scoped_refptr<P2PPortAllocatorFactory> pa_factory =
...@@ -449,10 +449,8 @@ void PeerConnectionDependencyFactory::CreateLocalAudioTrack( ...@@ -449,10 +449,8 @@ void PeerConnectionDependencyFactory::CreateLocalAudioTrack(
// TODO(xians): Merge |source| to the capturer(). We can't do this today // TODO(xians): Merge |source| to the capturer(). We can't do this today
// because only one capturer() is supported while one |source| is created // because only one capturer() is supported while one |source| is created
// for each audio track. // for each audio track.
scoped_ptr<WebRtcLocalAudioTrack> audio_track( scoped_ptr<WebRtcLocalAudioTrack> audio_track(new WebRtcLocalAudioTrack(
new WebRtcLocalAudioTrack(adapter, adapter.get(), source_data->GetAudioCapturer(), webaudio_source.get()));
source_data->GetAudioCapturer(),
webaudio_source));
StartLocalAudioTrack(audio_track.get()); StartLocalAudioTrack(audio_track.get());
...@@ -656,7 +654,7 @@ void PeerConnectionDependencyFactory::OnIpcClosing() { ...@@ -656,7 +654,7 @@ void PeerConnectionDependencyFactory::OnIpcClosing() {
} }
void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
if (audio_device_) if (audio_device_.get())
return; return;
audio_device_ = new WebRtcAudioDeviceImpl(); audio_device_ = new WebRtcAudioDeviceImpl();
......
...@@ -97,7 +97,7 @@ void PpFrameWriter::StartSourceImpl( ...@@ -97,7 +97,7 @@ void PpFrameWriter::StartSourceImpl(
const media::VideoCaptureParams& params, const media::VideoCaptureParams& params,
const VideoCaptureDeliverFrameCB& frame_callback) { const VideoCaptureDeliverFrameCB& frame_callback) {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
DCHECK(!delegate_); DCHECK(!delegate_.get());
DVLOG(3) << "PpFrameWriter::StartSourceImpl()"; DVLOG(3) << "PpFrameWriter::StartSourceImpl()";
delegate_ = new FrameWriterDelegate(io_message_loop(), frame_callback); delegate_ = new FrameWriterDelegate(io_message_loop(), frame_callback);
OnStartDone(MEDIA_DEVICE_OK); OnStartDone(MEDIA_DEVICE_OK);
......
...@@ -94,7 +94,7 @@ TEST_F(VideoDestinationHandlerTest, PutFrame) { ...@@ -94,7 +94,7 @@ TEST_F(VideoDestinationHandlerTest, PutFrame) {
EXPECT_CALL(sink, OnVideoFrame()).WillOnce( EXPECT_CALL(sink, OnVideoFrame()).WillOnce(
RunClosure(quit_closure)); RunClosure(quit_closure));
frame_writer->PutFrame(image, 10); frame_writer->PutFrame(image.get(), 10);
run_loop.Run(); run_loop.Run();
} }
// TODO(perkj): Verify that the track output I420 when // TODO(perkj): Verify that the track output I420 when
......
...@@ -41,7 +41,7 @@ class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test { ...@@ -41,7 +41,7 @@ class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test {
capturer_ = WebRtcAudioCapturer::CreateCapturer( capturer_ = WebRtcAudioCapturer::CreateCapturer(
-1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""),
constraint_factory.CreateWebMediaConstraints(), NULL, NULL); constraint_factory.CreateWebMediaConstraints(), NULL, NULL);
track_.reset(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)); track_.reset(new WebRtcLocalAudioTrack(adapter_.get(), capturer_, NULL));
} }
protected: protected:
......
...@@ -64,7 +64,7 @@ void WebRtcMediaStreamAdapter::TrackRemoved( ...@@ -64,7 +64,7 @@ void WebRtcMediaStreamAdapter::TrackRemoved(
for (ScopedVector<WebRtcVideoTrackAdapter>::iterator it = for (ScopedVector<WebRtcVideoTrackAdapter>::iterator it =
video_adapters_.begin(); it != video_adapters_.end(); ++it) { video_adapters_.begin(); it != video_adapters_.end(); ++it) {
if ((*it)->webrtc_video_track() == webrtc_track) { if ((*it)->webrtc_video_track() == webrtc_track.get()) {
video_adapters_.erase(it); video_adapters_.erase(it);
break; break;
} }
...@@ -93,7 +93,7 @@ void WebRtcMediaStreamAdapter::CreateAudioTrack( ...@@ -93,7 +93,7 @@ void WebRtcMediaStreamAdapter::CreateAudioTrack(
const blink::WebMediaStreamSource& source = track.source(); const blink::WebMediaStreamSource& source = track.source();
MediaStreamAudioSource* audio_source = MediaStreamAudioSource* audio_source =
static_cast<MediaStreamAudioSource*>(source.extraData()); static_cast<MediaStreamAudioSource*>(source.extraData());
if (audio_source && audio_source->GetAudioCapturer()) if (audio_source && audio_source->GetAudioCapturer().get())
audio_source->GetAudioCapturer()->EnablePeerConnectionMode(); audio_source->GetAudioCapturer()->EnablePeerConnectionMode();
webrtc_media_stream_->AddTrack(native_track->GetAudioAdapter()); webrtc_media_stream_->AddTrack(native_track->GetAudioAdapter());
......
...@@ -264,7 +264,7 @@ void WebRtcAudioCapturer::AddTrack(WebRtcLocalAudioTrack* track) { ...@@ -264,7 +264,7 @@ void WebRtcAudioCapturer::AddTrack(WebRtcLocalAudioTrack* track) {
// Add with a tag, so we remember to call OnSetFormat() on the new // Add with a tag, so we remember to call OnSetFormat() on the new
// track. // track.
scoped_refptr<TrackOwner> track_owner(new TrackOwner(track)); scoped_refptr<TrackOwner> track_owner(new TrackOwner(track));
tracks_.AddAndTag(track_owner); tracks_.AddAndTag(track_owner.get());
} }
} }
...@@ -387,7 +387,7 @@ void WebRtcAudioCapturer::Start() { ...@@ -387,7 +387,7 @@ void WebRtcAudioCapturer::Start() {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "WebRtcAudioCapturer::Start()"; DVLOG(1) << "WebRtcAudioCapturer::Start()";
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
if (running_ || !source_) if (running_ || !source_.get())
return; return;
// Start the data source, i.e., start capturing data from the current source. // Start the data source, i.e., start capturing data from the current source.
...@@ -554,8 +554,8 @@ void WebRtcAudioCapturer::OnCaptureError() { ...@@ -554,8 +554,8 @@ void WebRtcAudioCapturer::OnCaptureError() {
media::AudioParameters WebRtcAudioCapturer::source_audio_parameters() const { media::AudioParameters WebRtcAudioCapturer::source_audio_parameters() const {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
return audio_processor_ ? return audio_processor_.get() ? audio_processor_->InputFormat()
audio_processor_->InputFormat() : media::AudioParameters(); : media::AudioParameters();
} }
bool WebRtcAudioCapturer::GetPairedOutputParameters( bool WebRtcAudioCapturer::GetPairedOutputParameters(
......
...@@ -105,7 +105,7 @@ class WebRtcAudioCapturerTest : public testing::Test { ...@@ -105,7 +105,7 @@ class WebRtcAudioCapturerTest : public testing::Test {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
track_.reset(new WebRtcLocalAudioTrack(adapter, capturer_, NULL)); track_.reset(new WebRtcLocalAudioTrack(adapter.get(), capturer_, NULL));
track_->Start(); track_->Start();
// Connect a mock sink to the track. // Connect a mock sink to the track.
...@@ -124,7 +124,8 @@ class WebRtcAudioCapturerTest : public testing::Test { ...@@ -124,7 +124,8 @@ class WebRtcAudioCapturerTest : public testing::Test {
audio_bus->Zero(); audio_bus->Zero();
media::AudioCapturerSource::CaptureCallback* callback = media::AudioCapturerSource::CaptureCallback* callback =
static_cast<media::AudioCapturerSource::CaptureCallback*>(capturer_); static_cast<media::AudioCapturerSource::CaptureCallback*>(
capturer_.get());
// Verify the sink is getting the correct values. // Verify the sink is getting the correct values.
EXPECT_CALL(*sink, FormatIsSet()); EXPECT_CALL(*sink, FormatIsSet());
...@@ -185,7 +186,7 @@ TEST_F(WebRtcAudioCapturerTest, FailToCreateCapturerWithWrongConstraints) { ...@@ -185,7 +186,7 @@ TEST_F(WebRtcAudioCapturerTest, FailToCreateCapturerWithWrongConstraints) {
params_.frames_per_buffer()), params_.frames_per_buffer()),
constraint_factory.CreateWebMediaConstraints(), NULL, NULL) constraint_factory.CreateWebMediaConstraints(), NULL, NULL)
); );
EXPECT_TRUE(capturer == NULL); EXPECT_TRUE(capturer.get() == NULL);
} }
......
...@@ -202,7 +202,7 @@ void WebRtcAudioDeviceImpl::RenderData(media::AudioBus* audio_bus, ...@@ -202,7 +202,7 @@ void WebRtcAudioDeviceImpl::RenderData(media::AudioBus* audio_bus,
void WebRtcAudioDeviceImpl::RemoveAudioRenderer(WebRtcAudioRenderer* renderer) { void WebRtcAudioDeviceImpl::RemoveAudioRenderer(WebRtcAudioRenderer* renderer) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(renderer, renderer_); DCHECK_EQ(renderer, renderer_.get());
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
// Notify the playout sink of the change. // Notify the playout sink of the change.
for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin(); for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin();
...@@ -401,7 +401,7 @@ int32_t WebRtcAudioDeviceImpl::MinMicrophoneVolume(uint32_t* min_volume) const { ...@@ -401,7 +401,7 @@ int32_t WebRtcAudioDeviceImpl::MinMicrophoneVolume(uint32_t* min_volume) const {
int32_t WebRtcAudioDeviceImpl::StereoPlayoutIsAvailable(bool* available) const { int32_t WebRtcAudioDeviceImpl::StereoPlayoutIsAvailable(bool* available) const {
DCHECK(initialized_); DCHECK(initialized_);
*available = renderer_ && renderer_->channels() == 2; *available = renderer_.get() && renderer_->channels() == 2;
return 0; return 0;
} }
...@@ -444,7 +444,7 @@ int32_t WebRtcAudioDeviceImpl::RecordingSampleRate( ...@@ -444,7 +444,7 @@ int32_t WebRtcAudioDeviceImpl::RecordingSampleRate(
int32_t WebRtcAudioDeviceImpl::PlayoutSampleRate( int32_t WebRtcAudioDeviceImpl::PlayoutSampleRate(
uint32_t* sample_rate) const { uint32_t* sample_rate) const {
*sample_rate = renderer_ ? renderer_->sample_rate() : 0; *sample_rate = renderer_.get() ? renderer_->sample_rate() : 0;
return 0; return 0;
} }
......
...@@ -91,7 +91,7 @@ class WebRtcAudioRendererTest : public testing::Test { ...@@ -91,7 +91,7 @@ class WebRtcAudioRendererTest : public testing::Test {
renderer_(new WebRtcAudioRenderer(stream_, 1, 1, 1, 44100, 441)) { renderer_(new WebRtcAudioRenderer(stream_, 1, 1, 1, 44100, 441)) {
EXPECT_CALL(*factory_.get(), CreateOutputDevice(1)) EXPECT_CALL(*factory_.get(), CreateOutputDevice(1))
.WillOnce(Return(mock_output_device_)); .WillOnce(Return(mock_output_device_));
EXPECT_CALL(*mock_output_device_, Start()); EXPECT_CALL(*mock_output_device_.get(), Start());
EXPECT_TRUE(renderer_->Initialize(source_.get())); EXPECT_TRUE(renderer_->Initialize(source_.get()));
renderer_proxy_ = renderer_->CreateSharedAudioRendererProxy(stream_); renderer_proxy_ = renderer_->CreateSharedAudioRendererProxy(stream_);
} }
...@@ -114,7 +114,7 @@ TEST_F(WebRtcAudioRendererTest, StopRenderer) { ...@@ -114,7 +114,7 @@ TEST_F(WebRtcAudioRendererTest, StopRenderer) {
// |renderer_| has only one proxy, stopping the proxy should stop the sink of // |renderer_| has only one proxy, stopping the proxy should stop the sink of
// |renderer_|. // |renderer_|.
EXPECT_CALL(*mock_output_device_, Stop()); EXPECT_CALL(*mock_output_device_.get(), Stop());
EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get()));
renderer_proxy_->Stop(); renderer_proxy_->Stop();
} }
...@@ -136,16 +136,16 @@ TEST_F(WebRtcAudioRendererTest, MultipleRenderers) { ...@@ -136,16 +136,16 @@ TEST_F(WebRtcAudioRendererTest, MultipleRenderers) {
// Stop the |renderer_proxy_| should not stop the sink since it is used by // Stop the |renderer_proxy_| should not stop the sink since it is used by
// other proxies. // other proxies.
EXPECT_CALL(*mock_output_device_, Stop()).Times(0); EXPECT_CALL(*mock_output_device_.get(), Stop()).Times(0);
renderer_proxy_->Stop(); renderer_proxy_->Stop();
for (int i = 0; i < kNumberOfRendererProxy; ++i) { for (int i = 0; i < kNumberOfRendererProxy; ++i) {
if (i != kNumberOfRendererProxy -1) { if (i != kNumberOfRendererProxy -1) {
EXPECT_CALL(*mock_output_device_, Stop()).Times(0); EXPECT_CALL(*mock_output_device_.get(), Stop()).Times(0);
} else { } else {
// When the last proxy is stopped, the sink will stop. // When the last proxy is stopped, the sink will stop.
EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get()));
EXPECT_CALL(*mock_output_device_, Stop()); EXPECT_CALL(*mock_output_device_.get(), Stop());
} }
renderer_proxies_[i]->Stop(); renderer_proxies_[i]->Stop();
} }
......
...@@ -153,7 +153,7 @@ void WebRtcLocalAudioRenderer::Stop() { ...@@ -153,7 +153,7 @@ void WebRtcLocalAudioRenderer::Stop() {
// Stop the output audio stream, i.e, stop asking for data to render. // Stop the output audio stream, i.e, stop asking for data to render.
// It is safer to call Stop() on the |sink_| to clean up the resources even // It is safer to call Stop() on the |sink_| to clean up the resources even
// when the |sink_| is never started. // when the |sink_| is never started.
if (sink_) { if (sink_.get()) {
sink_->Stop(); sink_->Stop();
sink_ = NULL; sink_ = NULL;
} }
...@@ -316,7 +316,7 @@ void WebRtcLocalAudioRenderer::ReconfigureSink( ...@@ -316,7 +316,7 @@ void WebRtcLocalAudioRenderer::ReconfigureSink(
loopback_fifo_.reset(new_fifo); loopback_fifo_.reset(new_fifo);
} }
if (!sink_) if (!sink_.get())
return; // WebRtcLocalAudioRenderer has not yet been started. return; // WebRtcLocalAudioRenderer has not yet been started.
// Stop |sink_| and re-create a new one to be initialized with different audio // Stop |sink_| and re-create a new one to be initialized with different audio
......
...@@ -37,7 +37,7 @@ class WebRtcLocalAudioSourceProviderTest : public testing::Test { ...@@ -37,7 +37,7 @@ class WebRtcLocalAudioSourceProviderTest : public testing::Test {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> native_track( scoped_ptr<WebRtcLocalAudioTrack> native_track(
new WebRtcLocalAudioTrack(adapter, capturer, NULL)); new WebRtcLocalAudioTrack(adapter.get(), capturer, NULL));
blink::WebMediaStreamSource audio_source; blink::WebMediaStreamSource audio_source;
audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"),
blink::WebMediaStreamSource::TypeAudio, blink::WebMediaStreamSource::TypeAudio,
......
...@@ -86,7 +86,7 @@ void WebRtcLocalAudioTrack::Capture(const int16* audio_data, ...@@ -86,7 +86,7 @@ void WebRtcLocalAudioTrack::Capture(const int16* audio_data,
volume, volume,
need_audio_processing, need_audio_processing,
key_pressed); key_pressed);
if (new_volume != 0 && capturer.get() && !webaudio_source_) { if (new_volume != 0 && capturer.get() && !webaudio_source_.get()) {
// Feed the new volume to WebRtc while changing the volume on the // Feed the new volume to WebRtc while changing the volume on the
// browser. // browser.
capturer->SetVolume(new_volume); capturer->SetVolume(new_volume);
...@@ -135,7 +135,7 @@ void WebRtcLocalAudioTrack::AddSink(MediaStreamAudioSink* sink) { ...@@ -135,7 +135,7 @@ void WebRtcLocalAudioTrack::AddSink(MediaStreamAudioSink* sink) {
// we remember to call OnSetFormat() on the new sink. // we remember to call OnSetFormat() on the new sink.
scoped_refptr<MediaStreamAudioTrackSink> sink_owner( scoped_refptr<MediaStreamAudioTrackSink> sink_owner(
new MediaStreamAudioSinkOwner(sink)); new MediaStreamAudioSinkOwner(sink));
sinks_.AddAndTag(sink_owner); sinks_.AddAndTag(sink_owner.get());
} }
void WebRtcLocalAudioTrack::RemoveSink(MediaStreamAudioSink* sink) { void WebRtcLocalAudioTrack::RemoveSink(MediaStreamAudioSink* sink) {
...@@ -169,7 +169,7 @@ void WebRtcLocalAudioTrack::AddSink(PeerConnectionAudioSink* sink) { ...@@ -169,7 +169,7 @@ void WebRtcLocalAudioTrack::AddSink(PeerConnectionAudioSink* sink) {
// we remember to call OnSetFormat() on the new sink. // we remember to call OnSetFormat() on the new sink.
scoped_refptr<MediaStreamAudioTrackSink> sink_owner( scoped_refptr<MediaStreamAudioTrackSink> sink_owner(
new PeerConnectionAudioSinkOwner(sink)); new PeerConnectionAudioSinkOwner(sink));
sinks_.AddAndTag(sink_owner); sinks_.AddAndTag(sink_owner.get());
} }
void WebRtcLocalAudioTrack::RemoveSink(PeerConnectionAudioSink* sink) { void WebRtcLocalAudioTrack::RemoveSink(PeerConnectionAudioSink* sink) {
......
...@@ -181,7 +181,7 @@ class WebRtcLocalAudioTrackTest : public ::testing::Test { ...@@ -181,7 +181,7 @@ class WebRtcLocalAudioTrackTest : public ::testing::Test {
capturer_ = WebRtcAudioCapturer::CreateCapturer( capturer_ = WebRtcAudioCapturer::CreateCapturer(
-1, device, constraint_factory.CreateWebMediaConstraints(), NULL, -1, device, constraint_factory.CreateWebMediaConstraints(), NULL,
audio_source); audio_source);
audio_source->SetAudioCapturer(capturer_); audio_source->SetAudioCapturer(capturer_.get());
capturer_source_ = new MockCapturerSource(capturer_.get()); capturer_source_ = new MockCapturerSource(capturer_.get());
EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1)) EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1))
.WillOnce(Return()); .WillOnce(Return());
...@@ -204,7 +204,7 @@ TEST_F(WebRtcLocalAudioTrackTest, ConnectAndDisconnectOneSink) { ...@@ -204,7 +204,7 @@ TEST_F(WebRtcLocalAudioTrackTest, ConnectAndDisconnectOneSink) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track( scoped_ptr<WebRtcLocalAudioTrack> track(
new WebRtcLocalAudioTrack(adapter, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter.get(), capturer_, NULL));
track->Start(); track->Start();
EXPECT_TRUE(track->GetAudioAdapter()->enabled()); EXPECT_TRUE(track->GetAudioAdapter()->enabled());
...@@ -238,7 +238,7 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_DisableEnableAudioTrack) { ...@@ -238,7 +238,7 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_DisableEnableAudioTrack) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track( scoped_ptr<WebRtcLocalAudioTrack> track(
new WebRtcLocalAudioTrack(adapter, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter.get(), capturer_, NULL));
track->Start(); track->Start();
EXPECT_TRUE(track->GetAudioAdapter()->enabled()); EXPECT_TRUE(track->GetAudioAdapter()->enabled());
EXPECT_TRUE(track->GetAudioAdapter()->set_enabled(false)); EXPECT_TRUE(track->GetAudioAdapter()->set_enabled(false));
...@@ -272,7 +272,7 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_MultipleAudioTracks) { ...@@ -272,7 +272,7 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_MultipleAudioTracks) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track_1( scoped_ptr<WebRtcLocalAudioTrack> track_1(
new WebRtcLocalAudioTrack(adapter_1, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter_1.get(), capturer_, NULL));
track_1->Start(); track_1->Start();
EXPECT_TRUE(track_1->GetAudioAdapter()->enabled()); EXPECT_TRUE(track_1->GetAudioAdapter()->enabled());
scoped_ptr<MockMediaStreamAudioSink> sink_1(new MockMediaStreamAudioSink()); scoped_ptr<MockMediaStreamAudioSink> sink_1(new MockMediaStreamAudioSink());
...@@ -290,7 +290,7 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_MultipleAudioTracks) { ...@@ -290,7 +290,7 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_MultipleAudioTracks) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_2( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_2(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track_2( scoped_ptr<WebRtcLocalAudioTrack> track_2(
new WebRtcLocalAudioTrack(adapter_2, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter_2.get(), capturer_, NULL));
track_2->Start(); track_2->Start();
EXPECT_TRUE(track_2->GetAudioAdapter()->enabled()); EXPECT_TRUE(track_2->GetAudioAdapter()->enabled());
...@@ -329,7 +329,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartOneAudioTrack) { ...@@ -329,7 +329,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartOneAudioTrack) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track( scoped_ptr<WebRtcLocalAudioTrack> track(
new WebRtcLocalAudioTrack(adapter, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter.get(), capturer_, NULL));
track->Start(); track->Start();
// When the track goes away, it will automatically stop the // When the track goes away, it will automatically stop the
...@@ -345,13 +345,13 @@ TEST_F(WebRtcLocalAudioTrackTest, StartTwoAudioTracks) { ...@@ -345,13 +345,13 @@ TEST_F(WebRtcLocalAudioTrackTest, StartTwoAudioTracks) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter1( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter1(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track1( scoped_ptr<WebRtcLocalAudioTrack> track1(
new WebRtcLocalAudioTrack(adapter1, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter1.get(), capturer_, NULL));
track1->Start(); track1->Start();
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter2( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter2(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track2( scoped_ptr<WebRtcLocalAudioTrack> track2(
new WebRtcLocalAudioTrack(adapter2, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter2.get(), capturer_, NULL));
track2->Start(); track2->Start();
track1->Stop(); track1->Stop();
...@@ -368,7 +368,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) { ...@@ -368,7 +368,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track_1( scoped_ptr<WebRtcLocalAudioTrack> track_1(
new WebRtcLocalAudioTrack(adapter_1, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter_1.get(), capturer_, NULL));
track_1->Start(); track_1->Start();
// Verify the data flow by connecting the sink to |track_1|. // Verify the data flow by connecting the sink to |track_1|.
...@@ -386,7 +386,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) { ...@@ -386,7 +386,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_2( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_2(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track_2( scoped_ptr<WebRtcLocalAudioTrack> track_2(
new WebRtcLocalAudioTrack(adapter_2, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter_2.get(), capturer_, NULL));
track_2->Start(); track_2->Start();
// Stop the capturer will clear up the track lists in the capturer. // Stop the capturer will clear up the track lists in the capturer.
...@@ -418,7 +418,7 @@ TEST_F(WebRtcLocalAudioTrackTest, ...@@ -418,7 +418,7 @@ TEST_F(WebRtcLocalAudioTrackTest,
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track_1( scoped_ptr<WebRtcLocalAudioTrack> track_1(
new WebRtcLocalAudioTrack(adapter_1, capturer_, NULL)); new WebRtcLocalAudioTrack(adapter_1.get(), capturer_, NULL));
track_1->Start(); track_1->Start();
// Verify the data flow by connecting the |sink_1| to |track_1|. // Verify the data flow by connecting the |sink_1| to |track_1|.
...@@ -451,7 +451,7 @@ TEST_F(WebRtcLocalAudioTrackTest, ...@@ -451,7 +451,7 @@ TEST_F(WebRtcLocalAudioTrackTest,
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_2( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_2(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track_2( scoped_ptr<WebRtcLocalAudioTrack> track_2(
new WebRtcLocalAudioTrack(adapter_2, new_capturer, NULL)); new WebRtcLocalAudioTrack(adapter_2.get(), new_capturer, NULL));
track_2->Start(); track_2->Start();
// Verify the data flow by connecting the |sink_2| to |track_2|. // Verify the data flow by connecting the |sink_2| to |track_2|.
...@@ -505,7 +505,7 @@ TEST_F(WebRtcLocalAudioTrackTest, TrackWorkWithSmallBufferSize) { ...@@ -505,7 +505,7 @@ TEST_F(WebRtcLocalAudioTrackTest, TrackWorkWithSmallBufferSize) {
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
scoped_ptr<WebRtcLocalAudioTrack> track( scoped_ptr<WebRtcLocalAudioTrack> track(
new WebRtcLocalAudioTrack(adapter, capturer, NULL)); new WebRtcLocalAudioTrack(adapter.get(), capturer, NULL));
track->Start(); track->Start();
// Verify the data flow by connecting the |sink| to |track|. // Verify the data flow by connecting the |sink| to |track|.
...@@ -526,7 +526,7 @@ TEST_F(WebRtcLocalAudioTrackTest, TrackWorkWithSmallBufferSize) { ...@@ -526,7 +526,7 @@ TEST_F(WebRtcLocalAudioTrackTest, TrackWorkWithSmallBufferSize) {
EXPECT_EQ(expected_buffer_size, sink->audio_params().frames_per_buffer()); EXPECT_EQ(expected_buffer_size, sink->audio_params().frames_per_buffer());
// Stopping the new source will stop the second track. // Stopping the new source will stop the second track.
EXPECT_CALL(*source, OnStop()).Times(1); EXPECT_CALL(*source.get(), OnStop()).Times(1);
capturer->Stop(); capturer->Stop();
// Even though this test don't use |capturer_source_| it will be stopped // Even though this test don't use |capturer_source_| it will be stopped
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment