|
@@ -758,9 +758,17 @@ void PeerConnection::openTracks() {
|
|
|
#if RTC_ENABLE_MEDIA
|
|
|
if (auto transport = std::atomic_load(&mDtlsTransport)) {
|
|
|
auto srtpTransport = std::dynamic_pointer_cast<DtlsSrtpTransport>(transport);
|
|
|
- iterateTracks([&](shared_ptr<Track> track) {
|
|
|
- if (!track->isOpen())
|
|
|
- track->open(srtpTransport);
|
|
|
+
|
|
|
+ iterateTracks([&](const shared_ptr<Track>& track) {
|
|
|
+ if (!track->isOpen()) {
|
|
|
+ if (srtpTransport) {
|
|
|
+ track->open(srtpTransport);
|
|
|
+ } else {
|
|
|
+ auto errorMsg = "addTrack() was called, but srtp transport was not initialized. This is an optimization for use of the library with data channels only. Set config.forceMediaTransport to 'true' to get the transport initialized before dynamically adding tracks.";
|
|
|
+ PLOG_ERROR << errorMsg;
|
|
|
+ track->triggerError(errorMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
#endif
|