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

Unified 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: Fixing indentation. 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 side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/peerconnection.h
diff --git a/talk/app/webrtc/peerconnection.h b/talk/app/webrtc/peerconnection.h
index 2160afb241c392084be3f22bea0669a1aa62769e..a77b3f6d9d30fcd2a7801e0e1bc399cc67fc41af 100644
--- a/talk/app/webrtc/peerconnection.h
+++ b/talk/app/webrtc/peerconnection.h
@@ -29,25 +29,27 @@
#define TALK_APP_WEBRTC_PEERCONNECTION_H_
#include <string>
+#include <utility> // for std::pair
#include "talk/app/webrtc/dtlsidentitystore.h"
#include "talk/app/webrtc/mediastreamsignaling.h"
#include "talk/app/webrtc/peerconnectionfactory.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
+#include "talk/app/webrtc/rtpreceiver.h"
+#include "talk/app/webrtc/rtpsender.h"
#include "talk/app/webrtc/statscollector.h"
#include "talk/app/webrtc/streamcollection.h"
#include "talk/app/webrtc/webrtcsession.h"
#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
-class MediaStreamHandlerContainer;
typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration>
StunConfigurations;
typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration>
TurnConfigurations;
-// PeerConnectionImpl implements the PeerConnection interface.
+// PeerConnection implements the PeerConnectionInterface interface.
// It uses MediaStreamSignaling and WebRtcSession to implement
// the PeerConnection functionality.
class PeerConnection : public PeerConnectionInterface,
@@ -72,6 +74,9 @@ class PeerConnection : public PeerConnectionInterface,
virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
AudioTrackInterface* track);
+ RtpSenderRefptrs GetSenders() const override;
+ RtpReceiverRefptrs GetReceivers() const override;
+
virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
const std::string& label,
const DataChannelInit* config);
@@ -168,6 +173,21 @@ class PeerConnection : public PeerConnectionInterface,
return signaling_state_ == PeerConnectionInterface::kClosed;
}
+ typedef std::pair<rtc::scoped_refptr<BaseRtpSender>,
+ rtc::scoped_refptr<RtpSenderInterface>> RtpSenderPair;
+ typedef std::pair<rtc::scoped_refptr<BaseRtpReceiver>,
+ rtc::scoped_refptr<RtpReceiverInterface>> RtpReceiverPair;
pthatcher1 2015/09/23 14:47:39 This seems a bit too complicated. Can we just mov
+ typedef std::vector<RtpSenderPair> RtpSenderPairList;
+ typedef std::vector<RtpReceiverPair> RtpReceiverPairList;
+
+ void AddRtpSender(BaseRtpSender* sender);
+ void AddRtpReceiver(BaseRtpReceiver* receiver);
+
+ RtpSenderPairList::iterator FindRtpSenderPairForTrack(
+ MediaStreamTrackInterface* track);
+ RtpReceiverPairList::iterator FindRtpReceiverPairForTrack(
+ MediaStreamTrackInterface* track);
+
// Storing the factory as a scoped reference pointer ensures that the memory
// in the PeerConnectionFactoryImpl remains available as long as the
// PeerConnection is running. It is passed to PeerConnection as a raw pointer.
@@ -186,8 +206,13 @@ class PeerConnection : public PeerConnectionInterface,
rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
rtc::scoped_ptr<WebRtcSession> session_;
rtc::scoped_ptr<MediaStreamSignaling> mediastream_signaling_;
- rtc::scoped_ptr<MediaStreamHandlerContainer> stream_handler_container_;
rtc::scoped_ptr<StatsCollector> stats_;
+
+ // Store pairs of base pointers and pointers to proxy objects, so that when
+ // GetSenders/GetReceivers is called, we can return the same proxy objects
+ // each time.
+ RtpSenderPairList rtp_sender_pairs_;
+ RtpReceiverPairList rtp_receiver_pairs_;
pthatcher1 2015/09/23 14:47:39 ***
pthatcher1 2015/09/23 14:59:09 This was a not to myself to come back and say "Why
};
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698