Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 #include "webrtc/api/rtpsenderinterface.h" | 83 #include "webrtc/api/rtpsenderinterface.h" |
| 84 #include "webrtc/api/stats/rtcstatscollectorcallback.h" | 84 #include "webrtc/api/stats/rtcstatscollectorcallback.h" |
| 85 #include "webrtc/api/statstypes.h" | 85 #include "webrtc/api/statstypes.h" |
| 86 #include "webrtc/api/umametrics.h" | 86 #include "webrtc/api/umametrics.h" |
| 87 #include "webrtc/base/fileutils.h" | 87 #include "webrtc/base/fileutils.h" |
| 88 #include "webrtc/base/network.h" | 88 #include "webrtc/base/network.h" |
| 89 #include "webrtc/base/rtccertificate.h" | 89 #include "webrtc/base/rtccertificate.h" |
| 90 #include "webrtc/base/rtccertificategenerator.h" | 90 #include "webrtc/base/rtccertificategenerator.h" |
| 91 #include "webrtc/base/socketaddress.h" | 91 #include "webrtc/base/socketaddress.h" |
| 92 #include "webrtc/base/sslstreamadapter.h" | 92 #include "webrtc/base/sslstreamadapter.h" |
| 93 #include "webrtc/call/callfactoryinterface.h" | |
| 94 #include "webrtc/logging/rtc_event_log/rtc_event_log_factory_interface.h" | |
| 93 #include "webrtc/media/base/mediachannel.h" | 95 #include "webrtc/media/base/mediachannel.h" |
| 94 #include "webrtc/media/base/videocapturer.h" | 96 #include "webrtc/media/base/videocapturer.h" |
| 95 #include "webrtc/p2p/base/portallocator.h" | 97 #include "webrtc/p2p/base/portallocator.h" |
| 96 | 98 |
| 97 namespace rtc { | 99 namespace rtc { |
| 98 class SSLIdentity; | 100 class SSLIdentity; |
| 99 class Thread; | 101 class Thread; |
| 100 } | 102 } |
| 101 | 103 |
| 102 namespace cricket { | 104 namespace cricket { |
| 105 class MediaEngineInterface; | |
| 103 class WebRtcVideoDecoderFactory; | 106 class WebRtcVideoDecoderFactory; |
| 104 class WebRtcVideoEncoderFactory; | 107 class WebRtcVideoEncoderFactory; |
| 105 } | 108 } |
| 106 | 109 |
| 107 namespace webrtc { | 110 namespace webrtc { |
| 108 class AudioDeviceModule; | 111 class AudioDeviceModule; |
| 109 class AudioMixer; | 112 class AudioMixer; |
| 113 class CallFactoryInterface; | |
| 110 class MediaConstraintsInterface; | 114 class MediaConstraintsInterface; |
| 111 | 115 |
| 112 // MediaStream container interface. | 116 // MediaStream container interface. |
| 113 class StreamCollectionInterface : public rtc::RefCountInterface { | 117 class StreamCollectionInterface : public rtc::RefCountInterface { |
| 114 public: | 118 public: |
| 115 // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. | 119 // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. |
| 116 virtual size_t count() = 0; | 120 virtual size_t count() = 0; |
| 117 virtual MediaStreamInterface* at(size_t index) = 0; | 121 virtual MediaStreamInterface* at(size_t index) = 0; |
| 118 virtual MediaStreamInterface* find(const std::string& label) = 0; | 122 virtual MediaStreamInterface* find(const std::string& label) = 0; |
| 119 virtual MediaStreamTrackInterface* FindAudioTrack( | 123 virtual MediaStreamTrackInterface* FindAudioTrack( |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 // TODO(ivoc) Remove after Chrome is updated. | 1015 // TODO(ivoc) Remove after Chrome is updated. |
| 1012 virtual void StopRtcEventLog() = 0; | 1016 virtual void StopRtcEventLog() = 0; |
| 1013 | 1017 |
| 1014 protected: | 1018 protected: |
| 1015 // Dtor and ctor protected as objects shouldn't be created or deleted via | 1019 // Dtor and ctor protected as objects shouldn't be created or deleted via |
| 1016 // this interface. | 1020 // this interface. |
| 1017 PeerConnectionFactoryInterface() {} | 1021 PeerConnectionFactoryInterface() {} |
| 1018 ~PeerConnectionFactoryInterface() {} // NOLINT | 1022 ~PeerConnectionFactoryInterface() {} // NOLINT |
| 1019 }; | 1023 }; |
| 1020 | 1024 |
| 1025 // Deprecated. Use the CreateModularPeerConnectionFactory instead. | |
| 1026 // | |
|
Taylor Brandstetter
2017/06/14 01:54:15
I don't think we need to deprecate CreatePeerConne
Zhi Huang
2017/06/14 06:57:01
Acknowledged.
| |
| 1021 // Create a new instance of PeerConnectionFactoryInterface. | 1027 // Create a new instance of PeerConnectionFactoryInterface. |
| 1022 // | 1028 // |
| 1023 // This method relies on the thread it's called on as the "signaling thread" | 1029 // This method relies on the thread it's called on as the "signaling thread" |
| 1024 // for the PeerConnectionFactory it creates. | 1030 // for the PeerConnectionFactory it creates. |
| 1025 // | 1031 // |
| 1026 // As such, if the current thread is not already running an rtc::Thread message | 1032 // As such, if the current thread is not already running an rtc::Thread message |
| 1027 // loop, an application using this method must eventually either call | 1033 // loop, an application using this method must eventually either call |
| 1028 // rtc::Thread::Current()->Run(), or call | 1034 // rtc::Thread::Current()->Run(), or call |
| 1029 // rtc::Thread::Current()->ProcessMessages() within the application's own | 1035 // rtc::Thread::Current()->ProcessMessages() within the application's own |
| 1030 // message loop. | 1036 // message loop. |
| 1031 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( | 1037 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 1032 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | 1038 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
| 1033 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory); | 1039 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory); |
| 1034 | 1040 |
| 1035 // Deprecated variant of the above. | 1041 // Deprecated. Use the CreateModularPeerConnectionFactory instead. |
| 1036 // TODO(kwiberg): Remove. | 1042 // TODO(kwiberg): Remove. |
| 1037 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 1043 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 1038 CreatePeerConnectionFactory(); | 1044 CreatePeerConnectionFactory(); |
| 1039 | 1045 |
| 1046 // Deprecated. Use the CreateModularPeerConnectionFactory instead. | |
| 1047 // | |
| 1040 // Create a new instance of PeerConnectionFactoryInterface. | 1048 // Create a new instance of PeerConnectionFactoryInterface. |
| 1041 // | 1049 // |
| 1042 // |network_thread|, |worker_thread| and |signaling_thread| are | 1050 // |network_thread|, |worker_thread| and |signaling_thread| are |
| 1043 // the only mandatory parameters. | 1051 // the only mandatory parameters. |
| 1044 // | 1052 // |
| 1045 // If non-null, a reference is added to |default_adm|, and ownership of | 1053 // If non-null, a reference is added to |default_adm|, and ownership of |
| 1046 // |video_encoder_factory| and |video_decoder_factory| is transferred to the | 1054 // |video_encoder_factory| and |video_decoder_factory| is transferred to the |
| 1047 // returned factory. | 1055 // returned factory. |
| 1048 // TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this | 1056 // TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this |
| 1049 // ownership transfer and ref counting more obvious. | 1057 // ownership transfer and ref counting more obvious. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1060 // Deprecated variant of the above. | 1068 // Deprecated variant of the above. |
| 1061 // TODO(kwiberg): Remove. | 1069 // TODO(kwiberg): Remove. |
| 1062 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( | 1070 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 1063 rtc::Thread* network_thread, | 1071 rtc::Thread* network_thread, |
| 1064 rtc::Thread* worker_thread, | 1072 rtc::Thread* worker_thread, |
| 1065 rtc::Thread* signaling_thread, | 1073 rtc::Thread* signaling_thread, |
| 1066 AudioDeviceModule* default_adm, | 1074 AudioDeviceModule* default_adm, |
| 1067 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 1075 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 1068 cricket::WebRtcVideoDecoderFactory* decoder_factory); | 1076 cricket::WebRtcVideoDecoderFactory* decoder_factory); |
| 1069 | 1077 |
| 1078 // Deprecated. Use the CreateModularPeerConnectionFactory instead. | |
| 1079 // | |
| 1070 // Create a new instance of PeerConnectionFactoryInterface with external audio | 1080 // Create a new instance of PeerConnectionFactoryInterface with external audio |
| 1071 // mixer. | 1081 // mixer. |
| 1072 // | 1082 // |
| 1073 // If |audio_mixer| is null, an internal audio mixer will be created and used. | 1083 // If |audio_mixer| is null, an internal audio mixer will be created and used. |
| 1074 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 1084 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 1075 CreatePeerConnectionFactoryWithAudioMixer( | 1085 CreatePeerConnectionFactoryWithAudioMixer( |
| 1076 rtc::Thread* network_thread, | 1086 rtc::Thread* network_thread, |
| 1077 rtc::Thread* worker_thread, | 1087 rtc::Thread* worker_thread, |
| 1078 rtc::Thread* signaling_thread, | 1088 rtc::Thread* signaling_thread, |
| 1079 AudioDeviceModule* default_adm, | 1089 AudioDeviceModule* default_adm, |
| 1080 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | 1090 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
| 1081 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, | 1091 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
| 1082 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 1092 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
| 1083 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, | 1093 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, |
| 1084 rtc::scoped_refptr<AudioMixer> audio_mixer); | 1094 rtc::scoped_refptr<AudioMixer> audio_mixer); |
| 1085 | 1095 |
| 1086 // Deprecated variant of the above. | 1096 // Deprecated variant of the above. |
| 1087 // TODO(kwiberg): Remove. | 1097 // TODO(kwiberg): Remove. |
| 1088 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 1098 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 1089 CreatePeerConnectionFactoryWithAudioMixer( | 1099 CreatePeerConnectionFactoryWithAudioMixer( |
| 1090 rtc::Thread* network_thread, | 1100 rtc::Thread* network_thread, |
| 1091 rtc::Thread* worker_thread, | 1101 rtc::Thread* worker_thread, |
| 1092 rtc::Thread* signaling_thread, | 1102 rtc::Thread* signaling_thread, |
| 1093 AudioDeviceModule* default_adm, | 1103 AudioDeviceModule* default_adm, |
| 1094 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 1104 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 1095 cricket::WebRtcVideoDecoderFactory* decoder_factory, | 1105 cricket::WebRtcVideoDecoderFactory* decoder_factory, |
| 1096 rtc::scoped_refptr<AudioMixer> audio_mixer); | 1106 rtc::scoped_refptr<AudioMixer> audio_mixer); |
| 1097 | 1107 |
| 1108 // Deprecated. Use the CreateModularPeerConnectionFactory instead. | |
| 1109 // | |
| 1098 // Create a new instance of PeerConnectionFactoryInterface. | 1110 // Create a new instance of PeerConnectionFactoryInterface. |
| 1099 // Same thread is used as worker and network thread. | 1111 // Same thread is used as worker and network thread. |
| 1100 inline rtc::scoped_refptr<PeerConnectionFactoryInterface> | 1112 inline rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 1101 CreatePeerConnectionFactory( | 1113 CreatePeerConnectionFactory( |
| 1102 rtc::Thread* worker_and_network_thread, | 1114 rtc::Thread* worker_and_network_thread, |
| 1103 rtc::Thread* signaling_thread, | 1115 rtc::Thread* signaling_thread, |
| 1104 AudioDeviceModule* default_adm, | 1116 AudioDeviceModule* default_adm, |
| 1105 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | 1117 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
| 1106 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, | 1118 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
| 1107 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 1119 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1119 rtc::Thread* worker_and_network_thread, | 1131 rtc::Thread* worker_and_network_thread, |
| 1120 rtc::Thread* signaling_thread, | 1132 rtc::Thread* signaling_thread, |
| 1121 AudioDeviceModule* default_adm, | 1133 AudioDeviceModule* default_adm, |
| 1122 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 1134 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 1123 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 1135 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| 1124 return CreatePeerConnectionFactory( | 1136 return CreatePeerConnectionFactory( |
| 1125 worker_and_network_thread, worker_and_network_thread, signaling_thread, | 1137 worker_and_network_thread, worker_and_network_thread, signaling_thread, |
| 1126 default_adm, encoder_factory, decoder_factory); | 1138 default_adm, encoder_factory, decoder_factory); |
| 1127 } | 1139 } |
| 1128 | 1140 |
| 1141 // Create a new instance of PeerConnectionFactoryInterface. | |
| 1142 // | |
| 1143 // |worker_thread| is the only mandatory parameter. If the |network_thread| or | |
| 1144 // the |signaling_thread| is null, the PeerConnectionFactory would create the | |
| 1145 // |network_thread| internally and use the thread which this method is called as | |
| 1146 // the |signaling_thread|. In this case, all the threads would be owned by the | |
| 1147 // PeerConnectionFactory. | |
| 1148 // | |
| 1149 // If all the threads passed in are non-null, the PeerConnectionFactory will not | |
| 1150 // own them. | |
|
Taylor Brandstetter
2017/06/14 01:54:15
This logic related to threads is pretty confusing.
Zhi Huang
2017/06/14 06:57:01
I think your suggestion is not equivalent to the o
Taylor Brandstetter
2017/06/15 00:35:02
We already talked about this in person, but for th
| |
| 1151 // | |
| 1152 // If non-null, a reference is added to |default_adm|, and ownership of | |
| 1153 // |video_encoder_factory| and |video_decoder_factory| is transferred to the | |
| 1154 // returned factory. | |
| 1155 // TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this | |
| 1156 // ownership transfer and ref counting more obvious. | |
| 1157 rtc::scoped_refptr<PeerConnectionFactoryInterface> | |
| 1158 CreateModularPeerConnectionFactory( | |
| 1159 rtc::Thread* network_thread, | |
| 1160 rtc::Thread* worker_thread, | |
| 1161 rtc::Thread* signaling_thread, | |
| 1162 AudioDeviceModule* default_adm, | |
| 1163 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | |
| 1164 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, | |
| 1165 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | |
| 1166 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, | |
| 1167 rtc::scoped_refptr<AudioMixer> audio_mixer, | |
| 1168 std::unique_ptr<cricket::MediaEngineInterface> media_engine, | |
| 1169 std::unique_ptr<CallFactoryInterface> call_factory, | |
| 1170 std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory); | |
| 1171 | |
| 1129 } // namespace webrtc | 1172 } // namespace webrtc |
| 1130 | 1173 |
| 1131 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 1174 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
| OLD | NEW |