| Index: chrome/renderer/media/cast_transport_ipc.cc
|
| diff --git a/chrome/renderer/media/cast_transport_ipc.cc b/chrome/renderer/media/cast_transport_ipc.cc
|
| index 196e244c050d9cb97f60a7fd929c0d2dae86b2d1..8c35f10be36e7909543057c460db832162517aab 100644
|
| --- a/chrome/renderer/media/cast_transport_ipc.cc
|
| +++ b/chrome/renderer/media/cast_transport_ipc.cc
|
| @@ -13,15 +13,10 @@
|
| #include "ipc/ipc_channel_proxy.h"
|
| #include "media/cast/cast_sender.h"
|
|
|
| -CastTransportIPC::ClientCallbacks::ClientCallbacks() {}
|
| -CastTransportIPC::ClientCallbacks::ClientCallbacks(
|
| - const ClientCallbacks& other) = default;
|
| -CastTransportIPC::ClientCallbacks::~ClientCallbacks() {}
|
| -
|
| CastTransportIPC::CastTransportIPC(
|
| const net::IPEndPoint& local_end_point,
|
| const net::IPEndPoint& remote_end_point,
|
| - scoped_ptr<base::DictionaryValue> options,
|
| + std::unique_ptr<base::DictionaryValue> options,
|
| const media::cast::PacketReceiverCallback& packet_callback,
|
| const media::cast::CastTransportStatusCallback& status_cb,
|
| const media::cast::BulkRawEventsCallback& raw_events_cb)
|
| @@ -44,23 +39,17 @@ CastTransportIPC::~CastTransportIPC() {
|
|
|
| void CastTransportIPC::InitializeAudio(
|
| const media::cast::CastTransportRtpConfig& config,
|
| - const media::cast::RtcpCastMessageCallback& cast_message_cb,
|
| - const media::cast::RtcpRttCallback& rtt_cb,
|
| - const media::cast::RtcpPliCallback& pli_cb) {
|
| - clients_[config.ssrc].cast_message_cb = cast_message_cb;
|
| - clients_[config.ssrc].rtt_cb = rtt_cb;
|
| - clients_[config.ssrc].pli_cb = pli_cb;
|
| + std::unique_ptr<media::cast::SenderRtcpObserver> rtcp_observer) {
|
| + DCHECK(clients_.find(config.ssrc) == clients_.end());
|
| + clients_[config.ssrc] = std::move(rtcp_observer);
|
| Send(new CastHostMsg_InitializeAudio(channel_id_, config));
|
| }
|
|
|
| void CastTransportIPC::InitializeVideo(
|
| const media::cast::CastTransportRtpConfig& config,
|
| - const media::cast::RtcpCastMessageCallback& cast_message_cb,
|
| - const media::cast::RtcpRttCallback& rtt_cb,
|
| - const media::cast::RtcpPliCallback& pli_cb) {
|
| - clients_[config.ssrc].cast_message_cb = cast_message_cb;
|
| - clients_[config.ssrc].rtt_cb = rtt_cb;
|
| - clients_[config.ssrc].pli_cb = pli_cb;
|
| + std::unique_ptr<media::cast::SenderRtcpObserver> rtcp_observer) {
|
| + DCHECK(clients_.find(config.ssrc) == clients_.end());
|
| + clients_[config.ssrc] = std::move(rtcp_observer);
|
| Send(new CastHostMsg_InitializeVideo(channel_id_, config));
|
| }
|
|
|
| @@ -138,11 +127,11 @@ void CastTransportIPC::OnRawEvents(
|
| // Note: Casting away const to avoid having to copy all the data elements. As
|
| // the only consumer of this data in the IPC message, mutating the inputs
|
| // should be acceptable. Just nod and blame the interface we were given here.
|
| - scoped_ptr<std::vector<media::cast::FrameEvent>> taken_frame_events(
|
| + std::unique_ptr<std::vector<media::cast::FrameEvent>> taken_frame_events(
|
| new std::vector<media::cast::FrameEvent>());
|
| taken_frame_events->swap(
|
| const_cast<std::vector<media::cast::FrameEvent>&>(frame_events));
|
| - scoped_ptr<std::vector<media::cast::PacketEvent>> taken_packet_events(
|
| + std::unique_ptr<std::vector<media::cast::PacketEvent>> taken_packet_events(
|
| new std::vector<media::cast::PacketEvent>());
|
| taken_packet_events->swap(
|
| const_cast<std::vector<media::cast::PacketEvent>&>(packet_events));
|
| @@ -156,8 +145,7 @@ void CastTransportIPC::OnRtt(uint32_t rtp_sender_ssrc, base::TimeDelta rtt) {
|
| LOG(ERROR) << "Received RTT report for unknown SSRC: " << rtp_sender_ssrc;
|
| return;
|
| }
|
| - if (!it->second.rtt_cb.is_null())
|
| - it->second.rtt_cb.Run(rtt);
|
| + it->second->OnRttReceived(rtt);
|
| }
|
|
|
| void CastTransportIPC::OnRtcpCastMessage(
|
| @@ -168,9 +156,7 @@ void CastTransportIPC::OnRtcpCastMessage(
|
| LOG(ERROR) << "Received cast message for unknown SSRC: " << rtp_sender_ssrc;
|
| return;
|
| }
|
| - if (it->second.cast_message_cb.is_null())
|
| - return;
|
| - it->second.cast_message_cb.Run(cast_message);
|
| + it->second->OnCastMessageReceived(cast_message);
|
| }
|
|
|
| void CastTransportIPC::OnReceivedPli(uint32_t rtp_sender_ssrc) {
|
| @@ -180,14 +166,13 @@ void CastTransportIPC::OnReceivedPli(uint32_t rtp_sender_ssrc) {
|
| << rtp_sender_ssrc;
|
| return;
|
| }
|
| - if (!it->second.pli_cb.is_null())
|
| - it->second.pli_cb.Run();
|
| + it->second->OnPliReceived();
|
| }
|
|
|
| void CastTransportIPC::OnReceivedPacket(const media::cast::Packet& packet) {
|
| if (!packet_callback_.is_null()) {
|
| // TODO(hubbe): Perhaps an non-ownership-transferring cb here?
|
| - scoped_ptr<media::cast::Packet> packet_copy(
|
| + std::unique_ptr<media::cast::Packet> packet_copy(
|
| new media::cast::Packet(packet));
|
| packet_callback_.Run(std::move(packet_copy));
|
| } else {
|
|
|