OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 void StartAudioMonitor(int cms); | 382 void StartAudioMonitor(int cms); |
383 void StopAudioMonitor(); | 383 void StopAudioMonitor(); |
384 bool IsAudioMonitorRunning() const; | 384 bool IsAudioMonitorRunning() const; |
385 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor; | 385 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor; |
386 | 386 |
387 int GetInputLevel_w(); | 387 int GetInputLevel_w(); |
388 int GetOutputLevel_w(); | 388 int GetOutputLevel_w(); |
389 void GetActiveStreams_w(AudioInfo::StreamList* actives); | 389 void GetActiveStreams_w(AudioInfo::StreamList* actives); |
390 | 390 |
391 // Signal errors from VoiceMediaChannel. Arguments are: | |
392 // ssrc(uint32), and error(VoiceMediaChannel::Error). | |
393 sigslot::signal3<VoiceChannel*, uint32, VoiceMediaChannel::Error> | |
394 SignalMediaError; | |
395 | |
396 private: | 391 private: |
397 // overrides from BaseChannel | 392 // overrides from BaseChannel |
398 virtual void OnChannelRead(TransportChannel* channel, | 393 virtual void OnChannelRead(TransportChannel* channel, |
399 const char* data, size_t len, | 394 const char* data, size_t len, |
400 const rtc::PacketTime& packet_time, | 395 const rtc::PacketTime& packet_time, |
401 int flags); | 396 int flags); |
402 virtual void ChangeState(); | 397 virtual void ChangeState(); |
403 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); | 398 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); |
404 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 399 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
405 ContentAction action, | 400 ContentAction action, |
406 std::string* error_desc); | 401 std::string* error_desc); |
407 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 402 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
408 ContentAction action, | 403 ContentAction action, |
409 std::string* error_desc); | 404 std::string* error_desc); |
410 void HandleEarlyMediaTimeout(); | 405 void HandleEarlyMediaTimeout(); |
411 bool InsertDtmf_w(uint32 ssrc, int event, int duration, int flags); | 406 bool InsertDtmf_w(uint32 ssrc, int event, int duration, int flags); |
412 bool SetOutputScaling_w(uint32 ssrc, double left, double right); | 407 bool SetOutputScaling_w(uint32 ssrc, double left, double right); |
413 bool GetStats_w(VoiceMediaInfo* stats); | 408 bool GetStats_w(VoiceMediaInfo* stats); |
414 | 409 |
415 virtual void OnMessage(rtc::Message* pmsg); | 410 virtual void OnMessage(rtc::Message* pmsg); |
416 virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const; | 411 virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const; |
417 virtual void OnConnectionMonitorUpdate( | 412 virtual void OnConnectionMonitorUpdate( |
418 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 413 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
419 virtual void OnMediaMonitorUpdate( | 414 virtual void OnMediaMonitorUpdate( |
420 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); | 415 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); |
421 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); | 416 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); |
422 void OnVoiceChannelError(uint32 ssrc, VoiceMediaChannel::Error error); | |
423 void SendLastMediaError(); | |
424 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error); | |
425 | 417 |
426 static const int kEarlyMediaTimeout = 1000; | 418 static const int kEarlyMediaTimeout = 1000; |
427 MediaEngineInterface* media_engine_; | 419 MediaEngineInterface* media_engine_; |
428 bool received_media_; | 420 bool received_media_; |
429 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; | 421 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; |
430 rtc::scoped_ptr<AudioMonitor> audio_monitor_; | 422 rtc::scoped_ptr<AudioMonitor> audio_monitor_; |
431 | 423 |
432 // Last AudioSendParameters sent down to the media_channel() via | 424 // Last AudioSendParameters sent down to the media_channel() via |
433 // SetSendParameters. | 425 // SetSendParameters. |
434 AudioSendParameters last_send_params_; | 426 AudioSendParameters last_send_params_; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&> | 465 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&> |
474 SignalConnectionMonitor; | 466 SignalConnectionMonitor; |
475 | 467 |
476 void StartMediaMonitor(int cms); | 468 void StartMediaMonitor(int cms); |
477 void StopMediaMonitor(); | 469 void StopMediaMonitor(); |
478 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; | 470 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; |
479 sigslot::signal2<uint32, rtc::WindowEvent> SignalScreencastWindowEvent; | 471 sigslot::signal2<uint32, rtc::WindowEvent> SignalScreencastWindowEvent; |
480 | 472 |
481 bool SendIntraFrame(); | 473 bool SendIntraFrame(); |
482 bool RequestIntraFrame(); | 474 bool RequestIntraFrame(); |
483 sigslot::signal3<VideoChannel*, uint32, VideoMediaChannel::Error> | |
484 SignalMediaError; | |
485 | 475 |
486 // Configure sending media on the stream with SSRC |ssrc| | 476 // Configure sending media on the stream with SSRC |ssrc| |
487 // If there is only one sending stream SSRC 0 can be used. | 477 // If there is only one sending stream SSRC 0 can be used. |
488 bool SetVideoSend(uint32 ssrc, bool mute, const VideoOptions* options); | 478 bool SetVideoSend(uint32 ssrc, bool mute, const VideoOptions* options); |
489 | 479 |
490 private: | 480 private: |
491 typedef std::map<uint32, VideoCapturer*> ScreencastMap; | 481 typedef std::map<uint32, VideoCapturer*> ScreencastMap; |
492 struct ScreencastDetailsData; | 482 struct ScreencastDetailsData; |
493 | 483 |
494 // overrides from BaseChannel | 484 // overrides from BaseChannel |
(...skipping 18 matching lines...) Expand all Loading... |
513 virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const; | 503 virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const; |
514 virtual void OnConnectionMonitorUpdate( | 504 virtual void OnConnectionMonitorUpdate( |
515 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 505 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
516 virtual void OnMediaMonitorUpdate( | 506 virtual void OnMediaMonitorUpdate( |
517 VideoMediaChannel* media_channel, const VideoMediaInfo& info); | 507 VideoMediaChannel* media_channel, const VideoMediaInfo& info); |
518 virtual void OnScreencastWindowEvent(uint32 ssrc, | 508 virtual void OnScreencastWindowEvent(uint32 ssrc, |
519 rtc::WindowEvent event); | 509 rtc::WindowEvent event); |
520 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); | 510 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); |
521 bool GetLocalSsrc(const VideoCapturer* capturer, uint32* ssrc); | 511 bool GetLocalSsrc(const VideoCapturer* capturer, uint32* ssrc); |
522 | 512 |
523 void OnVideoChannelError(uint32 ssrc, VideoMediaChannel::Error error); | |
524 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error); | |
525 | |
526 VideoRenderer* renderer_; | 513 VideoRenderer* renderer_; |
527 ScreencastMap screencast_capturers_; | 514 ScreencastMap screencast_capturers_; |
528 rtc::scoped_ptr<VideoMediaMonitor> media_monitor_; | 515 rtc::scoped_ptr<VideoMediaMonitor> media_monitor_; |
529 | 516 |
530 rtc::WindowEvent previous_we_; | 517 rtc::WindowEvent previous_we_; |
531 | 518 |
532 // Last VideoSendParameters sent down to the media_channel() via | 519 // Last VideoSendParameters sent down to the media_channel() via |
533 // SetSendParameters. | 520 // SetSendParameters. |
534 VideoSendParameters last_send_params_; | 521 VideoSendParameters last_send_params_; |
535 // Last VideoRecvParameters sent down to the media_channel() via | 522 // Last VideoRecvParameters sent down to the media_channel() via |
(...skipping 20 matching lines...) Expand all Loading... |
556 void StopMediaMonitor(); | 543 void StopMediaMonitor(); |
557 | 544 |
558 // Should be called on the signaling thread only. | 545 // Should be called on the signaling thread only. |
559 bool ready_to_send_data() const { | 546 bool ready_to_send_data() const { |
560 return ready_to_send_data_; | 547 return ready_to_send_data_; |
561 } | 548 } |
562 | 549 |
563 sigslot::signal2<DataChannel*, const DataMediaInfo&> SignalMediaMonitor; | 550 sigslot::signal2<DataChannel*, const DataMediaInfo&> SignalMediaMonitor; |
564 sigslot::signal2<DataChannel*, const std::vector<ConnectionInfo>&> | 551 sigslot::signal2<DataChannel*, const std::vector<ConnectionInfo>&> |
565 SignalConnectionMonitor; | 552 SignalConnectionMonitor; |
566 sigslot::signal3<DataChannel*, uint32, DataMediaChannel::Error> | |
567 SignalMediaError; | |
568 sigslot::signal3<DataChannel*, | 553 sigslot::signal3<DataChannel*, |
569 const ReceiveDataParams&, | 554 const ReceiveDataParams&, |
570 const rtc::Buffer&> | 555 const rtc::Buffer&> |
571 SignalDataReceived; | 556 SignalDataReceived; |
572 // Signal for notifying when the channel becomes ready to send data. | 557 // Signal for notifying when the channel becomes ready to send data. |
573 // That occurs when the channel is enabled, the transport is writable, | 558 // That occurs when the channel is enabled, the transport is writable, |
574 // both local and remote descriptions are set, and the channel is unblocked. | 559 // both local and remote descriptions are set, and the channel is unblocked. |
575 sigslot::signal1<bool> SignalReadyToSendData; | 560 sigslot::signal1<bool> SignalReadyToSendData; |
576 // Signal for notifying that the remote side has closed the DataChannel. | 561 // Signal for notifying that the remote side has closed the DataChannel. |
577 sigslot::signal1<uint32> SignalStreamClosedRemotely; | 562 sigslot::signal1<uint32> SignalStreamClosedRemotely; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const; | 623 virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const; |
639 virtual void OnConnectionMonitorUpdate( | 624 virtual void OnConnectionMonitorUpdate( |
640 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 625 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
641 virtual void OnMediaMonitorUpdate( | 626 virtual void OnMediaMonitorUpdate( |
642 DataMediaChannel* media_channel, const DataMediaInfo& info); | 627 DataMediaChannel* media_channel, const DataMediaInfo& info); |
643 virtual bool ShouldSetupDtlsSrtp() const; | 628 virtual bool ShouldSetupDtlsSrtp() const; |
644 void OnDataReceived( | 629 void OnDataReceived( |
645 const ReceiveDataParams& params, const char* data, size_t len); | 630 const ReceiveDataParams& params, const char* data, size_t len); |
646 void OnDataChannelError(uint32 ssrc, DataMediaChannel::Error error); | 631 void OnDataChannelError(uint32 ssrc, DataMediaChannel::Error error); |
647 void OnDataChannelReadyToSend(bool writable); | 632 void OnDataChannelReadyToSend(bool writable); |
648 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error); | |
649 void OnStreamClosedRemotely(uint32 sid); | 633 void OnStreamClosedRemotely(uint32 sid); |
650 | 634 |
651 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; | 635 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; |
652 // TODO(pthatcher): Make a separate SctpDataChannel and | 636 // TODO(pthatcher): Make a separate SctpDataChannel and |
653 // RtpDataChannel instead of using this. | 637 // RtpDataChannel instead of using this. |
654 DataChannelType data_channel_type_; | 638 DataChannelType data_channel_type_; |
655 bool ready_to_send_data_; | 639 bool ready_to_send_data_; |
656 | 640 |
657 // Last DataSendParameters sent down to the media_channel() via | 641 // Last DataSendParameters sent down to the media_channel() via |
658 // SetSendParameters. | 642 // SetSendParameters. |
659 DataSendParameters last_send_params_; | 643 DataSendParameters last_send_params_; |
660 // Last DataRecvParameters sent down to the media_channel() via | 644 // Last DataRecvParameters sent down to the media_channel() via |
661 // SetRecvParameters. | 645 // SetRecvParameters. |
662 DataRecvParameters last_recv_params_; | 646 DataRecvParameters last_recv_params_; |
663 }; | 647 }; |
664 | 648 |
665 } // namespace cricket | 649 } // namespace cricket |
666 | 650 |
667 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 651 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ |
OLD | NEW |