File tree 2 files changed +23
-11
lines changed
2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -538,11 +538,16 @@ void PeerConnection::forwardMedia([[maybe_unused]] message_ptr message) {
538
538
if (auto handler = getMediaHandler ()) {
539
539
message_vector messages{std::move (message)};
540
540
541
- handler->incoming (messages, [this ](message_ptr message) {
542
- auto transport = std::atomic_load (&mDtlsTransport );
543
- if (auto srtpTransport = std::dynamic_pointer_cast<DtlsSrtpTransport>(transport))
544
- srtpTransport->send (std::move (message));
545
- });
541
+ try {
542
+ handler->incomingChain (messages, [this ](message_ptr message) {
543
+ auto transport = std::atomic_load (&mDtlsTransport );
544
+ if (auto srtpTransport = std::dynamic_pointer_cast<DtlsSrtpTransport>(transport))
545
+ srtpTransport->send (std::move (message));
546
+ });
547
+ } catch (const std::exception &e) {
548
+ PLOG_WARNING << " Exception in global incoming media handler: " << e.what ();
549
+ return ;
550
+ }
546
551
547
552
for (auto &m : messages)
548
553
dispatchMedia (std::move (m));
Original file line number Diff line number Diff line change @@ -141,12 +141,18 @@ void Track::incoming(message_ptr message) {
141
141
}
142
142
143
143
message_vector messages{std::move (message)};
144
- if (auto handler = getMediaHandler ())
145
- handler->incomingChain (messages, [this , weak_this = weak_from_this ()](message_ptr m) {
146
- if (auto locked = weak_this.lock ()) {
147
- transportSend (m);
148
- }
149
- });
144
+ if (auto handler = getMediaHandler ()) {
145
+ try {
146
+ handler->incomingChain (messages, [this , weak_this = weak_from_this ()](message_ptr m) {
147
+ if (auto locked = weak_this.lock ()) {
148
+ transportSend (m);
149
+ }
150
+ });
151
+ } catch (const std::exception &e) {
152
+ PLOG_WARNING << " Exception in incoming media handler: " << e.what ();
153
+ return ;
154
+ }
155
+ }
150
156
151
157
for (auto &m : messages) {
152
158
// Tail drop if queue is full
@@ -184,6 +190,7 @@ bool Track::outgoing(message_ptr message) {
184
190
transportSend (m);
185
191
}
186
192
});
193
+
187
194
bool ret = false ;
188
195
for (auto &m : messages)
189
196
ret = transportSend (std::move (m));
You can’t perform that action at this time.
0 commit comments