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_
11 #include "base/basictypes.h"
12 #include "media/cast/cast_defines.h"
18 kRtcpCompound
, // Compound RTCP mode is described by RFC 4585.
19 kRtcpReducedSize
, // Reduced-size RTCP mode is described by RFC 5506.
34 struct AudioSenderConfig
{
38 uint32 incoming_feedback_ssrc
;
41 std::string rtcp_c_name
;
44 int rtp_history_ms
; // The time RTP packets are stored for retransmissions.
48 bool use_external_encoder
;
55 struct VideoSenderConfig
{
59 uint32 incoming_feedback_ssrc
;
62 std::string rtcp_c_name
;
65 int rtp_history_ms
; // The time RTP packets are stored for retransmissions.
69 bool use_external_encoder
;
70 int width
; // Incoming frames will be scaled to this size.
73 float congestion_control_back_off
;
80 int max_number_of_video_buffers_used
; // Max value depend on codec.
85 struct AudioReceiverConfig
{
86 AudioReceiverConfig();
92 std::string rtcp_c_name
;
95 // The time the receiver is prepared to wait for retransmissions.
99 bool use_external_decoder
;
105 struct VideoReceiverConfig
{
106 VideoReceiverConfig();
108 uint32 feedback_ssrc
;
109 uint32 incoming_ssrc
;
112 std::string rtcp_c_name
;
115 // The time the receiver is prepared to wait for retransmissions.
116 int rtp_max_delay_ms
;
117 int rtp_payload_type
;
119 bool use_external_decoder
;
122 // Some HW decoders can not run faster than the frame rate, preventing it
123 // from catching up after a glitch.
124 bool decoder_faster_than_max_frame_rate
;
128 struct I420VideoPlane
{
134 struct I420VideoFrame
{
137 I420VideoPlane y_plane
;
138 I420VideoPlane u_plane
;
139 I420VideoPlane v_plane
;
142 struct EncodedVideoFrame
{
144 ~EncodedVideoFrame();
149 uint8 last_referenced_frame_id
;
150 std::vector
<uint8
> data
;
153 struct PcmAudioFrame
{
157 int channels
; // Samples in interleaved stereo format. L0, R0, L1 ,R1 ,...
159 std::vector
<int16
> samples
;
162 struct EncodedAudioFrame
{
164 ~EncodedAudioFrame();
167 uint8 frame_id
; // Needed to release the frame. Not used send side.
168 int samples
; // Needed send side to advance the RTP timestamp.
169 // Not used receive side.
170 std::vector
<uint8
> data
;
175 // All packets to be sent to the network will be delivered via this function.
176 virtual bool SendPacket(const uint8
* packet
, int length
) = 0;
179 virtual ~PacketSender() {}
182 class PacketReceiver
{
184 // All packets received from the network should be delivered via this
186 virtual void ReceivedPacket(const uint8
* packet
, int length
) = 0;
189 virtual ~PacketReceiver() {}
192 class VideoEncoderController
{
194 // Inform the encoder about the new target bit rate.
195 virtual void SetBitRate(int new_bit_rate
) = 0;
197 // Inform the encoder to not encode the next frame.
198 // Note: this setting is sticky and should last until called with false.
199 virtual void SkipNextFrame(bool skip_next_frame
) = 0;
201 // Inform the encoder to encode the next frame as a key frame.
202 virtual void GenerateKeyFrame() = 0;
204 // Inform the encoder to only reference frames older or equal to frame_id;
205 virtual void LatestFrameIdToReference(uint8 frame_id
) = 0;
207 // Query the codec about how many frames it has skipped due to slow ACK.
208 virtual int NumberOfSkippedFrames() const = 0;
211 virtual ~VideoEncoderController() {}
217 #endif // MEDIA_CAST_CAST_CONFIG_H_