diff --git a/gst-plugin-threadshare/src/proxy.rs b/gst-plugin-threadshare/src/proxy.rs index bea4fc933..dfc7776f1 100644 --- a/gst-plugin-threadshare/src/proxy.rs +++ b/gst-plugin-threadshare/src/proxy.rs @@ -449,15 +449,14 @@ impl ProxySink { { if let &Some(ref queue) = queue { let mut failed_item = None; - for item in items.drain(..) { + while let Some(item) = items.pop_front() { if let Err(item) = queue.push(item) { failed_item = Some(item); - break; } } - if let Some(item) = failed_item { - items.push_front(item); + if let Some(failed_item) = failed_item { + items.push_front(failed_item); *task = Some(task::current()); gst_log!( sink.cat, diff --git a/gst-plugin-threadshare/src/queue.rs b/gst-plugin-threadshare/src/queue.rs index 133842a0d..b297dcb42 100644 --- a/gst-plugin-threadshare/src/queue.rs +++ b/gst-plugin-threadshare/src/queue.rs @@ -344,15 +344,14 @@ impl Queue { let res = if let Some((ref mut task, _, ref mut items)) = *pending_queue { let mut failed_item = None; - for item in items.drain(..) { + while let Some(item) = items.pop_front() { if let Err(item) = dq.as_ref().unwrap().push(item) { failed_item = Some(item); - break; } } - if let Some(item) = failed_item { - items.push_front(item); + if let Some(failed_item) = failed_item { + items.push_front(failed_item); *task = Some(task::current()); gst_log!( queue.cat,