OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/cast/transport/rtp_sender/rtp_sender.h" | 5 #include "media/cast/transport/rtp_sender/rtp_sender.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "media/cast/transport/cast_transport_defines.h" | 9 #include "media/cast/transport/cast_transport_defines.h" |
10 #include "media/cast/transport/pacing/paced_sender.h" | 10 #include "media/cast/transport/pacing/paced_sender.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 config_.audio = false; | 55 config_.audio = false; |
56 config_.ssrc = config.rtp.config.ssrc; | 56 config_.ssrc = config.rtp.config.ssrc; |
57 config_.payload_type = config.rtp.config.payload_type; | 57 config_.payload_type = config.rtp.config.payload_type; |
58 config_.frequency = kVideoFrequency; | 58 config_.frequency = kVideoFrequency; |
59 config_.video_codec = config.codec; | 59 config_.video_codec = config.codec; |
60 packetizer_.reset(new RtpPacketizer(transport_, storage_.get(), config_)); | 60 packetizer_.reset(new RtpPacketizer(transport_, storage_.get(), config_)); |
61 return true; | 61 return true; |
62 } | 62 } |
63 | 63 |
64 void RtpSender::IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, | 64 void RtpSender::SendFrame(const EncodedFrame& frame) { |
65 const base::TimeTicks& capture_time) { | |
66 DCHECK(packetizer_); | 65 DCHECK(packetizer_); |
67 packetizer_->IncomingEncodedVideoFrame(video_frame, capture_time); | 66 packetizer_->SendFrameAsPackets(frame); |
68 } | |
69 | |
70 void RtpSender::IncomingEncodedAudioFrame( | |
71 const EncodedAudioFrame* audio_frame, | |
72 const base::TimeTicks& recorded_time) { | |
73 DCHECK(packetizer_); | |
74 packetizer_->IncomingEncodedAudioFrame(audio_frame, recorded_time); | |
75 } | 67 } |
76 | 68 |
77 void RtpSender::ResendPackets( | 69 void RtpSender::ResendPackets( |
78 const MissingFramesAndPacketsMap& missing_frames_and_packets) { | 70 const MissingFramesAndPacketsMap& missing_frames_and_packets) { |
79 DCHECK(storage_); | 71 DCHECK(storage_); |
80 // Iterate over all frames in the list. | 72 // Iterate over all frames in the list. |
81 for (MissingFramesAndPacketsMap::const_iterator it = | 73 for (MissingFramesAndPacketsMap::const_iterator it = |
82 missing_frames_and_packets.begin(); | 74 missing_frames_and_packets.begin(); |
83 it != missing_frames_and_packets.end(); | 75 it != missing_frames_and_packets.end(); |
84 ++it) { | 76 ++it) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp); | 154 packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp); |
163 sender_info.send_packet_count = packetizer_->send_packets_count(); | 155 sender_info.send_packet_count = packetizer_->send_packets_count(); |
164 sender_info.send_octet_count = packetizer_->send_octet_count(); | 156 sender_info.send_octet_count = packetizer_->send_octet_count(); |
165 stats_callback_.Run(sender_info, time_sent, rtp_timestamp); | 157 stats_callback_.Run(sender_info, time_sent, rtp_timestamp); |
166 ScheduleNextStatsReport(); | 158 ScheduleNextStatsReport(); |
167 } | 159 } |
168 | 160 |
169 } // namespace transport | 161 } // namespace transport |
170 } // namespace cast | 162 } // namespace cast |
171 } // namespace media | 163 } // namespace media |
OLD | NEW |