| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 void OnMessage(rtc::Message* msg) override; | 188 void OnMessage(rtc::Message* msg) override; |
| 189 | 189 |
| 190 void OnLoadUpdate(Load load) override; | 190 void OnLoadUpdate(Load load) override; |
| 191 | 191 |
| 192 // Implemented for VideoMediaChannelTest. | 192 // Implemented for VideoMediaChannelTest. |
| 193 bool sending() const { return sending_; } | 193 bool sending() const { return sending_; } |
| 194 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 194 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 class WebRtcVideoReceiveStream; |
| 197 struct VideoCodecSettings { | 198 struct VideoCodecSettings { |
| 198 VideoCodecSettings(); | 199 VideoCodecSettings(); |
| 199 | 200 |
| 200 bool operator==(const VideoCodecSettings& other) const; | 201 bool operator==(const VideoCodecSettings& other) const; |
| 201 bool operator!=(const VideoCodecSettings& other) const; | 202 bool operator!=(const VideoCodecSettings& other) const; |
| 202 | 203 |
| 203 VideoCodec codec; | 204 VideoCodec codec; |
| 204 webrtc::FecConfig fec; | 205 webrtc::FecConfig fec; |
| 205 int rtx_payload_type; | 206 int rtx_payload_type; |
| 206 }; | 207 }; |
| 207 | 208 |
| 208 struct ChangedSendParameters { | 209 struct ChangedSendParameters { |
| 209 // These optionals are unset if not changed. | 210 // These optionals are unset if not changed. |
| 210 rtc::Optional<VideoCodecSettings> codec; | 211 rtc::Optional<VideoCodecSettings> codec; |
| 211 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; | 212 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; |
| 212 rtc::Optional<int> max_bandwidth_bps; | 213 rtc::Optional<int> max_bandwidth_bps; |
| 213 rtc::Optional<VideoOptions> options; | 214 rtc::Optional<VideoOptions> options; |
| 214 rtc::Optional<webrtc::RtcpMode> rtcp_mode; | 215 rtc::Optional<webrtc::RtcpMode> rtcp_mode; |
| 215 }; | 216 }; |
| 217 |
| 218 struct ChangedRecvParameters { |
| 219 // These optionals are unset if not changed. |
| 220 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings; |
| 221 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; |
| 222 rtc::Optional<webrtc::RtcpMode> rtcp_mode; |
| 223 }; |
| 224 |
| 216 bool GetChangedSendParameters(const VideoSendParameters& params, | 225 bool GetChangedSendParameters(const VideoSendParameters& params, |
| 217 ChangedSendParameters* changed_params) const; | 226 ChangedSendParameters* changed_params) const; |
| 227 bool GetChangedRecvParameters(const VideoRecvParameters& params, |
| 228 ChangedRecvParameters* changed_params) const; |
| 229 |
| 218 bool MuteStream(uint32_t ssrc, bool mute); | 230 bool MuteStream(uint32_t ssrc, bool mute); |
| 219 class WebRtcVideoReceiveStream; | |
| 220 | 231 |
| 221 void SetMaxSendBandwidth(int bps); | 232 void SetMaxSendBandwidth(int bps); |
| 222 void SetOptions(const VideoOptions& options); | 233 void SetOptions(const VideoOptions& options); |
| 223 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); | |
| 224 bool SetRecvRtpHeaderExtensions( | |
| 225 const std::vector<RtpHeaderExtension>& extensions); | |
| 226 | 234 |
| 227 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 235 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, |
| 228 const StreamParams& sp) const; | 236 const StreamParams& sp) const; |
| 229 bool CodecIsExternallySupported(const std::string& name) const; | 237 bool CodecIsExternallySupported(const std::string& name) const; |
| 230 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 238 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
| 231 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 239 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
| 232 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 240 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
| 233 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 241 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
| 234 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 242 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
| 235 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 243 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 const std::vector<VideoCodecSettings>& recv_codecs, | 402 const std::vector<VideoCodecSettings>& recv_codecs, |
| 395 bool disable_prerenderer_smoothing); | 403 bool disable_prerenderer_smoothing); |
| 396 ~WebRtcVideoReceiveStream(); | 404 ~WebRtcVideoReceiveStream(); |
| 397 | 405 |
| 398 const std::vector<uint32_t>& GetSsrcs() const; | 406 const std::vector<uint32_t>& GetSsrcs() const; |
| 399 | 407 |
| 400 void SetLocalSsrc(uint32_t local_ssrc); | 408 void SetLocalSsrc(uint32_t local_ssrc); |
| 401 void SetFeedbackParameters(bool nack_enabled, | 409 void SetFeedbackParameters(bool nack_enabled, |
| 402 bool remb_enabled, | 410 bool remb_enabled, |
| 403 bool transport_cc_enabled); | 411 bool transport_cc_enabled); |
| 404 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs); | 412 void SetRecvParameters(const ChangedRecvParameters& recv_params); |
| 405 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions); | |
| 406 // TODO(deadbeef): Move logic from SetRecvCodecs/SetRtpExtensions/etc. | |
| 407 // into this method. Currently this method only sets the RTCP mode. | |
| 408 void SetRecvParameters(const VideoRecvParameters& recv_params); | |
| 409 | 413 |
| 410 void RenderFrame(const webrtc::VideoFrame& frame, | 414 void RenderFrame(const webrtc::VideoFrame& frame, |
| 411 int time_to_render_ms) override; | 415 int time_to_render_ms) override; |
| 412 bool IsTextureSupported() const override; | 416 bool IsTextureSupported() const override; |
| 413 bool SmoothsRenderedFrames() const override; | 417 bool SmoothsRenderedFrames() const override; |
| 414 bool IsDefaultStream() const; | 418 bool IsDefaultStream() const; |
| 415 | 419 |
| 416 void SetSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink); | 420 void SetSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink); |
| 417 | 421 |
| 418 VideoReceiverInfo GetVideoReceiverInfo(); | 422 VideoReceiverInfo GetVideoReceiverInfo(); |
| 419 | 423 |
| 420 private: | 424 private: |
| 421 struct AllocatedDecoder { | 425 struct AllocatedDecoder { |
| 422 AllocatedDecoder(webrtc::VideoDecoder* decoder, | 426 AllocatedDecoder(webrtc::VideoDecoder* decoder, |
| 423 webrtc::VideoCodecType type, | 427 webrtc::VideoCodecType type, |
| 424 bool external); | 428 bool external); |
| 425 webrtc::VideoDecoder* decoder; | 429 webrtc::VideoDecoder* decoder; |
| 426 // Decoder wrapped into a fallback decoder to permit software fallback. | 430 // Decoder wrapped into a fallback decoder to permit software fallback. |
| 427 webrtc::VideoDecoder* external_decoder; | 431 webrtc::VideoDecoder* external_decoder; |
| 428 webrtc::VideoCodecType type; | 432 webrtc::VideoCodecType type; |
| 429 bool external; | 433 bool external; |
| 430 }; | 434 }; |
| 431 | 435 |
| 432 void RecreateWebRtcStream(); | 436 void RecreateWebRtcStream(); |
| 433 | 437 |
| 438 void ConfigureCodecs(const std::vector<VideoCodecSettings>& recv_codecs, |
| 439 std::vector<AllocatedDecoder>* old_codecs); |
| 434 AllocatedDecoder CreateOrReuseVideoDecoder( | 440 AllocatedDecoder CreateOrReuseVideoDecoder( |
| 435 std::vector<AllocatedDecoder>* old_decoder, | 441 std::vector<AllocatedDecoder>* old_decoder, |
| 436 const VideoCodec& codec); | 442 const VideoCodec& codec); |
| 437 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); | 443 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); |
| 438 | 444 |
| 439 std::string GetCodecNameFromPayloadType(int payload_type); | 445 std::string GetCodecNameFromPayloadType(int payload_type); |
| 440 | 446 |
| 441 webrtc::Call* const call_; | 447 webrtc::Call* const call_; |
| 442 const std::vector<uint32_t> ssrcs_; | 448 const std::vector<uint32_t> ssrcs_; |
| 443 const std::vector<SsrcGroup> ssrc_groups_; | 449 const std::vector<SsrcGroup> ssrc_groups_; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 VideoOptions options_; | 532 VideoOptions options_; |
| 527 // TODO(deadbeef): Don't duplicate information between | 533 // TODO(deadbeef): Don't duplicate information between |
| 528 // send_params/recv_params, rtp_extensions, options, etc. | 534 // send_params/recv_params, rtp_extensions, options, etc. |
| 529 VideoSendParameters send_params_; | 535 VideoSendParameters send_params_; |
| 530 VideoRecvParameters recv_params_; | 536 VideoRecvParameters recv_params_; |
| 531 }; | 537 }; |
| 532 | 538 |
| 533 } // namespace cricket | 539 } // namespace cricket |
| 534 | 540 |
| 535 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 541 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
| OLD | NEW |