| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const VideoOptions& options, | 162 const VideoOptions& options, |
| 163 const std::vector<VideoCodec>& recv_codecs, | 163 const std::vector<VideoCodec>& recv_codecs, |
| 164 WebRtcVideoEncoderFactory* external_encoder_factory, | 164 WebRtcVideoEncoderFactory* external_encoder_factory, |
| 165 WebRtcVideoDecoderFactory* external_decoder_factory); | 165 WebRtcVideoDecoderFactory* external_decoder_factory); |
| 166 ~WebRtcVideoChannel2() override; | 166 ~WebRtcVideoChannel2() override; |
| 167 | 167 |
| 168 // VideoMediaChannel implementation | 168 // VideoMediaChannel implementation |
| 169 bool SetSendParameters(const VideoSendParameters& params) override; | 169 bool SetSendParameters(const VideoSendParameters& params) override; |
| 170 bool SetRecvParameters(const VideoRecvParameters& params) override; | 170 bool SetRecvParameters(const VideoRecvParameters& params) override; |
| 171 bool GetSendCodec(VideoCodec* send_codec) override; | 171 bool GetSendCodec(VideoCodec* send_codec) override; |
| 172 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; | 172 bool SetSendStreamFormat(uint32_t ssrc, const VideoFormat& format) override; |
| 173 bool SetSend(bool send) override; | 173 bool SetSend(bool send) override; |
| 174 bool SetVideoSend(uint32 ssrc, bool mute, | 174 bool SetVideoSend(uint32_t ssrc, |
| 175 bool mute, |
| 175 const VideoOptions* options) override; | 176 const VideoOptions* options) override; |
| 176 bool AddSendStream(const StreamParams& sp) override; | 177 bool AddSendStream(const StreamParams& sp) override; |
| 177 bool RemoveSendStream(uint32 ssrc) override; | 178 bool RemoveSendStream(uint32_t ssrc) override; |
| 178 bool AddRecvStream(const StreamParams& sp) override; | 179 bool AddRecvStream(const StreamParams& sp) override; |
| 179 bool AddRecvStream(const StreamParams& sp, bool default_stream); | 180 bool AddRecvStream(const StreamParams& sp, bool default_stream); |
| 180 bool RemoveRecvStream(uint32 ssrc) override; | 181 bool RemoveRecvStream(uint32_t ssrc) override; |
| 181 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) override; | 182 bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer) override; |
| 182 bool GetStats(VideoMediaInfo* info) override; | 183 bool GetStats(VideoMediaInfo* info) override; |
| 183 bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) override; | 184 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; |
| 184 bool SendIntraFrame() override; | 185 bool SendIntraFrame() override; |
| 185 bool RequestIntraFrame() override; | 186 bool RequestIntraFrame() override; |
| 186 | 187 |
| 187 void OnPacketReceived(rtc::Buffer* packet, | 188 void OnPacketReceived(rtc::Buffer* packet, |
| 188 const rtc::PacketTime& packet_time) override; | 189 const rtc::PacketTime& packet_time) override; |
| 189 void OnRtcpReceived(rtc::Buffer* packet, | 190 void OnRtcpReceived(rtc::Buffer* packet, |
| 190 const rtc::PacketTime& packet_time) override; | 191 const rtc::PacketTime& packet_time) override; |
| 191 void OnReadyToSend(bool ready) override; | 192 void OnReadyToSend(bool ready) override; |
| 192 void SetInterface(NetworkInterface* iface) override; | 193 void SetInterface(NetworkInterface* iface) override; |
| 193 void UpdateAspectRatio(int ratio_w, int ratio_h) override; | 194 void UpdateAspectRatio(int ratio_w, int ratio_h) override; |
| 194 | 195 |
| 195 void OnMessage(rtc::Message* msg) override; | 196 void OnMessage(rtc::Message* msg) override; |
| 196 | 197 |
| 197 void OnLoadUpdate(Load load) override; | 198 void OnLoadUpdate(Load load) override; |
| 198 | 199 |
| 199 // Implemented for VideoMediaChannelTest. | 200 // Implemented for VideoMediaChannelTest. |
| 200 bool sending() const { return sending_; } | 201 bool sending() const { return sending_; } |
| 201 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 202 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
| 202 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer); | 203 bool GetRenderer(uint32_t ssrc, VideoRenderer** renderer); |
| 203 | 204 |
| 204 private: | 205 private: |
| 205 bool MuteStream(uint32 ssrc, bool mute); | 206 bool MuteStream(uint32_t ssrc, bool mute); |
| 206 class WebRtcVideoReceiveStream; | 207 class WebRtcVideoReceiveStream; |
| 207 | 208 |
| 208 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); | 209 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); |
| 209 bool SetSendRtpHeaderExtensions( | 210 bool SetSendRtpHeaderExtensions( |
| 210 const std::vector<RtpHeaderExtension>& extensions); | 211 const std::vector<RtpHeaderExtension>& extensions); |
| 211 bool SetMaxSendBandwidth(int bps); | 212 bool SetMaxSendBandwidth(int bps); |
| 212 bool SetOptions(const VideoOptions& options); | 213 bool SetOptions(const VideoOptions& options); |
| 213 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); | 214 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); |
| 214 bool SetRecvRtpHeaderExtensions( | 215 bool SetRecvRtpHeaderExtensions( |
| 215 const std::vector<RtpHeaderExtension>& extensions); | 216 const std::vector<RtpHeaderExtension>& extensions); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 bool SetCapturer(VideoCapturer* capturer); | 263 bool SetCapturer(VideoCapturer* capturer); |
| 263 bool SetVideoFormat(const VideoFormat& format); | 264 bool SetVideoFormat(const VideoFormat& format); |
| 264 void MuteStream(bool mute); | 265 void MuteStream(bool mute); |
| 265 bool DisconnectCapturer(); | 266 bool DisconnectCapturer(); |
| 266 | 267 |
| 267 void SetApplyRotation(bool apply_rotation); | 268 void SetApplyRotation(bool apply_rotation); |
| 268 | 269 |
| 269 void Start(); | 270 void Start(); |
| 270 void Stop(); | 271 void Stop(); |
| 271 | 272 |
| 272 const std::vector<uint32>& GetSsrcs() const; | 273 const std::vector<uint32_t>& GetSsrcs() const; |
| 273 VideoSenderInfo GetVideoSenderInfo(); | 274 VideoSenderInfo GetVideoSenderInfo(); |
| 274 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 275 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
| 275 | 276 |
| 276 void SetMaxBitrateBps(int max_bitrate_bps); | 277 void SetMaxBitrateBps(int max_bitrate_bps); |
| 277 | 278 |
| 278 private: | 279 private: |
| 279 // Parameters needed to reconstruct the underlying stream. | 280 // Parameters needed to reconstruct the underlying stream. |
| 280 // webrtc::VideoSendStream doesn't support setting a lot of options on the | 281 // webrtc::VideoSendStream doesn't support setting a lot of options on the |
| 281 // fly, so when those need to be changed we tear down and reconstruct with | 282 // fly, so when those need to be changed we tear down and reconstruct with |
| 282 // similar parameters depending on which options changed etc. | 283 // similar parameters depending on which options changed etc. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 void SetCodecAndOptions(const VideoCodecSettings& codec, | 349 void SetCodecAndOptions(const VideoCodecSettings& codec, |
| 349 const VideoOptions& options) | 350 const VideoOptions& options) |
| 350 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 351 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
| 351 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); | 352 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); |
| 352 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( | 353 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( |
| 353 const Dimensions& dimensions, | 354 const Dimensions& dimensions, |
| 354 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); | 355 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); |
| 355 void SetDimensions(int width, int height, bool is_screencast) | 356 void SetDimensions(int width, int height, bool is_screencast) |
| 356 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 357 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
| 357 | 358 |
| 358 const std::vector<uint32> ssrcs_; | 359 const std::vector<uint32_t> ssrcs_; |
| 359 const std::vector<SsrcGroup> ssrc_groups_; | 360 const std::vector<SsrcGroup> ssrc_groups_; |
| 360 webrtc::Call* const call_; | 361 webrtc::Call* const call_; |
| 361 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 362 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
| 362 GUARDED_BY(lock_); | 363 GUARDED_BY(lock_); |
| 363 | 364 |
| 364 rtc::CriticalSection lock_; | 365 rtc::CriticalSection lock_; |
| 365 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 366 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
| 366 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 367 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
| 367 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); | 368 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); |
| 368 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); | 369 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 390 public: | 391 public: |
| 391 WebRtcVideoReceiveStream( | 392 WebRtcVideoReceiveStream( |
| 392 webrtc::Call* call, | 393 webrtc::Call* call, |
| 393 const StreamParams& sp, | 394 const StreamParams& sp, |
| 394 const webrtc::VideoReceiveStream::Config& config, | 395 const webrtc::VideoReceiveStream::Config& config, |
| 395 WebRtcVideoDecoderFactory* external_decoder_factory, | 396 WebRtcVideoDecoderFactory* external_decoder_factory, |
| 396 bool default_stream, | 397 bool default_stream, |
| 397 const std::vector<VideoCodecSettings>& recv_codecs); | 398 const std::vector<VideoCodecSettings>& recv_codecs); |
| 398 ~WebRtcVideoReceiveStream(); | 399 ~WebRtcVideoReceiveStream(); |
| 399 | 400 |
| 400 const std::vector<uint32>& GetSsrcs() const; | 401 const std::vector<uint32_t>& GetSsrcs() const; |
| 401 | 402 |
| 402 void SetLocalSsrc(uint32_t local_ssrc); | 403 void SetLocalSsrc(uint32_t local_ssrc); |
| 403 void SetNackAndRemb(bool nack_enabled, bool remb_enabled); | 404 void SetNackAndRemb(bool nack_enabled, bool remb_enabled); |
| 404 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs); | 405 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs); |
| 405 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions); | 406 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions); |
| 406 | 407 |
| 407 void RenderFrame(const webrtc::VideoFrame& frame, | 408 void RenderFrame(const webrtc::VideoFrame& frame, |
| 408 int time_to_render_ms) override; | 409 int time_to_render_ms) override; |
| 409 bool IsTextureSupported() const override; | 410 bool IsTextureSupported() const override; |
| 410 bool IsDefaultStream() const; | 411 bool IsDefaultStream() const; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 430 void RecreateWebRtcStream(); | 431 void RecreateWebRtcStream(); |
| 431 | 432 |
| 432 AllocatedDecoder CreateOrReuseVideoDecoder( | 433 AllocatedDecoder CreateOrReuseVideoDecoder( |
| 433 std::vector<AllocatedDecoder>* old_decoder, | 434 std::vector<AllocatedDecoder>* old_decoder, |
| 434 const VideoCodec& codec); | 435 const VideoCodec& codec); |
| 435 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); | 436 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); |
| 436 | 437 |
| 437 std::string GetCodecNameFromPayloadType(int payload_type); | 438 std::string GetCodecNameFromPayloadType(int payload_type); |
| 438 | 439 |
| 439 webrtc::Call* const call_; | 440 webrtc::Call* const call_; |
| 440 const std::vector<uint32> ssrcs_; | 441 const std::vector<uint32_t> ssrcs_; |
| 441 const std::vector<SsrcGroup> ssrc_groups_; | 442 const std::vector<SsrcGroup> ssrc_groups_; |
| 442 | 443 |
| 443 webrtc::VideoReceiveStream* stream_; | 444 webrtc::VideoReceiveStream* stream_; |
| 444 const bool default_stream_; | 445 const bool default_stream_; |
| 445 webrtc::VideoReceiveStream::Config config_; | 446 webrtc::VideoReceiveStream::Config config_; |
| 446 | 447 |
| 447 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 448 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
| 448 std::vector<AllocatedDecoder> allocated_decoders_; | 449 std::vector<AllocatedDecoder> allocated_decoders_; |
| 449 | 450 |
| 450 rtc::CriticalSection renderer_lock_; | 451 rtc::CriticalSection renderer_lock_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 uint32_t default_send_ssrc_; | 494 uint32_t default_send_ssrc_; |
| 494 | 495 |
| 495 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; | 496 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; |
| 496 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; | 497 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; |
| 497 | 498 |
| 498 // Separate list of set capturers used to signal CPU adaptation. These should | 499 // Separate list of set capturers used to signal CPU adaptation. These should |
| 499 // not be locked while calling methods that take other locks to prevent | 500 // not be locked while calling methods that take other locks to prevent |
| 500 // lock-order inversions. | 501 // lock-order inversions. |
| 501 rtc::CriticalSection capturer_crit_; | 502 rtc::CriticalSection capturer_crit_; |
| 502 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); | 503 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); |
| 503 std::map<uint32, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); | 504 std::map<uint32_t, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); |
| 504 | 505 |
| 505 rtc::CriticalSection stream_crit_; | 506 rtc::CriticalSection stream_crit_; |
| 506 // Using primary-ssrc (first ssrc) as key. | 507 // Using primary-ssrc (first ssrc) as key. |
| 507 std::map<uint32, WebRtcVideoSendStream*> send_streams_ | 508 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ |
| 508 GUARDED_BY(stream_crit_); | 509 GUARDED_BY(stream_crit_); |
| 509 std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_ | 510 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ |
| 510 GUARDED_BY(stream_crit_); | 511 GUARDED_BY(stream_crit_); |
| 511 std::set<uint32> send_ssrcs_ GUARDED_BY(stream_crit_); | 512 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); |
| 512 std::set<uint32> receive_ssrcs_ GUARDED_BY(stream_crit_); | 513 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); |
| 513 | 514 |
| 514 Settable<VideoCodecSettings> send_codec_; | 515 Settable<VideoCodecSettings> send_codec_; |
| 515 std::vector<webrtc::RtpExtension> send_rtp_extensions_; | 516 std::vector<webrtc::RtpExtension> send_rtp_extensions_; |
| 516 | 517 |
| 517 WebRtcVideoEncoderFactory* const external_encoder_factory_; | 518 WebRtcVideoEncoderFactory* const external_encoder_factory_; |
| 518 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 519 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
| 519 std::vector<VideoCodecSettings> recv_codecs_; | 520 std::vector<VideoCodecSettings> recv_codecs_; |
| 520 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 521 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
| 521 webrtc::Call::Config::BitrateConfig bitrate_config_; | 522 webrtc::Call::Config::BitrateConfig bitrate_config_; |
| 522 VideoOptions options_; | 523 VideoOptions options_; |
| 523 }; | 524 }; |
| 524 | 525 |
| 525 } // namespace cricket | 526 } // namespace cricket |
| 526 | 527 |
| 527 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 528 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
| OLD | NEW |