srtpdec: Simplify locking in gst_srtp_dec_decode_buffer

Don't drop the lock on filter just to unmap the buffer (or log a
message).
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-03-15 11:03:52 +01:00
parent b541b58937
commit 34eaeb17f2
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5

View file

@ -1382,8 +1382,6 @@ unprotect:
#endif #endif
} }
GST_OBJECT_UNLOCK (filter);
if (err != srtp_err_status_ok) { if (err != srtp_err_status_ok) {
GST_WARNING_OBJECT (pad, GST_WARNING_OBJECT (pad,
"Unable to unprotect buffer (unprotect failed code %d)", err); "Unable to unprotect buffer (unprotect failed code %d)", err);
@ -1391,7 +1389,6 @@ unprotect:
/* Signal user depending on type of error */ /* Signal user depending on type of error */
switch (err) { switch (err) {
case srtp_err_status_key_expired: case srtp_err_status_key_expired:
GST_OBJECT_LOCK (filter);
/* Update stream */ /* Update stream */
if (find_stream_by_ssrc (filter, ssrc)) { if (find_stream_by_ssrc (filter, ssrc)) {
@ -1400,6 +1397,7 @@ unprotect:
GST_OBJECT_LOCK (filter); GST_OBJECT_LOCK (filter);
goto unprotect; goto unprotect;
} else { } else {
GST_OBJECT_LOCK (filter);
GST_WARNING_OBJECT (filter, "Hard limit reached, no new key, " GST_WARNING_OBJECT (filter, "Hard limit reached, no new key, "
"dropping"); "dropping");
} }
@ -1420,16 +1418,11 @@ unprotect:
} }
gst_buffer_unmap (buf, &map); gst_buffer_unmap (buf, &map);
GST_OBJECT_LOCK (filter);
return FALSE; return FALSE;
} }
gst_buffer_unmap (buf, &map); gst_buffer_unmap (buf, &map);
gst_buffer_set_size (buf, size); gst_buffer_set_size (buf, size);
GST_OBJECT_LOCK (filter);
return TRUE; return TRUE;
} }