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

Side by Side Diff: webrtc/ortc/ortcfactory.h

Issue 2675173003: Adding "adapter" ORTC objects on top of ChannelManager/BaseChannel/etc. (Closed)
Patch Set: Move ORTC files to different subdirectories Created 3 years, 10 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
(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_ORTC_ORTCFACTORY_H_
12 #define WEBRTC_ORTC_ORTCFACTORY_H_
13
14 #include <memory>
15 #include <string>
16
17 #include "webrtc/api/ortc/ortcfactoryinterface.h"
18 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/base/scoped_ref_ptr.h"
20 #include "webrtc/media/engine/webrtcmediaengine.h"
21 #include "webrtc/pc/channelmanager.h"
22
23 namespace webrtc {
24
25 // Implementation of OrtcFactoryInterface.
26 //
27 // See ortcfactoryinterface.h for documentation.
28 class OrtcFactory : public OrtcFactoryInterface {
29 public:
30 ~OrtcFactory() override;
31
32 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>
33 CreateRtpTransportController() override;
34
35 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateRtpTransport(
36 const RtcpParameters& rtcp_parameters,
37 PacketTransportInterface* rtp,
38 PacketTransportInterface* rtcp,
39 RtpTransportControllerInterface* transport_controller) override;
40
41 RtpCapabilities GetRtpSenderCapabilities(
42 cricket::MediaType kind) const override;
43
44 RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
45 rtc::scoped_refptr<MediaStreamTrackInterface> track,
46 const RtpParameters& rtp_parameters,
47 RtpTransportInterface* transport) override;
48
49 RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
50 cricket::MediaType kind,
51 const RtpParameters& rtp_parameters,
52 RtpTransportInterface* transport) override;
53
54 RtpCapabilities GetRtpReceiverCapabilities(
55 cricket::MediaType kind) const override;
56
57 RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>> CreateRtpReceiver(
58 cricket::MediaType kind,
59 const RtpParameters& rtp_parameters,
60 RtpTransportInterface* transport) override;
61
62 RTCErrorOr<std::unique_ptr<UdpTransportInterface>>
63 CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override;
64
65 rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
66 const cricket::AudioOptions& options) override;
67
68 rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
69 std::unique_ptr<cricket::VideoCapturer> capturer,
70 const MediaConstraintsInterface* constraints) override;
71
72 rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
73 const std::string& id,
74 VideoTrackSourceInterface* source) override;
75
76 rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack(
77 const std::string& id,
78 AudioSourceInterface* source) override;
79
80 rtc::Thread* network_thread() { return network_thread_; }
81 rtc::Thread* worker_thread() { return worker_thread_.get(); }
82 rtc::Thread* signaling_thread() { return signaling_thread_; }
83
84 private:
85 // Should only be called by OrtcFactoryInterface::Create.
86 OrtcFactory(rtc::Thread* network_thread,
87 rtc::Thread* signaling_thread,
88 rtc::NetworkManager* network_manager,
89 rtc::PacketSocketFactory* socket_factory,
90 AudioDeviceModule* adm);
91
92 // Performs initialization that can fail. Called by factory method after
93 // construction, and if it fails, no object is returned.
94 RTCError Initialize();
95 std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine_w();
96
97 // Threads and networking objects.
98 rtc::Thread* network_thread_;
99 rtc::Thread* signaling_thread_;
100 rtc::NetworkManager* network_manager_;
101 rtc::PacketSocketFactory* socket_factory_;
102 AudioDeviceModule* adm_;
103 // If we created/own the objects above, these will be non-null and thus will
104 // be released automatically upon destruction.
105 std::unique_ptr<rtc::Thread> owned_network_thread_;
106 bool wraps_signaling_thread_ = false;
107 std::unique_ptr<rtc::NetworkManager> owned_network_manager_;
108 std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
109 // We always own the worker thread.
110 std::unique_ptr<rtc::Thread> worker_thread_;
111 // Media-releated objects.
112 std::unique_ptr<RtcEventLog> null_event_log_;
113 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_;
114 std::unique_ptr<cricket::ChannelManager> channel_manager_;
115
116 friend class OrtcFactoryInterface;
117
118 RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory);
119 };
120
121 } // namespace webrtc
122
123 #endif // WEBRTC_ORTC_ORTCFACTORY_H_
OLDNEW
« no previous file with comments | « webrtc/ortc/DEPS ('k') | webrtc/ortc/ortcfactory.cc » ('j') | webrtc/pc/rtpreceiver.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698