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

Side by Side Diff: talk/examples/peerconnection/client/conductor.h

Issue 1235563006: Move talk/examples/* to webrtc/examples. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 201508051337 Created 5 years, 4 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
« no previous file with comments | « talk/examples/objc/README ('k') | talk/examples/peerconnection/client/conductor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
28 #ifndef TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
29 #define TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
30 #pragma once
31
32 #include <deque>
33 #include <map>
34 #include <set>
35 #include <string>
36
37 #include "talk/app/webrtc/mediastreaminterface.h"
38 #include "talk/app/webrtc/peerconnectioninterface.h"
39 #include "talk/examples/peerconnection/client/main_wnd.h"
40 #include "talk/examples/peerconnection/client/peer_connection_client.h"
41 #include "webrtc/base/scoped_ptr.h"
42
43 namespace webrtc {
44 class VideoCaptureModule;
45 } // namespace webrtc
46
47 namespace cricket {
48 class VideoRenderer;
49 } // namespace cricket
50
51 class Conductor
52 : public webrtc::PeerConnectionObserver,
53 public webrtc::CreateSessionDescriptionObserver,
54 public PeerConnectionClientObserver,
55 public MainWndCallback {
56 public:
57 enum CallbackID {
58 MEDIA_CHANNELS_INITIALIZED = 1,
59 PEER_CONNECTION_CLOSED,
60 SEND_MESSAGE_TO_PEER,
61 NEW_STREAM_ADDED,
62 STREAM_REMOVED,
63 };
64
65 Conductor(PeerConnectionClient* client, MainWindow* main_wnd);
66
67 bool connection_active() const;
68
69 virtual void Close();
70
71 protected:
72 ~Conductor();
73 bool InitializePeerConnection();
74 bool ReinitializePeerConnectionForLoopback();
75 bool CreatePeerConnection(bool dtls);
76 void DeletePeerConnection();
77 void EnsureStreamingUI();
78 void AddStreams();
79 cricket::VideoCapturer* OpenVideoCaptureDevice();
80
81 //
82 // PeerConnectionObserver implementation.
83 //
84 virtual void OnStateChange(
85 webrtc::PeerConnectionObserver::StateType state_changed) {}
86 virtual void OnAddStream(webrtc::MediaStreamInterface* stream);
87 virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream);
88 virtual void OnDataChannel(webrtc::DataChannelInterface* channel) {}
89 virtual void OnRenegotiationNeeded() {}
90 virtual void OnIceChange() {}
91 virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate);
92
93 //
94 // PeerConnectionClientObserver implementation.
95 //
96
97 virtual void OnSignedIn();
98
99 virtual void OnDisconnected();
100
101 virtual void OnPeerConnected(int id, const std::string& name);
102
103 virtual void OnPeerDisconnected(int id);
104
105 virtual void OnMessageFromPeer(int peer_id, const std::string& message);
106
107 virtual void OnMessageSent(int err);
108
109 virtual void OnServerConnectionFailure();
110
111 //
112 // MainWndCallback implementation.
113 //
114
115 virtual void StartLogin(const std::string& server, int port);
116
117 virtual void DisconnectFromServer();
118
119 virtual void ConnectToPeer(int peer_id);
120
121 virtual void DisconnectFromCurrentPeer();
122
123 virtual void UIThreadCallback(int msg_id, void* data);
124
125 // CreateSessionDescriptionObserver implementation.
126 virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc);
127 virtual void OnFailure(const std::string& error);
128
129 protected:
130 // Send a message to the remote peer.
131 void SendMessage(const std::string& json_object);
132
133 int peer_id_;
134 bool loopback_;
135 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
136 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
137 peer_connection_factory_;
138 PeerConnectionClient* client_;
139 MainWindow* main_wnd_;
140 std::deque<std::string*> pending_messages_;
141 std::map<std::string, rtc::scoped_refptr<webrtc::MediaStreamInterface> >
142 active_streams_;
143 std::string server_;
144 };
145
146 #endif // TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
OLDNEW
« no previous file with comments | « talk/examples/objc/README ('k') | talk/examples/peerconnection/client/conductor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698