Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: talk/app/webrtc/peerconnection.h

Issue 1351803002: Exposing RtpSenders and RtpReceivers from PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Return bool from RtpSenderInterface::SetTrack. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 16 matching lines...) Expand all
27 27
28 #ifndef TALK_APP_WEBRTC_PEERCONNECTION_H_ 28 #ifndef TALK_APP_WEBRTC_PEERCONNECTION_H_
29 #define TALK_APP_WEBRTC_PEERCONNECTION_H_ 29 #define TALK_APP_WEBRTC_PEERCONNECTION_H_
30 30
31 #include <string> 31 #include <string>
32 32
33 #include "talk/app/webrtc/dtlsidentitystore.h" 33 #include "talk/app/webrtc/dtlsidentitystore.h"
34 #include "talk/app/webrtc/mediastreamsignaling.h" 34 #include "talk/app/webrtc/mediastreamsignaling.h"
35 #include "talk/app/webrtc/peerconnectionfactory.h" 35 #include "talk/app/webrtc/peerconnectionfactory.h"
36 #include "talk/app/webrtc/peerconnectioninterface.h" 36 #include "talk/app/webrtc/peerconnectioninterface.h"
37 #include "talk/app/webrtc/rtpreceiver.h"
38 #include "talk/app/webrtc/rtpsender.h"
37 #include "talk/app/webrtc/statscollector.h" 39 #include "talk/app/webrtc/statscollector.h"
38 #include "talk/app/webrtc/streamcollection.h" 40 #include "talk/app/webrtc/streamcollection.h"
39 #include "talk/app/webrtc/webrtcsession.h" 41 #include "talk/app/webrtc/webrtcsession.h"
40 #include "webrtc/base/scoped_ptr.h" 42 #include "webrtc/base/scoped_ptr.h"
41 43
42 namespace webrtc { 44 namespace webrtc {
43 class MediaStreamHandlerContainer;
44 45
45 typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration> 46 typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration>
46 StunConfigurations; 47 StunConfigurations;
47 typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration> 48 typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration>
48 TurnConfigurations; 49 TurnConfigurations;
49 50
50 // PeerConnectionImpl implements the PeerConnection interface. 51 // PeerConnection implements the PeerConnectionInterface interface.
51 // It uses MediaStreamSignaling and WebRtcSession to implement 52 // It uses MediaStreamSignaling and WebRtcSession to implement
52 // the PeerConnection functionality. 53 // the PeerConnection functionality.
53 class PeerConnection : public PeerConnectionInterface, 54 class PeerConnection : public PeerConnectionInterface,
54 public MediaStreamSignalingObserver, 55 public MediaStreamSignalingObserver,
55 public IceObserver, 56 public IceObserver,
56 public rtc::MessageHandler, 57 public rtc::MessageHandler,
57 public sigslot::has_slots<> { 58 public sigslot::has_slots<> {
58 public: 59 public:
59 explicit PeerConnection(PeerConnectionFactory* factory); 60 explicit PeerConnection(PeerConnectionFactory* factory);
60 61
61 bool Initialize( 62 bool Initialize(
62 const PeerConnectionInterface::RTCConfiguration& configuration, 63 const PeerConnectionInterface::RTCConfiguration& configuration,
63 const MediaConstraintsInterface* constraints, 64 const MediaConstraintsInterface* constraints,
64 PortAllocatorFactoryInterface* allocator_factory, 65 PortAllocatorFactoryInterface* allocator_factory,
65 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 66 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
66 PeerConnectionObserver* observer); 67 PeerConnectionObserver* observer);
67 virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams(); 68 virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams();
68 virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams(); 69 virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams();
69 virtual bool AddStream(MediaStreamInterface* local_stream); 70 virtual bool AddStream(MediaStreamInterface* local_stream);
70 virtual void RemoveStream(MediaStreamInterface* local_stream); 71 virtual void RemoveStream(MediaStreamInterface* local_stream);
71 72
72 virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( 73 virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
73 AudioTrackInterface* track); 74 AudioTrackInterface* track);
74 75
76 RtpSenderRefptrs GetSenders() const override;
77 RtpReceiverRefptrs GetReceivers() const override;
78
75 virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( 79 virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
76 const std::string& label, 80 const std::string& label,
77 const DataChannelInit* config); 81 const DataChannelInit* config);
78 virtual bool GetStats(StatsObserver* observer, 82 virtual bool GetStats(StatsObserver* observer,
79 webrtc::MediaStreamTrackInterface* track, 83 webrtc::MediaStreamTrackInterface* track,
80 StatsOutputLevel level); 84 StatsOutputLevel level);
81 85
82 virtual SignalingState signaling_state(); 86 virtual SignalingState signaling_state();
83 87
84 // TODO(bemasc): Remove ice_state() when callers are removed. 88 // TODO(bemasc): Remove ice_state() when callers are removed.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 return factory_->signaling_thread(); 165 return factory_->signaling_thread();
162 } 166 }
163 167
164 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, 168 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
165 const std::string& error); 169 const std::string& error);
166 170
167 bool IsClosed() const { 171 bool IsClosed() const {
168 return signaling_state_ == PeerConnectionInterface::kClosed; 172 return signaling_state_ == PeerConnectionInterface::kClosed;
169 } 173 }
170 174
175 typedef std::vector<rtc::scoped_refptr<BaseRtpSender>> BaseRtpSenderRefptrs;
176 typedef std::vector<rtc::scoped_refptr<BaseRtpReceiver>>
177 BaseRtpReceiverRefptrs;
pthatcher1 2015/09/24 06:32:29 The more I think about this, the more I think we s
Taylor Brandstetter 2015/09/24 20:54:20 Done.
178
179 BaseRtpSenderRefptrs::iterator FindRtpSenderForTrack(
180 MediaStreamTrackInterface* track);
181 BaseRtpReceiverRefptrs::iterator FindRtpReceiverForTrack(
182 MediaStreamTrackInterface* track);
183
171 // Storing the factory as a scoped reference pointer ensures that the memory 184 // Storing the factory as a scoped reference pointer ensures that the memory
172 // in the PeerConnectionFactoryImpl remains available as long as the 185 // in the PeerConnectionFactoryImpl remains available as long as the
173 // PeerConnection is running. It is passed to PeerConnection as a raw pointer. 186 // PeerConnection is running. It is passed to PeerConnection as a raw pointer.
174 // However, since the reference counting is done in the 187 // However, since the reference counting is done in the
175 // PeerConnectionFactoryInteface all instances created using the raw pointer 188 // PeerConnectionFactoryInteface all instances created using the raw pointer
176 // will refer to the same reference count. 189 // will refer to the same reference count.
177 rtc::scoped_refptr<PeerConnectionFactory> factory_; 190 rtc::scoped_refptr<PeerConnectionFactory> factory_;
178 PeerConnectionObserver* observer_; 191 PeerConnectionObserver* observer_;
179 UMAObserver* uma_observer_; 192 UMAObserver* uma_observer_;
180 SignalingState signaling_state_; 193 SignalingState signaling_state_;
181 // TODO(bemasc): Remove ice_state_. 194 // TODO(bemasc): Remove ice_state_.
182 IceState ice_state_; 195 IceState ice_state_;
183 IceConnectionState ice_connection_state_; 196 IceConnectionState ice_connection_state_;
184 IceGatheringState ice_gathering_state_; 197 IceGatheringState ice_gathering_state_;
185 198
186 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; 199 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
187 rtc::scoped_ptr<WebRtcSession> session_; 200 rtc::scoped_ptr<WebRtcSession> session_;
188 rtc::scoped_ptr<MediaStreamSignaling> mediastream_signaling_; 201 rtc::scoped_ptr<MediaStreamSignaling> mediastream_signaling_;
189 rtc::scoped_ptr<MediaStreamHandlerContainer> stream_handler_container_;
190 rtc::scoped_ptr<StatsCollector> stats_; 202 rtc::scoped_ptr<StatsCollector> stats_;
203
204 BaseRtpSenderRefptrs rtp_senders_;
205 BaseRtpReceiverRefptrs rtp_receivers_;
pthatcher1 2015/09/24 06:32:29 I think we can just call them senders_ and receive
Taylor Brandstetter 2015/09/24 20:54:20 Done.
191 }; 206 };
192 207
193 } // namespace webrtc 208 } // namespace webrtc
194 209
195 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ 210 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698