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

Side by Side Diff: chrome/renderer/media/cast_transport_sender_ipc.cc

Issue 281453003: Cast: Simplify code path for RTCP sender report (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 6 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/renderer/media/cast_transport_sender_ipc.h" 5 #include "chrome/renderer/media/cast_transport_sender_ipc.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "chrome/common/cast_messages.h" 9 #include "chrome/common/cast_messages.h"
10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void CastTransportSenderIPC::InsertCodedVideoFrame( 56 void CastTransportSenderIPC::InsertCodedVideoFrame(
57 const media::cast::transport::EncodedVideoFrame* video_frame, 57 const media::cast::transport::EncodedVideoFrame* video_frame,
58 const base::TimeTicks& capture_time) { 58 const base::TimeTicks& capture_time) {
59 Send(new CastHostMsg_InsertCodedVideoFrame(channel_id_, 59 Send(new CastHostMsg_InsertCodedVideoFrame(channel_id_,
60 *video_frame, 60 *video_frame,
61 capture_time)); 61 capture_time));
62 } 62 }
63 63
64 void CastTransportSenderIPC::SendRtcpFromRtpSender( 64 void CastTransportSenderIPC::SendRtcpFromRtpSender(
65 uint32 packet_type_flags, 65 uint32 packet_type_flags,
66 const media::cast::transport::RtcpSenderInfo& sender_info, 66 uint32 ntp_seconds,
67 uint32 ntp_fraction,
68 uint32 rtp_timestamp,
67 const media::cast::transport::RtcpDlrrReportBlock& dlrr, 69 const media::cast::transport::RtcpDlrrReportBlock& dlrr,
68 uint32 sending_ssrc, 70 uint32 sending_ssrc,
69 const std::string& c_name) { 71 const std::string& c_name) {
70 struct media::cast::transport::SendRtcpFromRtpSenderData data; 72 struct media::cast::transport::SendRtcpFromRtpSenderData data;
71 data.packet_type_flags = packet_type_flags; 73 data.packet_type_flags = packet_type_flags;
72 data.sending_ssrc = sending_ssrc; 74 data.sending_ssrc = sending_ssrc;
73 data.c_name = c_name; 75 data.c_name = c_name;
76 data.ntp_seconds = ntp_seconds;
77 data.ntp_fraction = ntp_fraction;
78 data.rtp_timestamp = rtp_timestamp;
74 Send(new CastHostMsg_SendRtcpFromRtpSender( 79 Send(new CastHostMsg_SendRtcpFromRtpSender(
75 channel_id_, 80 channel_id_,
76 data, 81 data,
77 sender_info,
78 dlrr)); 82 dlrr));
79 } 83 }
80 84
81 void CastTransportSenderIPC::ResendPackets( 85 void CastTransportSenderIPC::ResendPackets(
82 bool is_audio, 86 bool is_audio,
83 const media::cast::MissingFramesAndPacketsMap& missing_packets) { 87 const media::cast::MissingFramesAndPacketsMap& missing_packets) {
84 Send(new CastHostMsg_ResendPackets(channel_id_, 88 Send(new CastHostMsg_ResendPackets(channel_id_,
85 is_audio, 89 is_audio,
86 missing_packets)); 90 missing_packets));
87 } 91 }
88 92
89 void CastTransportSenderIPC::SubscribeAudioRtpStatsCallback(
90 const media::cast::transport::CastTransportRtpStatistics& callback) {
91 audio_rtp_callback_ = callback;
92 }
93
94 void CastTransportSenderIPC::SubscribeVideoRtpStatsCallback(
95 const media::cast::transport::CastTransportRtpStatistics& callback) {
96 video_rtp_callback_ = callback;
97 }
98
99
100 void CastTransportSenderIPC::OnReceivedPacket( 93 void CastTransportSenderIPC::OnReceivedPacket(
101 const media::cast::Packet& packet) { 94 const media::cast::Packet& packet) {
102 if (!packet_callback_.is_null()) { 95 if (!packet_callback_.is_null()) {
103 // TODO(hubbe): Perhaps an non-ownership-transferring cb here? 96 // TODO(hubbe): Perhaps an non-ownership-transferring cb here?
104 scoped_ptr<media::cast::transport::Packet> packet_copy( 97 scoped_ptr<media::cast::transport::Packet> packet_copy(
105 new media::cast::transport::Packet(packet)); 98 new media::cast::transport::Packet(packet));
106 packet_callback_.Run(packet_copy.Pass()); 99 packet_callback_.Run(packet_copy.Pass());
107 } else { 100 } else {
108 DVLOG(1) << "CastIPCDispatcher::OnReceivedPacket no packet callback yet."; 101 DVLOG(1) << "CastIPCDispatcher::OnReceivedPacket no packet callback yet.";
109 } 102 }
110 } 103 }
111 104
112 void CastTransportSenderIPC::OnNotifyStatusChange( 105 void CastTransportSenderIPC::OnNotifyStatusChange(
113 media::cast::transport::CastTransportStatus status) { 106 media::cast::transport::CastTransportStatus status) {
114 status_callback_.Run(status); 107 status_callback_.Run(status);
115 } 108 }
116 109
117 void CastTransportSenderIPC::OnRtpStatistics(
118 bool audio,
119 const media::cast::transport::RtcpSenderInfo& sender_info,
120 base::TimeTicks time_sent,
121 uint32 rtp_timestamp) {
122 const media::cast::transport::CastTransportRtpStatistics& callback =
123 audio ? audio_rtp_callback_ : video_rtp_callback_;
124 callback.Run(sender_info, time_sent, rtp_timestamp);
125 }
126
127 void CastTransportSenderIPC::OnRawEvents( 110 void CastTransportSenderIPC::OnRawEvents(
128 const std::vector<media::cast::PacketEvent>& packet_events) { 111 const std::vector<media::cast::PacketEvent>& packet_events) {
129 raw_events_callback_.Run(packet_events); 112 raw_events_callback_.Run(packet_events);
130 } 113 }
131 114
132 void CastTransportSenderIPC::Send(IPC::Message* message) { 115 void CastTransportSenderIPC::Send(IPC::Message* message) {
133 if (CastIPCDispatcher::Get()) { 116 if (CastIPCDispatcher::Get()) {
134 CastIPCDispatcher::Get()->Send(message); 117 CastIPCDispatcher::Get()->Send(message);
135 } else { 118 } else {
136 delete message; 119 delete message;
137 } 120 }
138 } 121 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_transport_sender_ipc.h ('k') | media/cast/audio_sender/audio_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698