#include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h"
#include "content/renderer/media/webrtc_audio_device_impl.h"
#include "content/renderer/media/webrtc_local_audio_track.h"
+#include "content/renderer/media/webrtc_logging.h"
#include "content/renderer/media/webrtc_uma_histograms.h"
#include "content/renderer/p2p/ipc_network_manager.h"
#include "content/renderer/p2p/ipc_socket_factory.h"
PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() {
CleanupPeerConnectionFactory();
- if (aec_dump_message_filter_)
+ if (aec_dump_message_filter_.get())
aec_dump_message_filter_->RemoveDelegate(this);
}
CreateAudioCapturer(render_view_id, device_info, audio_constraints,
source_data));
if (!capturer.get()) {
- DLOG(WARNING) << "Failed to create the capturer for device "
- << device_info.device.id;
+ const std::string log_string =
+ "PCDF::InitializeMediaStreamAudioSource: fails to create capturer";
+ WebRtcLogMessage(log_string);
+ DVLOG(1) << log_string;
// TODO(xians): Don't we need to check if source_observer is observing
// something? If not, then it looks like we have a leak here.
// OTOH, if it _is_ observing something, then the callback might
// be called multiple times which is likely also a bug.
return false;
}
- source_data->SetAudioCapturer(capturer);
+ source_data->SetAudioCapturer(capturer.get());
// Creates a LocalAudioSource object which holds audio options.
// TODO(xians): The option should apply to the track instead of the source.
DLOG(WARNING) << "Failed to create rtc LocalAudioSource.";
return false;
}
- source_data->SetLocalAudioSource(rtc_source);
+ source_data->SetLocalAudioSource(rtc_source.get());
return true;
}
// before we can use an instance of a WebRtcVideoCapturerAdapter. This is
// since the base class of WebRtcVideoCapturerAdapter is a
// cricket::VideoCapturer and it uses the libjingle thread wrappers.
- if (!GetPcFactory())
+ if (!GetPcFactory().get())
return NULL;
return new WebRtcVideoCapturerAdapter(is_screeencast);
}
const scoped_refptr<webrtc::PeerConnectionFactoryInterface>&
PeerConnectionDependencyFactory::GetPcFactory() {
- if (!pc_factory_)
+ if (!pc_factory_.get())
CreatePeerConnectionFactory();
- CHECK(pc_factory_);
+ CHECK(pc_factory_.get());
return pc_factory_;
}
scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories =
RenderThreadImpl::current()->GetGpuFactories();
if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) {
- if (gpu_factories)
+ if (gpu_factories.get())
decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
}
if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
- if (gpu_factories)
+ if (gpu_factories.get())
encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
}
audio_device_.get(),
encoder_factory.release(),
decoder_factory.release()));
- CHECK(factory);
+ CHECK(factory.get());
pc_factory_ = factory;
webrtc::PeerConnectionFactoryInterface::Options factory_options;
// 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
// 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);
}
}
webrtc::PeerConnectionObserver* observer) {
CHECK(web_frame);
CHECK(observer);
- if (!GetPcFactory())
+ if (!GetPcFactory().get())
return NULL;
scoped_refptr<P2PPortAllocatorFactory> pa_factory =
// TODO(xians): Merge |source| to the capturer(). We can't do this today
// because only one capturer() is supported while one |source| is created
// for each audio track.
- scoped_ptr<WebRtcLocalAudioTrack> audio_track(
- new WebRtcLocalAudioTrack(adapter,
- source_data->GetAudioCapturer(),
- webaudio_source));
+ scoped_ptr<WebRtcLocalAudioTrack> audio_track(new WebRtcLocalAudioTrack(
+ adapter.get(), source_data->GetAudioCapturer(), webaudio_source.get()));
StartLocalAudioTrack(audio_track.get());
}
void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
- if (audio_device_)
+ if (audio_device_.get())
return;
audio_device_ = new WebRtcAudioDeviceImpl();