| 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 #ifndef MEDIA_CAST_CAST_CONFIG_H_ | 5 #ifndef MEDIA_CAST_CAST_CONFIG_H_ |
| 6 #define MEDIA_CAST_CAST_CONFIG_H_ | 6 #define MEDIA_CAST_CAST_CONFIG_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "media/cast/cast_defines.h" | 17 #include "media/cast/cast_defines.h" |
| 18 #include "media/cast/transport/cast_transport_config.h" | 18 #include "media/cast/transport/cast_transport_config.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 class VideoEncodeAccelerator; | 21 class VideoEncodeAccelerator; |
| 22 | 22 |
| 23 namespace cast { | 23 namespace cast { |
| 24 | 24 |
| 25 enum RtcpMode { | 25 enum RtcpMode { |
| 26 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. | 26 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. |
| 27 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. | 27 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // TODO(miu): Merge AudioSenderConfig and VideoSenderConfig and make their |
| 31 // naming/documentation consistent with FrameReceiverConfig. |
| 30 struct AudioSenderConfig { | 32 struct AudioSenderConfig { |
| 31 AudioSenderConfig(); | 33 AudioSenderConfig(); |
| 32 | 34 |
| 33 // The sender ssrc is in rtp_config.ssrc. | 35 // The sender ssrc is in rtp_config.ssrc. |
| 34 uint32 incoming_feedback_ssrc; | 36 uint32 incoming_feedback_ssrc; |
| 35 | 37 |
| 36 int rtcp_interval; | 38 int rtcp_interval; |
| 37 std::string rtcp_c_name; | 39 std::string rtcp_c_name; |
| 38 RtcpMode rtcp_mode; | 40 RtcpMode rtcp_mode; |
| 39 | 41 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 int min_bitrate; | 69 int min_bitrate; |
| 68 int start_bitrate; | 70 int start_bitrate; |
| 69 int max_qp; | 71 int max_qp; |
| 70 int min_qp; | 72 int min_qp; |
| 71 int max_frame_rate; | 73 int max_frame_rate; |
| 72 int max_number_of_video_buffers_used; // Max value depend on codec. | 74 int max_number_of_video_buffers_used; // Max value depend on codec. |
| 73 transport::VideoCodec codec; | 75 transport::VideoCodec codec; |
| 74 int number_of_encode_threads; | 76 int number_of_encode_threads; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 struct AudioReceiverConfig { | 79 // TODO(miu): Naming and minor type changes are badly needed in a later CL. |
| 78 AudioReceiverConfig(); | 80 struct FrameReceiverConfig { |
| 81 FrameReceiverConfig(); |
| 82 ~FrameReceiverConfig(); |
| 79 | 83 |
| 80 uint32 feedback_ssrc; | 84 // The receiver's SSRC identifier. |
| 81 uint32 incoming_ssrc; | 85 uint32 feedback_ssrc; // TODO(miu): Rename to receiver_ssrc for clarity. |
| 82 | 86 |
| 87 // The sender's SSRC identifier. |
| 88 uint32 incoming_ssrc; // TODO(miu): Rename to sender_ssrc for clarity. |
| 89 |
| 90 // Mean interval (in milliseconds) between RTCP reports. |
| 91 // TODO(miu): Remove this since it's never not kDefaultRtcpIntervalMs. |
| 83 int rtcp_interval; | 92 int rtcp_interval; |
| 93 |
| 94 // CNAME representing this receiver. |
| 95 // TODO(miu): Remove this since it should be derived elsewhere (probably in |
| 96 // the transport layer). |
| 84 std::string rtcp_c_name; | 97 std::string rtcp_c_name; |
| 98 |
| 99 // Determines amount of detail in RTCP reports. |
| 100 // TODO(miu): Remove this since it's never anything but kRtcpReducedSize. |
| 85 RtcpMode rtcp_mode; | 101 RtcpMode rtcp_mode; |
| 86 | 102 |
| 87 // The time the receiver is prepared to wait for retransmissions. | 103 // The total amount of time between a frame's capture/recording on the sender |
| 88 int rtp_max_delay_ms; | 104 // and its playback on the receiver (i.e., shown to a user). This is fixed as |
| 105 // a value large enough to give the system sufficient time to encode, |
| 106 // transmit/retransmit, receive, decode, and render; given its run-time |
| 107 // environment (sender/receiver hardware performance, network conditions, |
| 108 // etc.). |
| 109 int rtp_max_delay_ms; // TODO(miu): Change to TimeDelta target_playout_delay. |
| 110 |
| 111 // RTP payload type enum: Specifies the type/encoding of frame data. |
| 89 int rtp_payload_type; | 112 int rtp_payload_type; |
| 90 | 113 |
| 91 bool use_external_decoder; | 114 // RTP timebase: The number of RTP units advanced per one second. For audio, |
| 92 int frequency; | 115 // this is the sampling rate. For video, by convention, this is 90 kHz. |
| 116 int frequency; // TODO(miu): Rename to rtp_timebase for clarity. |
| 117 |
| 118 // Number of channels. For audio, this is normally 2. For video, this must |
| 119 // be 1 as Cast does not have support for stereoscopic video. |
| 93 int channels; | 120 int channels; |
| 94 transport::AudioCodec codec; | |
| 95 | 121 |
| 96 std::string aes_key; // Binary string of size kAesKeySize. | 122 // The target frame rate. For audio, this is normally 100 (i.e., frames have |
| 97 std::string aes_iv_mask; // Binary string of size kAesKeySize. | 123 // a duration of 10ms each). For video, this is normally 30, but any frame |
| 98 }; | 124 // rate is supported. |
| 125 int max_frame_rate; // TODO(miu): Rename to target_frame_rate. |
| 99 | 126 |
| 100 struct VideoReceiverConfig { | 127 // Codec used for the compression of signal data. |
| 101 VideoReceiverConfig(); | 128 // TODO(miu): Merge the AudioCodec and VideoCodec enums into one so this union |
| 129 // is not necessary. |
| 130 union MergedCodecPlaceholder { |
| 131 transport::AudioCodec audio; |
| 132 transport::VideoCodec video; |
| 133 MergedCodecPlaceholder() : audio(transport::kUnknownAudioCodec) {} |
| 134 } codec; |
| 102 | 135 |
| 103 uint32 feedback_ssrc; | 136 // The AES crypto key and initialization vector. Each of these strings |
| 104 uint32 incoming_ssrc; | 137 // contains the data in binary form, of size kAesKeySize. If they are empty |
| 105 | 138 // strings, crypto is not being used. |
| 106 int rtcp_interval; | 139 std::string aes_key; |
| 107 std::string rtcp_c_name; | 140 std::string aes_iv_mask; |
| 108 RtcpMode rtcp_mode; | |
| 109 | |
| 110 // The time the receiver is prepared to wait for retransmissions. | |
| 111 int rtp_max_delay_ms; | |
| 112 int rtp_payload_type; | |
| 113 | |
| 114 bool use_external_decoder; | |
| 115 int max_frame_rate; | |
| 116 | |
| 117 // Some HW decoders can not run faster than the frame rate, preventing it | |
| 118 // from catching up after a glitch. | |
| 119 bool decoder_faster_than_max_frame_rate; | |
| 120 transport::VideoCodec codec; | |
| 121 | |
| 122 std::string aes_key; // Binary string of size kAesKeySize. | |
| 123 std::string aes_iv_mask; // Binary string of size kAesKeySize. | |
| 124 }; | 141 }; |
| 125 | 142 |
| 126 // import from media::cast::transport | 143 // import from media::cast::transport |
| 127 typedef transport::Packet Packet; | 144 typedef transport::Packet Packet; |
| 128 typedef transport::PacketList PacketList; | 145 typedef transport::PacketList PacketList; |
| 129 | 146 |
| 130 typedef base::Callback<void(CastInitializationStatus)> | 147 typedef base::Callback<void(CastInitializationStatus)> |
| 131 CastInitializationCallback; | 148 CastInitializationCallback; |
| 132 | 149 |
| 133 typedef base::Callback<void(scoped_refptr<base::SingleThreadTaskRunner>, | 150 typedef base::Callback<void(scoped_refptr<base::SingleThreadTaskRunner>, |
| 134 scoped_ptr<media::VideoEncodeAccelerator>)> | 151 scoped_ptr<media::VideoEncodeAccelerator>)> |
| 135 ReceiveVideoEncodeAcceleratorCallback; | 152 ReceiveVideoEncodeAcceleratorCallback; |
| 136 typedef base::Callback<void(const ReceiveVideoEncodeAcceleratorCallback&)> | 153 typedef base::Callback<void(const ReceiveVideoEncodeAcceleratorCallback&)> |
| 137 CreateVideoEncodeAcceleratorCallback; | 154 CreateVideoEncodeAcceleratorCallback; |
| 138 | 155 |
| 139 typedef base::Callback<void(scoped_ptr<base::SharedMemory>)> | 156 typedef base::Callback<void(scoped_ptr<base::SharedMemory>)> |
| 140 ReceiveVideoEncodeMemoryCallback; | 157 ReceiveVideoEncodeMemoryCallback; |
| 141 typedef base::Callback<void(size_t size, | 158 typedef base::Callback<void(size_t size, |
| 142 const ReceiveVideoEncodeMemoryCallback&)> | 159 const ReceiveVideoEncodeMemoryCallback&)> |
| 143 CreateVideoEncodeMemoryCallback; | 160 CreateVideoEncodeMemoryCallback; |
| 144 | 161 |
| 145 } // namespace cast | 162 } // namespace cast |
| 146 } // namespace media | 163 } // namespace media |
| 147 | 164 |
| 148 #endif // MEDIA_CAST_CAST_CONFIG_H_ | 165 #endif // MEDIA_CAST_CAST_CONFIG_H_ |
| OLD | NEW |