- } else if (GST_ELEMENT (qtmux)->sinkpads->next) {
- /* Only switch pads if we have more than one, otherwise
- * we can just put everything into a single chunk and save
- * a few bytes of offsets
- */
- if (qtmux->current_pad)
- GST_DEBUG_OBJECT (qtmux, "Switching from pad %s:%s",
- GST_DEBUG_PAD_NAME (qtmux->current_pad));
- best_pad = qtmux->current_pad = NULL;
+ } else {
+ GST_OBJECT_LOCK (qtmux);
+ if (GST_ELEMENT (qtmux)->sinkpads->next) {
+ /* Only switch pads if we have more than one, otherwise
+ * we can just put everything into a single chunk and save
+ * a few bytes of offsets
+ */
+ if (qtmux->current_pad)
+ GST_DEBUG_OBJECT (qtmux, "Switching from pad %s:%s",
+ GST_DEBUG_PAD_NAME (qtmux->current_pad));
+ best_pad = qtmux->current_pad = NULL;
+ }
+ GST_OBJECT_UNLOCK (qtmux);