OLD | NEW |
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 "media/cast/net/rtp/rtp_sender.h" | 5 #include "media/cast/net/rtp/rtp_sender.h" |
6 | 6 |
7 #include "base/big_endian.h" | 7 #include "base/big_endian.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "media/cast/constants.h" | 10 #include "media/cast/constants.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 transport_task_runner_(transport_task_runner), | 32 transport_task_runner_(transport_task_runner), |
33 weak_factory_(this) { | 33 weak_factory_(this) { |
34 // Randomly set sequence number start value. | 34 // Randomly set sequence number start value. |
35 config_.sequence_number = base::RandInt(0, 65535); | 35 config_.sequence_number = base::RandInt(0, 65535); |
36 } | 36 } |
37 | 37 |
38 RtpSender::~RtpSender() {} | 38 RtpSender::~RtpSender() {} |
39 | 39 |
40 bool RtpSender::Initialize(const CastTransportRtpConfig& config) { | 40 bool RtpSender::Initialize(const CastTransportRtpConfig& config) { |
41 config_.ssrc = config.ssrc; | 41 config_.ssrc = config.ssrc; |
42 config_.payload_type = config.rtp_payload_type; | 42 config_.payload_type = static_cast<int>(config.rtp_payload_type); |
43 packetizer_.reset(new RtpPacketizer(transport_, &storage_, config_)); | 43 packetizer_.reset(new RtpPacketizer(transport_, &storage_, config_)); |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
47 void RtpSender::SendFrame(const EncodedFrame& frame) { | 47 void RtpSender::SendFrame(const EncodedFrame& frame) { |
48 DCHECK(packetizer_); | 48 DCHECK(packetizer_); |
49 packetizer_->SendFrameAsPackets(frame); | 49 packetizer_->SendFrameAsPackets(frame); |
50 LOG_IF(DFATAL, storage_.GetNumberOfStoredFrames() > kMaxUnackedFrames) | 50 LOG_IF(DFATAL, storage_.GetNumberOfStoredFrames() > kMaxUnackedFrames) |
51 << "Possible bug: Frames are not being actively released from storage."; | 51 << "Possible bug: Frames are not being actively released from storage."; |
52 } | 52 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 int64_t RtpSender::GetLastByteSentForFrame(FrameId frame_id) { | 152 int64_t RtpSender::GetLastByteSentForFrame(FrameId frame_id) { |
153 const SendPacketVector* stored_packets = storage_.GetFramePackets(frame_id); | 153 const SendPacketVector* stored_packets = storage_.GetFramePackets(frame_id); |
154 if (!stored_packets) | 154 if (!stored_packets) |
155 return 0; | 155 return 0; |
156 PacketKey last_packet_key = stored_packets->rbegin()->first; | 156 PacketKey last_packet_key = stored_packets->rbegin()->first; |
157 return transport_->GetLastByteSentForPacket(last_packet_key); | 157 return transport_->GetLastByteSentForPacket(last_packet_key); |
158 } | 158 } |
159 | 159 |
160 } // namespace cast | 160 } // namespace cast |
161 } // namespace media | 161 } // namespace media |
OLD | NEW |