| Index: chrome/browser/media/cast_transport_host_filter.cc
|
| diff --git a/chrome/browser/media/cast_transport_host_filter.cc b/chrome/browser/media/cast_transport_host_filter.cc
|
| index fe5ccacd41a32078a547185cc1627122ad3ff3ae..d39c51f89c4b01a2238c7cae7e7315982978ced1 100644
|
| --- a/chrome/browser/media/cast_transport_host_filter.cc
|
| +++ b/chrome/browser/media/cast_transport_host_filter.cc
|
| @@ -7,11 +7,9 @@
|
|
|
| namespace cast {
|
|
|
| -CastTransportHostFilter::CastTransportHostFilter() {
|
| -}
|
| +CastTransportHostFilter::CastTransportHostFilter() {}
|
|
|
| -CastTransportHostFilter::~CastTransportHostFilter() {
|
| -}
|
| +CastTransportHostFilter::~CastTransportHostFilter() {}
|
|
|
| bool CastTransportHostFilter::OnMessageReceived(const IPC::Message& message,
|
| bool* message_was_ok) {
|
| @@ -50,46 +48,32 @@ void CastTransportHostFilter::ReceivedRtpStatistics(
|
| const media::cast::transport::RtcpSenderInfo& sender_info,
|
| base::TimeTicks time_sent,
|
| uint32 rtp_timestamp) {
|
| - Send(new CastMsg_RtpStatistics(channel_id,
|
| - audio,
|
| - sender_info,
|
| - time_sent,
|
| - rtp_timestamp));
|
| + Send(new CastMsg_RtpStatistics(
|
| + channel_id, audio, sender_info, time_sent, rtp_timestamp));
|
| }
|
|
|
| -void CastTransportHostFilter::OnNew(
|
| - int32 channel_id,
|
| - const media::cast::transport::CastTransportConfig& config) {
|
| - media::cast::transport::CastTransportSender* sender =
|
| - id_map_.Lookup(channel_id);
|
| - if (sender) {
|
| +void CastTransportHostFilter::OnNew(int32 channel_id,
|
| + const net::IPEndPoint& local_end_point,
|
| + const net::IPEndPoint& remote_end_point) {
|
| + if (id_map_.Lookup(channel_id)) {
|
| id_map_.Remove(channel_id);
|
| }
|
|
|
| - sender = media::cast::transport::CastTransportSender::
|
| - CreateCastTransportSender(
|
| + scoped_ptr<media::cast::transport::CastTransportSender> sender =
|
| + media::cast::transport::CastTransportSender::Create(
|
| &clock_,
|
| - config,
|
| + local_end_point,
|
| + remote_end_point,
|
| base::Bind(&CastTransportHostFilter::NotifyStatusChange,
|
| base::Unretained(this),
|
| channel_id),
|
| base::MessageLoopProxy::current());
|
| - sender->SetPacketReceiver(
|
| - base::Bind(&CastTransportHostFilter::ReceivedPacket,
|
| - base::Unretained(this),
|
| - channel_id));
|
| - sender->SubscribeAudioRtpStatsCallback(
|
| - base::Bind(&CastTransportHostFilter::ReceivedRtpStatistics,
|
| - base::Unretained(this),
|
| - channel_id,
|
| - true /* audio */));
|
| - sender->SubscribeVideoRtpStatsCallback(
|
| - base::Bind(&CastTransportHostFilter::ReceivedRtpStatistics,
|
| - base::Unretained(this),
|
| - channel_id,
|
| - false /* not audio */));
|
|
|
| - id_map_.AddWithID(sender, channel_id);
|
| + sender->SetPacketReceiver(base::Bind(&CastTransportHostFilter::ReceivedPacket,
|
| + base::Unretained(this),
|
| + channel_id));
|
| +
|
| + id_map_.AddWithID(sender.release(), channel_id);
|
| }
|
|
|
| void CastTransportHostFilter::OnDelete(int32 channel_id) {
|
| @@ -103,6 +87,42 @@ void CastTransportHostFilter::OnDelete(int32 channel_id) {
|
| }
|
| }
|
|
|
| +void CastTransportHostFilter::OnInitializeAudio(
|
| + int32 channel_id,
|
| + const media::cast::transport::CastTransportAudioConfig& config) {
|
| + media::cast::transport::CastTransportSender* sender =
|
| + id_map_.Lookup(channel_id);
|
| + if (sender) {
|
| + sender->InitializeAudio(config);
|
| + sender->SubscribeAudioRtpStatsCallback(
|
| + base::Bind(&CastTransportHostFilter::ReceivedRtpStatistics,
|
| + base::Unretained(this),
|
| + channel_id,
|
| + true /* audio */));
|
| + } else {
|
| + DVLOG(1)
|
| + << "CastTransportHostFilter::OnInitializeAudio on non-existing channel";
|
| + }
|
| +}
|
| +
|
| +void CastTransportHostFilter::OnInitializeVideo(
|
| + int32 channel_id,
|
| + const media::cast::transport::CastTransportVideoConfig& config) {
|
| + media::cast::transport::CastTransportSender* sender =
|
| + id_map_.Lookup(channel_id);
|
| + if (sender) {
|
| + sender->InitializeVideo(config);
|
| + sender->SubscribeVideoRtpStatsCallback(
|
| + base::Bind(&CastTransportHostFilter::ReceivedRtpStatistics,
|
| + base::Unretained(this),
|
| + channel_id,
|
| + false /* not audio */));
|
| + } else {
|
| + DVLOG(1)
|
| + << "CastTransportHostFilter::OnInitializeVideo on non-existing channel";
|
| + }
|
| +}
|
| +
|
| void CastTransportHostFilter::OnInsertCodedAudioFrame(
|
| int32 channel_id,
|
| const media::cast::transport::EncodedAudioFrame& audio_frame,
|
|
|