You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
4.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * libjingle
  3. * Copyright 2012, Google Inc.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice,
  9. * this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and/or other materials provided with the distribution.
  13. * 3. The name of the author may not be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  17. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  19. * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  22. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  23. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  24. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  25. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef TALK_APP_WEBRTC_PEERCONNECTIONPROXY_H_
  28. #define TALK_APP_WEBRTC_PEERCONNECTIONPROXY_H_
  29. #include "talk/app/webrtc/mediastreamsignaling.h"
  30. #include "talk/app/webrtc/peerconnectioninterface.h"
  31. namespace talk_base {
  32. class Thread;
  33. }
  34. namespace webrtc {
  35. class PeerConnectionProxy : public PeerConnectionInterface,
  36. public talk_base::MessageHandler {
  37. public:
  38. static PeerConnectionInterface* Create(
  39. talk_base::Thread* signaling_thread,
  40. PeerConnectionInterface* peerconnection);
  41. virtual talk_base::scoped_refptr<StreamCollectionInterface> local_streams();
  42. virtual talk_base::scoped_refptr<StreamCollectionInterface> remote_streams();
  43. virtual bool AddStream(MediaStreamInterface* local_stream,
  44. const MediaConstraintsInterface* constraints);
  45. virtual void RemoveStream(MediaStreamInterface* local_stream);
  46. virtual talk_base::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
  47. AudioTrackInterface* track);
  48. virtual bool GetStats(StatsObserver* observer,
  49. webrtc::MediaStreamTrackInterface* track);
  50. virtual talk_base::scoped_refptr<DataChannelInterface> CreateDataChannel(
  51. const std::string& label,
  52. const DataChannelInit* config);
  53. // TODO(perkj): Remove ready_state when callers removed. It is deprecated.
  54. virtual ReadyState ready_state() { return signaling_state(); }
  55. virtual SignalingState signaling_state();
  56. // TODO(bemasc): Remove ice_state when callers are removed. It is deprecated.
  57. virtual IceState ice_state();
  58. virtual IceConnectionState ice_connection_state();
  59. virtual IceGatheringState ice_gathering_state();
  60. virtual const SessionDescriptionInterface* local_description() const;
  61. virtual const SessionDescriptionInterface* remote_description() const;
  62. // JSEP01
  63. virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
  64. const MediaConstraintsInterface* constraints);
  65. virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
  66. const MediaConstraintsInterface* constraints);
  67. virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
  68. SessionDescriptionInterface* desc);
  69. virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
  70. SessionDescriptionInterface* desc);
  71. virtual bool UpdateIce(const IceServers& configuration,
  72. const MediaConstraintsInterface* constraints);
  73. virtual bool AddIceCandidate(const IceCandidateInterface* candidate);
  74. protected:
  75. PeerConnectionProxy(talk_base::Thread* signaling_thread,
  76. PeerConnectionInterface* peerconnection);
  77. virtual ~PeerConnectionProxy();
  78. private:
  79. // Implement talk_base::MessageHandler.
  80. void OnMessage(talk_base::Message* msg);
  81. mutable talk_base::Thread* signaling_thread_;
  82. talk_base::scoped_refptr<PeerConnectionInterface> peerconnection_;
  83. };
  84. } // namespace webrtc
  85. #endif // TALK_APP_WEBRTC_PEERCONNECTIONPROXY_H_