diff --git a/src/common/jingle_rtp.py b/src/common/jingle_rtp.py index ae53adcac..84b4d9195 100644 --- a/src/common/jingle_rtp.py +++ b/src/common/jingle_rtp.py @@ -15,6 +15,8 @@ Handles Jingle RTP sessions (XEP 0167) """ +from collections import deque + import gobject import socket @@ -122,15 +124,15 @@ class JingleRTPContent(JingleContent): """ if self._dtmf_running: raise Exception("There is a DTMF batch already running") - events = list(events) + events = deque(events) self._dtmf_running = True - self._start_dtmf(events.pop(0)) + self._start_dtmf(events.popleft()) gobject.timeout_add(500, self._next_dtmf, events) def _next_dtmf(self, events): self._stop_dtmf() if events: - self._start_dtmf(events.pop(0)) + self._start_dtmf(events.popleft()) gobject.timeout_add(500, self._next_dtmf, events) else: self._dtmf_running = False