[Bug 729882] gstopusenc(gst_opus_enc_encode): use aux vars to minimize critical region

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Fri May 9 13:27:18 PDT 2014


https://bugzilla.gnome.org/show_bug.cgi?id=729882
  GStreamer | gst-plugins-bad | 1.2.4

--- Comment #2 from Sebastian Dröge (slomo) <slomo at coaxion.net> 2014-05-09 20:27:13 UTC ---
Review of attachment 276249:
 --> (https://bugzilla.gnome.org/review?bug=729882&attachment=276249)

::: ext/opus/gstopusenc.c
@@ +805,3 @@
+  n_channels = enc->n_channels;
+  frame_samples = enc->frame_samples;
+  state = enc->state;

Note that the number of channels does not need to be protected here (it's only
modified from the streaming thread), and that you need to ensure that the state
is also only changed from the streaming thread (which it probably is, I didn't
change the code). If the latter is not true, releasing the lock here is
introducing a race condition... but if it is true you also don't need to
protect it with the mutex at all. As far as I see this here you only need to
copy the values set from the GObject properties and have those protected with a
mutex, everything else is just fine.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list