• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 // TODO(pbos): Move Config from common.h to here.
12 
13 #ifndef WEBRTC_CONFIG_H_
14 #define WEBRTC_CONFIG_H_
15 
16 #include <string>
17 #include <vector>
18 
19 #include "webrtc/common_types.h"
20 #include "webrtc/typedefs.h"
21 
22 namespace webrtc {
23 
24 struct RtpStatistics {
RtpStatisticsRtpStatistics25   RtpStatistics()
26       : ssrc(0),
27         fraction_loss(0),
28         cumulative_loss(0),
29         extended_max_sequence_number(0) {}
30   uint32_t ssrc;
31   int fraction_loss;
32   int cumulative_loss;
33   int extended_max_sequence_number;
34 };
35 
36 struct StreamStats {
StreamStatsStreamStats37   StreamStats()
38       : key_frames(0),
39         delta_frames(0),
40         bitrate_bps(0),
41         avg_delay_ms(0),
42         max_delay_ms(0) {}
43   uint32_t key_frames;
44   uint32_t delta_frames;
45   int32_t bitrate_bps;
46   int avg_delay_ms;
47   int max_delay_ms;
48   StreamDataCounters rtp_stats;
49   RtcpStatistics rtcp_stats;
50 };
51 
52 // Settings for NACK, see RFC 4585 for details.
53 struct NackConfig {
NackConfigNackConfig54   NackConfig() : rtp_history_ms(0) {}
55   // Send side: the time RTP packets are stored for retransmissions.
56   // Receive side: the time the receiver is prepared to wait for
57   // retransmissions.
58   // Set to '0' to disable.
59   int rtp_history_ms;
60 };
61 
62 // Settings for forward error correction, see RFC 5109 for details. Set the
63 // payload types to '-1' to disable.
64 struct FecConfig {
FecConfigFecConfig65   FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
66   std::string ToString() const;
67   // Payload type used for ULPFEC packets.
68   int ulpfec_payload_type;
69 
70   // Payload type used for RED packets.
71   int red_payload_type;
72 };
73 
74 // RTP header extension to use for the video stream, see RFC 5285.
75 struct RtpExtension {
RtpExtensionRtpExtension76   RtpExtension(const std::string& name, int id) : name(name), id(id) {}
77   std::string ToString() const;
78   static bool IsSupported(const std::string& name);
79 
80   static const char* kTOffset;
81   static const char* kAbsSendTime;
82   std::string name;
83   int id;
84 };
85 
86 struct VideoStream {
VideoStreamVideoStream87   VideoStream()
88       : width(0),
89         height(0),
90         max_framerate(-1),
91         min_bitrate_bps(-1),
92         target_bitrate_bps(-1),
93         max_bitrate_bps(-1),
94         max_qp(-1) {}
95   std::string ToString() const;
96 
97   size_t width;
98   size_t height;
99   int max_framerate;
100 
101   int min_bitrate_bps;
102   int target_bitrate_bps;
103   int max_bitrate_bps;
104 
105   int max_qp;
106 
107   // Bitrate thresholds for enabling additional temporal layers.
108   std::vector<int> temporal_layers;
109 };
110 
111 struct VideoEncoderConfig {
112   enum ContentType {
113     kRealtimeVideo,
114     kScreenshare,
115   };
116 
VideoEncoderConfigVideoEncoderConfig117   VideoEncoderConfig()
118       : content_type(kRealtimeVideo), encoder_specific_settings(NULL) {}
119 
120   std::vector<VideoStream> streams;
121   ContentType content_type;
122   void* encoder_specific_settings;
123 };
124 
125 }  // namespace webrtc
126 
127 #endif  // WEBRTC_CONFIG_H_
128