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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_CAST_CONFIG_H_
6 #define MEDIA_CAST_CAST_CONFIG_H_
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "base/memory/ref_counted.h"
15 #include "media/cast/cast_defines.h"
16 #include "media/cast/transport/cast_transport_config.h"
22 kRtcpCompound
, // Compound RTCP mode is described by RFC 4585.
23 kRtcpReducedSize
, // Reduced-size RTCP mode is described by RFC 5506.
26 struct AudioSenderConfig
{
30 uint32 incoming_feedback_ssrc
;
33 std::string rtcp_c_name
;
36 int rtp_history_ms
; // The time RTP packets are stored for retransmissions.
40 bool use_external_encoder
;
43 int bitrate
; // Set to <= 0 for "auto variable bitrate" (libopus knows best).
44 transport::AudioCodec codec
;
46 std::string aes_key
; // Binary string of size kAesKeySize.
47 std::string aes_iv_mask
; // Binary string of size kAesKeySize.
50 struct VideoSenderConfig
{
54 uint32 incoming_feedback_ssrc
;
57 std::string rtcp_c_name
;
60 int rtp_history_ms
; // The time RTP packets are stored for retransmissions.
64 bool use_external_encoder
;
65 int width
; // Incoming frames will be scaled to this size.
68 float congestion_control_back_off
;
75 int max_number_of_video_buffers_used
; // Max value depend on codec.
76 transport::VideoCodec codec
;
79 std::string aes_key
; // Binary string of size kAesKeySize.
80 std::string aes_iv_mask
; // Binary string of size kAesKeySize.
83 struct AudioReceiverConfig
{
84 AudioReceiverConfig();
90 std::string rtcp_c_name
;
93 // The time the receiver is prepared to wait for retransmissions.
97 bool use_external_decoder
;
100 transport::AudioCodec codec
;
102 std::string aes_key
; // Binary string of size kAesKeySize.
103 std::string aes_iv_mask
; // Binary string of size kAesKeySize.
106 struct VideoReceiverConfig
{
107 VideoReceiverConfig();
109 uint32 feedback_ssrc
;
110 uint32 incoming_ssrc
;
113 std::string rtcp_c_name
;
116 // The time the receiver is prepared to wait for retransmissions.
117 int rtp_max_delay_ms
;
118 int rtp_payload_type
;
120 bool use_external_decoder
;
123 // Some HW decoders can not run faster than the frame rate, preventing it
124 // from catching up after a glitch.
125 bool decoder_faster_than_max_frame_rate
;
126 transport::VideoCodec codec
;
128 std::string aes_key
; // Binary string of size kAesKeySize.
129 std::string aes_iv_mask
; // Binary string of size kAesKeySize.
132 // DEPRECATED: Do not use in new code. Please migrate existing code to use
134 struct PcmAudioFrame
{
138 int channels
; // Samples in interleaved stereo format. L0, R0, L1 ,R1 ,...
140 std::vector
<int16
> samples
;
143 typedef std::vector
<uint8
> Packet
;
144 typedef std::vector
<Packet
> PacketList
;
148 // All packets to be sent to the network will be delivered via these
150 virtual bool SendPackets(const PacketList
& packets
) = 0;
152 virtual bool SendPacket(const Packet
& packet
) = 0;
154 virtual ~PacketSender() {}
157 class PacketReceiver
: public base::RefCountedThreadSafe
<PacketReceiver
> {
159 // All packets received from the network should be delivered via this
161 virtual void ReceivedPacket(const uint8
* packet
, size_t length
,
162 const base::Closure callback
) = 0;
164 static void DeletePacket(const uint8
* packet
);
167 virtual ~PacketReceiver() {}
170 friend class base::RefCountedThreadSafe
<PacketReceiver
>;
176 #endif // MEDIA_CAST_CAST_CONFIG_H_