| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does | 121 // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does |
| 122 // not take the ownership of |decoder_factory|. The caller needs to make sure | 122 // not take the ownership of |decoder_factory|. The caller needs to make sure |
| 123 // that |decoder_factory| outlives the video engine. | 123 // that |decoder_factory| outlives the video engine. |
| 124 void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory); | 124 void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory); |
| 125 // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does | 125 // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does |
| 126 // not take the ownership of |encoder_factory|. The caller needs to make sure | 126 // not take the ownership of |encoder_factory|. The caller needs to make sure |
| 127 // that |encoder_factory| outlives the video engine. | 127 // that |encoder_factory| outlives the video engine. |
| 128 virtual void SetExternalEncoderFactory( | 128 virtual void SetExternalEncoderFactory( |
| 129 WebRtcVideoEncoderFactory* encoder_factory); | 129 WebRtcVideoEncoderFactory* encoder_factory); |
| 130 | 130 |
| 131 bool EnableTimedRender(); | |
| 132 | |
| 133 bool FindCodec(const VideoCodec& in); | 131 bool FindCodec(const VideoCodec& in); |
| 134 // Check whether the supplied trace should be ignored. | 132 // Check whether the supplied trace should be ignored. |
| 135 bool ShouldIgnoreTrace(const std::string& trace); | 133 bool ShouldIgnoreTrace(const std::string& trace); |
| 136 | 134 |
| 137 private: | 135 private: |
| 138 std::vector<VideoCodec> GetSupportedCodecs() const; | 136 std::vector<VideoCodec> GetSupportedCodecs() const; |
| 139 | 137 |
| 140 std::vector<VideoCodec> video_codecs_; | 138 std::vector<VideoCodec> video_codecs_; |
| 141 | 139 |
| 142 bool initialized_; | 140 bool initialized_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void OnMessage(rtc::Message* msg) override; | 187 void OnMessage(rtc::Message* msg) override; |
| 190 | 188 |
| 191 void OnLoadUpdate(Load load) override; | 189 void OnLoadUpdate(Load load) override; |
| 192 | 190 |
| 193 // Implemented for VideoMediaChannelTest. | 191 // Implemented for VideoMediaChannelTest. |
| 194 bool sending() const { return sending_; } | 192 bool sending() const { return sending_; } |
| 195 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 193 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
| 196 bool GetRenderer(uint32_t ssrc, VideoRenderer** renderer); | 194 bool GetRenderer(uint32_t ssrc, VideoRenderer** renderer); |
| 197 | 195 |
| 198 private: | 196 private: |
| 197 struct VideoCodecSettings { |
| 198 VideoCodecSettings(); |
| 199 |
| 200 bool operator==(const VideoCodecSettings& other) const; |
| 201 bool operator!=(const VideoCodecSettings& other) const; |
| 202 |
| 203 VideoCodec codec; |
| 204 webrtc::FecConfig fec; |
| 205 int rtx_payload_type; |
| 206 }; |
| 207 |
| 208 struct FilteredSendParameters { |
| 209 // These optionals are unset if not changed. |
| 210 rtc::Optional<VideoCodecSettings> codec; |
| 211 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; |
| 212 rtc::Optional<int> max_bandwidth_bps; |
| 213 rtc::Optional<VideoOptions> options; |
| 214 webrtc::RtcpMode rtcp_mode; |
| 215 }; |
| 216 bool FilterSendParameters(const VideoSendParameters& params, |
| 217 FilteredSendParameters* out_params) const; |
| 199 bool MuteStream(uint32_t ssrc, bool mute); | 218 bool MuteStream(uint32_t ssrc, bool mute); |
| 200 class WebRtcVideoReceiveStream; | 219 class WebRtcVideoReceiveStream; |
| 201 | 220 |
| 202 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); | 221 void SetSendCodec(const VideoCodecSettings& codec); |
| 203 bool SetSendRtpHeaderExtensions( | 222 void SetMaxSendBandwidth(int bps); |
| 204 const std::vector<RtpHeaderExtension>& extensions); | 223 void SetOptions(const VideoOptions& options); |
| 205 bool SetMaxSendBandwidth(int bps); | |
| 206 bool SetOptions(const VideoOptions& options); | |
| 207 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); | 224 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); |
| 208 bool SetRecvRtpHeaderExtensions( | 225 bool SetRecvRtpHeaderExtensions( |
| 209 const std::vector<RtpHeaderExtension>& extensions); | 226 const std::vector<RtpHeaderExtension>& extensions); |
| 210 | 227 |
| 211 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 228 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, |
| 212 const StreamParams& sp) const; | 229 const StreamParams& sp) const; |
| 213 bool CodecIsExternallySupported(const std::string& name) const; | 230 bool CodecIsExternallySupported(const std::string& name) const; |
| 214 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 231 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
| 215 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 232 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
| 216 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 233 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
| 217 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 234 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
| 218 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 235 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
| 219 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 236 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
| 220 | 237 |
| 221 struct VideoCodecSettings { | |
| 222 VideoCodecSettings(); | |
| 223 | |
| 224 bool operator==(const VideoCodecSettings& other) const; | |
| 225 bool operator!=(const VideoCodecSettings& other) const; | |
| 226 | |
| 227 VideoCodec codec; | |
| 228 webrtc::FecConfig fec; | |
| 229 int rtx_payload_type; | |
| 230 }; | |
| 231 | |
| 232 static std::string CodecSettingsVectorToString( | 238 static std::string CodecSettingsVectorToString( |
| 233 const std::vector<VideoCodecSettings>& codecs); | 239 const std::vector<VideoCodecSettings>& codecs); |
| 234 | 240 |
| 235 // Wrapper for the sender part, this is where the capturer is connected and | 241 // Wrapper for the sender part, this is where the capturer is connected and |
| 236 // frames are then converted from cricket frames to webrtc frames. | 242 // frames are then converted from cricket frames to webrtc frames. |
| 237 class WebRtcVideoSendStream : public sigslot::has_slots<> { | 243 class WebRtcVideoSendStream : public sigslot::has_slots<> { |
| 238 public: | 244 public: |
| 239 WebRtcVideoSendStream( | 245 WebRtcVideoSendStream( |
| 240 webrtc::Call* call, | 246 webrtc::Call* call, |
| 241 const StreamParams& sp, | 247 const StreamParams& sp, |
| 242 const webrtc::VideoSendStream::Config& config, | 248 const webrtc::VideoSendStream::Config& config, |
| 243 WebRtcVideoEncoderFactory* external_encoder_factory, | 249 WebRtcVideoEncoderFactory* external_encoder_factory, |
| 244 const VideoOptions& options, | 250 const VideoOptions& options, |
| 245 int max_bitrate_bps, | 251 int max_bitrate_bps, |
| 246 const rtc::Optional<VideoCodecSettings>& codec_settings, | 252 const rtc::Optional<VideoCodecSettings>& codec_settings, |
| 247 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 253 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
| 248 const VideoSendParameters& send_params); | 254 const VideoSendParameters& send_params); |
| 249 ~WebRtcVideoSendStream(); | 255 ~WebRtcVideoSendStream(); |
| 250 | 256 |
| 251 void SetOptions(const VideoOptions& options); | 257 void SetOptions(const VideoOptions& options); |
| 252 void SetCodec(const VideoCodecSettings& codec); | 258 // TODO(pbos): Move logic from SetOptions into this method. |
| 253 void SetRtpExtensions( | 259 void SetSendParameters(const FilteredSendParameters& send_params); |
| 254 const std::vector<webrtc::RtpExtension>& rtp_extensions); | |
| 255 // TODO(deadbeef): Move logic from SetCodec/SetRtpExtensions/etc. | |
| 256 // into this method. Currently this method only sets the RTCP mode. | |
| 257 void SetSendParameters(const VideoSendParameters& send_params); | |
| 258 | 260 |
| 259 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame); | 261 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame); |
| 260 bool SetCapturer(VideoCapturer* capturer); | 262 bool SetCapturer(VideoCapturer* capturer); |
| 261 bool SetVideoFormat(const VideoFormat& format); | 263 bool SetVideoFormat(const VideoFormat& format); |
| 262 void MuteStream(bool mute); | 264 void MuteStream(bool mute); |
| 263 bool DisconnectCapturer(); | 265 bool DisconnectCapturer(); |
| 264 | 266 |
| 265 void SetApplyRotation(bool apply_rotation); | |
| 266 | |
| 267 void Start(); | 267 void Start(); |
| 268 void Stop(); | 268 void Stop(); |
| 269 | 269 |
| 270 const std::vector<uint32_t>& GetSsrcs() const; | 270 const std::vector<uint32_t>& GetSsrcs() const; |
| 271 VideoSenderInfo GetVideoSenderInfo(); | 271 VideoSenderInfo GetVideoSenderInfo(); |
| 272 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 272 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
| 273 | 273 |
| 274 void SetMaxBitrateBps(int max_bitrate_bps); | |
| 275 | |
| 276 private: | 274 private: |
| 277 // Parameters needed to reconstruct the underlying stream. | 275 // Parameters needed to reconstruct the underlying stream. |
| 278 // webrtc::VideoSendStream doesn't support setting a lot of options on the | 276 // webrtc::VideoSendStream doesn't support setting a lot of options on the |
| 279 // fly, so when those need to be changed we tear down and reconstruct with | 277 // fly, so when those need to be changed we tear down and reconstruct with |
| 280 // similar parameters depending on which options changed etc. | 278 // similar parameters depending on which options changed etc. |
| 281 struct VideoSendStreamParameters { | 279 struct VideoSendStreamParameters { |
| 282 VideoSendStreamParameters( | 280 VideoSendStreamParameters( |
| 283 const webrtc::VideoSendStream::Config& config, | 281 const webrtc::VideoSendStream::Config& config, |
| 284 const VideoOptions& options, | 282 const VideoOptions& options, |
| 285 int max_bitrate_bps, | 283 int max_bitrate_bps, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 VideoOptions options_; | 527 VideoOptions options_; |
| 530 // TODO(deadbeef): Don't duplicate information between | 528 // TODO(deadbeef): Don't duplicate information between |
| 531 // send_params/recv_params, rtp_extensions, options, etc. | 529 // send_params/recv_params, rtp_extensions, options, etc. |
| 532 VideoSendParameters send_params_; | 530 VideoSendParameters send_params_; |
| 533 VideoRecvParameters recv_params_; | 531 VideoRecvParameters recv_params_; |
| 534 }; | 532 }; |
| 535 | 533 |
| 536 } // namespace cricket | 534 } // namespace cricket |
| 537 | 535 |
| 538 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 536 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
| OLD | NEW |