Lines 251-257
Link Here
|
251 |
/* upstream caps and size suggestions */ |
251 |
/* upstream caps and size suggestions */ |
252 |
GstCaps *sink_suggest; |
252 |
GstCaps *sink_suggest; |
253 |
guint size_suggest; |
253 |
guint size_suggest; |
254 |
gint suggest_pending; |
254 |
gboolean suggest_pending; |
255 |
|
255 |
|
256 |
gboolean reconfigure; |
256 |
gboolean reconfigure; |
257 |
}; |
257 |
}; |
Lines 1224-1230
Link Here
|
1224 |
gst_caps_unref (priv->sink_suggest); |
1224 |
gst_caps_unref (priv->sink_suggest); |
1225 |
priv->sink_suggest = gst_caps_ref (othercaps); |
1225 |
priv->sink_suggest = gst_caps_ref (othercaps); |
1226 |
priv->size_suggest = size_suggest; |
1226 |
priv->size_suggest = size_suggest; |
1227 |
g_atomic_int_set (&trans->priv->suggest_pending, 1); |
1227 |
trans->priv->suggest_pending = TRUE; |
1228 |
GST_OBJECT_UNLOCK (trans->sinkpad); |
1228 |
GST_OBJECT_UNLOCK (trans->sinkpad); |
1229 |
} |
1229 |
} |
1230 |
gst_caps_unref (othercaps); |
1230 |
gst_caps_unref (othercaps); |
Lines 1366-1372
Link Here
|
1366 |
GstBaseTransform *trans; |
1366 |
GstBaseTransform *trans; |
1367 |
GstBaseTransformPrivate *priv; |
1367 |
GstBaseTransformPrivate *priv; |
1368 |
GstFlowReturn res; |
1368 |
GstFlowReturn res; |
1369 |
gboolean proxy, suggest; |
1369 |
gboolean proxy, suggest, same_caps; |
1370 |
GstCaps *sink_suggest; |
1370 |
GstCaps *sink_suggest; |
1371 |
guint size_suggest; |
1371 |
guint size_suggest; |
1372 |
|
1372 |
|
Lines 1384-1391
Link Here
|
1384 |
|
1384 |
|
1385 |
/* we remember our previous alloc request to quickly see if we can proxy or |
1385 |
/* we remember our previous alloc request to quickly see if we can proxy or |
1386 |
* not. We skip this check if we have a pending suggestion. */ |
1386 |
* not. We skip this check if we have a pending suggestion. */ |
1387 |
if (g_atomic_int_get (&priv->suggest_pending) == 0 && caps && |
1387 |
GST_OBJECT_LOCK (pad); |
1388 |
gst_caps_is_equal (priv->sink_alloc, caps)) { |
1388 |
same_caps = !priv->suggest_pending && caps && |
|
|
1389 |
gst_caps_is_equal (priv->sink_alloc, caps); |
1390 |
GST_OBJECT_UNLOCK (pad); |
1391 |
|
1392 |
if (same_caps) { |
1389 |
/* we have seen this before, see below if we need to proxy */ |
1393 |
/* we have seen this before, see below if we need to proxy */ |
1390 |
GST_DEBUG_OBJECT (trans, "have old caps"); |
1394 |
GST_DEBUG_OBJECT (trans, "have old caps"); |
1391 |
sink_suggest = caps; |
1395 |
sink_suggest = caps; |
Lines 1414-1420
Link Here
|
1414 |
size_suggest = size; |
1418 |
size_suggest = size; |
1415 |
suggest = FALSE; |
1419 |
suggest = FALSE; |
1416 |
} |
1420 |
} |
1417 |
g_atomic_int_set (&priv->suggest_pending, 0); |
1421 |
priv->suggest_pending = FALSE; |
1418 |
GST_OBJECT_UNLOCK (pad); |
1422 |
GST_OBJECT_UNLOCK (pad); |
1419 |
|
1423 |
|
1420 |
/* check if we actually handle this format on the sinkpad */ |
1424 |
/* check if we actually handle this format on the sinkpad */ |
Lines 1462-1468
Link Here
|
1462 |
} |
1466 |
} |
1463 |
} |
1467 |
} |
1464 |
/* remember the new caps */ |
1468 |
/* remember the new caps */ |
|
|
1469 |
GST_OBJECT_LOCK (pad); |
1465 |
gst_caps_replace (&priv->sink_alloc, sink_suggest); |
1470 |
gst_caps_replace (&priv->sink_alloc, sink_suggest); |
|
|
1471 |
GST_OBJECT_UNLOCK (pad); |
1472 |
|
1466 |
proxy = priv->proxy_alloc; |
1473 |
proxy = priv->proxy_alloc; |
1467 |
GST_DEBUG_OBJECT (trans, "doing default alloc, proxy %d", proxy); |
1474 |
GST_DEBUG_OBJECT (trans, "doing default alloc, proxy %d", proxy); |
1468 |
|
1475 |
|
Lines 1487-1497
Link Here
|
1487 |
if (!gst_caps_is_equal (newcaps, caps)) { |
1494 |
if (!gst_caps_is_equal (newcaps, caps)) { |
1488 |
GST_DEBUG_OBJECT (trans, "caps are new"); |
1495 |
GST_DEBUG_OBJECT (trans, "caps are new"); |
1489 |
/* we have new caps, see if we can proxy downstream */ |
1496 |
/* we have new caps, see if we can proxy downstream */ |
1490 |
if (gst_pad_peer_accept_caps (trans->sinkpad, newcaps)) { |
1497 |
if (gst_pad_peer_accept_caps (pad, newcaps)) { |
1491 |
/* peer accepts the caps, return a buffer in this format */ |
1498 |
/* peer accepts the caps, return a buffer in this format */ |
1492 |
GST_DEBUG_OBJECT (trans, "peer accepted new caps"); |
1499 |
GST_DEBUG_OBJECT (trans, "peer accepted new caps"); |
1493 |
/* remember the format */ |
1500 |
/* remember the format */ |
|
|
1501 |
GST_OBJECT_LOCK (pad); |
1494 |
gst_caps_replace (&priv->sink_alloc, newcaps); |
1502 |
gst_caps_replace (&priv->sink_alloc, newcaps); |
|
|
1503 |
GST_OBJECT_UNLOCK (pad); |
1495 |
} else { |
1504 |
} else { |
1496 |
GST_DEBUG_OBJECT (trans, "peer did not accept new caps"); |
1505 |
GST_DEBUG_OBJECT (trans, "peer did not accept new caps"); |
1497 |
/* peer does not accept the caps, free the buffer we received and |
1506 |
/* peer does not accept the caps, free the buffer we received and |
Lines 2306-2312
Link Here
|
2306 |
caps = gst_caps_copy (caps); |
2315 |
caps = gst_caps_copy (caps); |
2307 |
trans->priv->sink_suggest = caps; |
2316 |
trans->priv->sink_suggest = caps; |
2308 |
trans->priv->size_suggest = size; |
2317 |
trans->priv->size_suggest = size; |
2309 |
g_atomic_int_set (&trans->priv->suggest_pending, 1); |
2318 |
trans->priv->suggest_pending = TRUE; |
2310 |
GST_DEBUG_OBJECT (trans, "new suggest %" GST_PTR_FORMAT, caps); |
2319 |
GST_DEBUG_OBJECT (trans, "new suggest %" GST_PTR_FORMAT, caps); |
2311 |
GST_OBJECT_UNLOCK (trans->sinkpad); |
2320 |
GST_OBJECT_UNLOCK (trans->sinkpad); |
2312 |
} |
2321 |
} |