speexenc: fix direction of latency query and other upstream queries
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 20 Mar 2009 01:02:26 +0000 (01:02 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 20 Mar 2009 01:06:14 +0000 (01:06 +0000)
Don't send queries back to the element they just came from by sending
them to the peer of the wrong pad.

ext/speex/gstspeexenc.c

index 631d90b..bbd463d 100644 (file)
@@ -495,8 +495,9 @@ gst_speex_enc_src_query (GstPad * pad, GstQuery * query)
       GstClockTime min_latency, max_latency;
       gint64 latency;
 
-      if ((res = gst_pad_peer_query (pad, query))) {
+      if ((res = gst_pad_peer_query (enc->sinkpad, query))) {
         gst_query_parse_latency (query, &live, &min_latency, &max_latency);
+        GST_LOG_OBJECT (pad, "Upstream latency: %" GST_PTR_FORMAT, query);
 
         latency = gst_speex_enc_get_latency (enc);
 
@@ -506,11 +507,12 @@ gst_speex_enc_src_query (GstPad * pad, GstQuery * query)
           max_latency += latency;
 
         gst_query_set_latency (query, live, min_latency, max_latency);
+        GST_LOG_OBJECT (pad, "Adjusted latency: %" GST_PTR_FORMAT, query);
       }
       break;
     }
     default:
-      res = gst_pad_peer_query (pad, query);
+      res = gst_pad_peer_query (enc->sinkpad, query);
       break;
   }