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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const VideoOptions& options, | 163 const VideoOptions& options, |
164 const std::vector<VideoCodec>& recv_codecs, | 164 const std::vector<VideoCodec>& recv_codecs, |
165 WebRtcVideoEncoderFactory* external_encoder_factory, | 165 WebRtcVideoEncoderFactory* external_encoder_factory, |
166 WebRtcVideoDecoderFactory* external_decoder_factory); | 166 WebRtcVideoDecoderFactory* external_decoder_factory); |
167 ~WebRtcVideoChannel2() override; | 167 ~WebRtcVideoChannel2() override; |
168 | 168 |
169 // VideoMediaChannel implementation | 169 // VideoMediaChannel implementation |
170 bool SetSendParameters(const VideoSendParameters& params) override; | 170 bool SetSendParameters(const VideoSendParameters& params) override; |
171 bool SetRecvParameters(const VideoRecvParameters& params) override; | 171 bool SetRecvParameters(const VideoRecvParameters& params) override; |
172 bool GetSendCodec(VideoCodec* send_codec) override; | 172 bool GetSendCodec(VideoCodec* send_codec) override; |
173 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; | 173 bool SetSendStreamFormat(uint32_t ssrc, const VideoFormat& format) override; |
174 bool SetRender(bool render) override; | 174 bool SetRender(bool render) override; |
175 bool SetSend(bool send) override; | 175 bool SetSend(bool send) override; |
176 bool SetVideoSend(uint32 ssrc, bool mute, | 176 bool SetVideoSend(uint32_t ssrc, |
| 177 bool mute, |
177 const VideoOptions* options) override; | 178 const VideoOptions* options) override; |
178 bool AddSendStream(const StreamParams& sp) override; | 179 bool AddSendStream(const StreamParams& sp) override; |
179 bool RemoveSendStream(uint32 ssrc) override; | 180 bool RemoveSendStream(uint32_t ssrc) override; |
180 bool AddRecvStream(const StreamParams& sp) override; | 181 bool AddRecvStream(const StreamParams& sp) override; |
181 bool AddRecvStream(const StreamParams& sp, bool default_stream); | 182 bool AddRecvStream(const StreamParams& sp, bool default_stream); |
182 bool RemoveRecvStream(uint32 ssrc) override; | 183 bool RemoveRecvStream(uint32_t ssrc) override; |
183 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) override; | 184 bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer) override; |
184 bool GetStats(VideoMediaInfo* info) override; | 185 bool GetStats(VideoMediaInfo* info) override; |
185 bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) override; | 186 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; |
186 bool SendIntraFrame() override; | 187 bool SendIntraFrame() override; |
187 bool RequestIntraFrame() override; | 188 bool RequestIntraFrame() override; |
188 | 189 |
189 void OnPacketReceived(rtc::Buffer* packet, | 190 void OnPacketReceived(rtc::Buffer* packet, |
190 const rtc::PacketTime& packet_time) override; | 191 const rtc::PacketTime& packet_time) override; |
191 void OnRtcpReceived(rtc::Buffer* packet, | 192 void OnRtcpReceived(rtc::Buffer* packet, |
192 const rtc::PacketTime& packet_time) override; | 193 const rtc::PacketTime& packet_time) override; |
193 void OnReadyToSend(bool ready) override; | 194 void OnReadyToSend(bool ready) override; |
194 void SetInterface(NetworkInterface* iface) override; | 195 void SetInterface(NetworkInterface* iface) override; |
195 void UpdateAspectRatio(int ratio_w, int ratio_h) override; | 196 void UpdateAspectRatio(int ratio_w, int ratio_h) override; |
196 | 197 |
197 void OnMessage(rtc::Message* msg) override; | 198 void OnMessage(rtc::Message* msg) override; |
198 | 199 |
199 void OnLoadUpdate(Load load) override; | 200 void OnLoadUpdate(Load load) override; |
200 | 201 |
201 // Implemented for VideoMediaChannelTest. | 202 // Implemented for VideoMediaChannelTest. |
202 bool sending() const { return sending_; } | 203 bool sending() const { return sending_; } |
203 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 204 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
204 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer); | 205 bool GetRenderer(uint32_t ssrc, VideoRenderer** renderer); |
205 | 206 |
206 private: | 207 private: |
207 bool MuteStream(uint32 ssrc, bool mute); | 208 bool MuteStream(uint32_t ssrc, bool mute); |
208 class WebRtcVideoReceiveStream; | 209 class WebRtcVideoReceiveStream; |
209 | 210 |
210 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); | 211 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); |
211 bool SetSendRtpHeaderExtensions( | 212 bool SetSendRtpHeaderExtensions( |
212 const std::vector<RtpHeaderExtension>& extensions); | 213 const std::vector<RtpHeaderExtension>& extensions); |
213 bool SetMaxSendBandwidth(int bps); | 214 bool SetMaxSendBandwidth(int bps); |
214 bool SetOptions(const VideoOptions& options); | 215 bool SetOptions(const VideoOptions& options); |
215 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); | 216 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); |
216 bool SetRecvRtpHeaderExtensions( | 217 bool SetRecvRtpHeaderExtensions( |
217 const std::vector<RtpHeaderExtension>& extensions); | 218 const std::vector<RtpHeaderExtension>& extensions); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 bool SetCapturer(VideoCapturer* capturer); | 265 bool SetCapturer(VideoCapturer* capturer); |
265 bool SetVideoFormat(const VideoFormat& format); | 266 bool SetVideoFormat(const VideoFormat& format); |
266 void MuteStream(bool mute); | 267 void MuteStream(bool mute); |
267 bool DisconnectCapturer(); | 268 bool DisconnectCapturer(); |
268 | 269 |
269 void SetApplyRotation(bool apply_rotation); | 270 void SetApplyRotation(bool apply_rotation); |
270 | 271 |
271 void Start(); | 272 void Start(); |
272 void Stop(); | 273 void Stop(); |
273 | 274 |
274 const std::vector<uint32>& GetSsrcs() const; | 275 const std::vector<uint32_t>& GetSsrcs() const; |
275 VideoSenderInfo GetVideoSenderInfo(); | 276 VideoSenderInfo GetVideoSenderInfo(); |
276 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 277 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
277 | 278 |
278 void SetMaxBitrateBps(int max_bitrate_bps); | 279 void SetMaxBitrateBps(int max_bitrate_bps); |
279 | 280 |
280 private: | 281 private: |
281 // Parameters needed to reconstruct the underlying stream. | 282 // Parameters needed to reconstruct the underlying stream. |
282 // webrtc::VideoSendStream doesn't support setting a lot of options on the | 283 // webrtc::VideoSendStream doesn't support setting a lot of options on the |
283 // fly, so when those need to be changed we tear down and reconstruct with | 284 // fly, so when those need to be changed we tear down and reconstruct with |
284 // similar parameters depending on which options changed etc. | 285 // similar parameters depending on which options changed etc. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 void SetCodecAndOptions(const VideoCodecSettings& codec, | 351 void SetCodecAndOptions(const VideoCodecSettings& codec, |
351 const VideoOptions& options) | 352 const VideoOptions& options) |
352 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 353 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
353 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); | 354 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); |
354 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( | 355 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( |
355 const Dimensions& dimensions, | 356 const Dimensions& dimensions, |
356 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); | 357 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); |
357 void SetDimensions(int width, int height, bool is_screencast) | 358 void SetDimensions(int width, int height, bool is_screencast) |
358 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 359 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
359 | 360 |
360 const std::vector<uint32> ssrcs_; | 361 const std::vector<uint32_t> ssrcs_; |
361 const std::vector<SsrcGroup> ssrc_groups_; | 362 const std::vector<SsrcGroup> ssrc_groups_; |
362 webrtc::Call* const call_; | 363 webrtc::Call* const call_; |
363 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 364 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
364 GUARDED_BY(lock_); | 365 GUARDED_BY(lock_); |
365 | 366 |
366 rtc::CriticalSection lock_; | 367 rtc::CriticalSection lock_; |
367 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 368 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
368 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 369 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
369 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); | 370 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); |
370 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); | 371 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
(...skipping 21 matching lines...) Expand all Loading... |
392 public: | 393 public: |
393 WebRtcVideoReceiveStream( | 394 WebRtcVideoReceiveStream( |
394 webrtc::Call* call, | 395 webrtc::Call* call, |
395 const StreamParams& sp, | 396 const StreamParams& sp, |
396 const webrtc::VideoReceiveStream::Config& config, | 397 const webrtc::VideoReceiveStream::Config& config, |
397 WebRtcVideoDecoderFactory* external_decoder_factory, | 398 WebRtcVideoDecoderFactory* external_decoder_factory, |
398 bool default_stream, | 399 bool default_stream, |
399 const std::vector<VideoCodecSettings>& recv_codecs); | 400 const std::vector<VideoCodecSettings>& recv_codecs); |
400 ~WebRtcVideoReceiveStream(); | 401 ~WebRtcVideoReceiveStream(); |
401 | 402 |
402 const std::vector<uint32>& GetSsrcs() const; | 403 const std::vector<uint32_t>& GetSsrcs() const; |
403 | 404 |
404 void SetLocalSsrc(uint32_t local_ssrc); | 405 void SetLocalSsrc(uint32_t local_ssrc); |
405 void SetNackAndRemb(bool nack_enabled, bool remb_enabled); | 406 void SetNackAndRemb(bool nack_enabled, bool remb_enabled); |
406 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs); | 407 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs); |
407 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions); | 408 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions); |
408 | 409 |
409 void RenderFrame(const webrtc::VideoFrame& frame, | 410 void RenderFrame(const webrtc::VideoFrame& frame, |
410 int time_to_render_ms) override; | 411 int time_to_render_ms) override; |
411 bool IsTextureSupported() const override; | 412 bool IsTextureSupported() const override; |
412 bool IsDefaultStream() const; | 413 bool IsDefaultStream() const; |
(...skipping 19 matching lines...) Expand all Loading... |
432 void RecreateWebRtcStream(); | 433 void RecreateWebRtcStream(); |
433 | 434 |
434 AllocatedDecoder CreateOrReuseVideoDecoder( | 435 AllocatedDecoder CreateOrReuseVideoDecoder( |
435 std::vector<AllocatedDecoder>* old_decoder, | 436 std::vector<AllocatedDecoder>* old_decoder, |
436 const VideoCodec& codec); | 437 const VideoCodec& codec); |
437 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); | 438 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); |
438 | 439 |
439 std::string GetCodecNameFromPayloadType(int payload_type); | 440 std::string GetCodecNameFromPayloadType(int payload_type); |
440 | 441 |
441 webrtc::Call* const call_; | 442 webrtc::Call* const call_; |
442 const std::vector<uint32> ssrcs_; | 443 const std::vector<uint32_t> ssrcs_; |
443 const std::vector<SsrcGroup> ssrc_groups_; | 444 const std::vector<SsrcGroup> ssrc_groups_; |
444 | 445 |
445 webrtc::VideoReceiveStream* stream_; | 446 webrtc::VideoReceiveStream* stream_; |
446 const bool default_stream_; | 447 const bool default_stream_; |
447 webrtc::VideoReceiveStream::Config config_; | 448 webrtc::VideoReceiveStream::Config config_; |
448 | 449 |
449 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 450 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
450 std::vector<AllocatedDecoder> allocated_decoders_; | 451 std::vector<AllocatedDecoder> allocated_decoders_; |
451 | 452 |
452 rtc::CriticalSection renderer_lock_; | 453 rtc::CriticalSection renderer_lock_; |
(...skipping 40 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 |