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

Side by Side Diff: webrtc/api/ortcfactoryinterface.h

Issue 2632613002: Adding OrtcFactory, and changing UdpTransport to match current plan. (Closed)
Patch Set: Adding OrtcFactoryInterface and factory method Created 3 years, 11 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 | « webrtc/api/ortcfactory_unittest.cc ('k') | webrtc/api/udptransportinterface.h » ('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 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_API_ORTCFACTORYINTERFACE_H_
12 #define WEBRTC_API_ORTCFACTORYINTERFACE_H_
13
14 #include <memory>
15
16 #include "webrtc/api/udptransportinterface.h"
17 #include "webrtc/base/network.h"
18 #include "webrtc/base/thread.h"
19 #include "webrtc/p2p/base/packetsocketfactory.h"
20
21 namespace webrtc {
22
23 // WARNING: This is experimental/under development, so use at your own risk; no
24 // guarantee about API stability is guaranteed here yet.
25 //
26 // This class is the ORTC analog of PeerConnectionFactory. It acts as a factory
27 // for ORTC objects that can be connected to each other.
28 //
29 // Some of these objects may not be represented by the ORTC specification, but
30 // follow the same general principles.
31 //
32 // On object lifetimes: The factory must not be destroyed before destroying the
33 // objects it created, and the objects passed into the factory must not be
34 // destroyed before destroying the factory.
35 class OrtcFactoryInterface {
36 public:
37 // |network_thread| is the thread on which packets are sent and received.
38 // If null, a new rtc::Thread with a default socket server is created.
39 //
40 // |worker_thread| is used for CPU-intensive operations.
41 // If null, a new rtc::Thread is created.
pthatcher1 2017/01/18 02:42:46 So the problem here is that the worker_thread is *
Taylor Brandstetter 2017/01/18 22:19:04 If the worker thread is just an artifact, and we w
42 //
43 // Note: In our current implementation, some API calls that deal with the
44 // media engine (such as RtpSender.SetParameters) will block on the worker
45 // thread.
46 // TODO(deadbeef): Fix this.
47 //
48 // |signaling_thread| is used for callbacks to the consumer of the API. If
49 // null, the current thread will be used, which assumes that the API consumer
50 // is running a message loop on this thread (either using an existing
51 // rtc::Thread, or by calling rtc::Thread::Current()->ProcessMessages).
52 //
53 // |network_manager| is used to determine which network interfaces are
54 // available. This is used for ICE, for example. If null, a default
55 // implementation will be used. Only accessed on |network_thread|.
56 //
57 // |socket_factory| is used (on the network thread) for creating sockets. If
58 // it's null, a default implementation will be used, which assumes
59 // |network_thread| is a normal rtc::Thread.
60 //
61 // Note that the OrtcFactoryInterface does not take ownership of any of the
62 // objects
63 // passed in, and as previously stated, these objects can't be destroyed
64 // before the factory is.
65 static std::unique_ptr<OrtcFactoryInterface> Create(
66 rtc::Thread* network_thread,
67 rtc::Thread* worker_thread,
68 rtc::Thread* signaling_thread,
69 rtc::NetworkManager* network_manager,
70 rtc::PacketSocketFactory* socket_factory);
71 // Constructor for convenience which uses default implementations of
72 // everything (though does still require that the current thread runs a
73 // message loop; see above).
74 static std::unique_ptr<OrtcFactoryInterface> Create() {
75 return Create(nullptr, nullptr, nullptr, nullptr, nullptr);
76 }
77
78 virtual ~OrtcFactoryInterface() {}
79
80 virtual std::unique_ptr<UdpTransportInterface>
81 CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) = 0;
82 // Method for convenience that has no port range restrictions.
83 std::unique_ptr<UdpTransportInterface> CreateUdpTransport(int family) {
84 return CreateUdpTransport(family, 0, 0);
85 }
86 };
87
88 } // namespace webrtc
89
90 #endif // WEBRTC_API_ORTCFACTORYINTERFACE_H_
OLDNEW
« no previous file with comments | « webrtc/api/ortcfactory_unittest.cc ('k') | webrtc/api/udptransportinterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698