}
/**
- * gst_d3d11_allocator_get_texture_array_size:
- * @allocator: a #GstD3D11Allocator
- * @array_size: (out) (optional): the size of texture array
- * @num_texture_in_use: (out) (optional): the number of textures in use
- *
- * Returns: %TRUE if the size of texture array is known
- *
- * Since: 1.20
- */
-gboolean
-gst_d3d11_allocator_get_texture_array_size (GstD3D11Allocator * allocator,
- guint * array_size, guint * num_texture_in_use)
-{
- GstD3D11AllocatorPrivate *priv;
-
- g_return_val_if_fail (GST_IS_D3D11_ALLOCATOR (allocator), FALSE);
-
- priv = allocator->priv;
-
- /* For non-array-texture memory, the size is 1 */
- if (array_size)
- *array_size = priv->array_texture_size;
- if (num_texture_in_use)
- *num_texture_in_use = 1;
-
- /* size == 1 means we are not texture pool allocator */
- if (priv->array_texture_size == 1)
- return TRUE;
-
- if (num_texture_in_use) {
- GST_D3D11_ALLOCATOR_LOCK (allocator);
- *num_texture_in_use = priv->num_array_textures_in_use;
- GST_D3D11_ALLOCATOR_UNLOCK (allocator);
- }
-
- return TRUE;
-}
-
-/**
* gst_is_d3d11_memory:
* @mem: a #GstMemory
*
gboolean configured;
gboolean opened;
- gboolean reverse_playback;
-
GstD3D11Device *device;
ID3D11VideoDevice *video_device;
{
GstBuffer *buf = NULL;
GstFlowReturn ret;
- gboolean reverse_playback = FALSE;
- gboolean rate_changed = FALSE;
g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
- if (videodec->input_segment.rate < 0)
- reverse_playback = TRUE;
-
- if (reverse_playback != decoder->reverse_playback) {
- GST_DEBUG_OBJECT (videodec, "Rate was changed, need re-negotiation");
- rate_changed = TRUE;
- }
-
- if (!decoder->internal_pool || rate_changed) {
+ if (!decoder->internal_pool) {
gboolean reconfigured;
/* Replicate gst_video_decoder_allocate_output_buffer().
"Downstream was reconfigured, negotiating again");
GST_VIDEO_DECODER_STREAM_UNLOCK (videodec);
- if (reconfigured || rate_changed)
+ if (reconfigured)
gst_video_decoder_negotiate (videodec);
if (!gst_d3d11_decoder_prepare_output_view_pool (decoder)) {
size = (guint) vinfo.size;
}
- if (videodec->input_segment.rate >= 0) {
- decoder->reverse_playback = FALSE;
-
- /* Don't allow too large pool size */
- if (use_d3d11_pool) {
- guint prev_max = max;
-
- max = MAX (4, max);
- max = MAX (max, min);
-
- GST_DEBUG_OBJECT (videodec, "Update max size %d -> %d", prev_max, max);
- }
- } else {
- decoder->reverse_playback = TRUE;
- }
-
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_d3d11_decoder_can_direct_render (GstD3D11Decoder * decoder,
GstBuffer * view_buffer, GstMiniObject * picture)
{
- GstMemory *mem;
- GstD3D11Allocator *alloc;
- guint array_size, num_texture_in_use;
-
- g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (view_buffer), FALSE);
- g_return_val_if_fail (picture != NULL, FALSE);
-
- if (!decoder->can_direct_rendering || !decoder->downstream_supports_d3d11)
- return FALSE;
-
- /* XXX: Not a thread-safe way, but should not be a problem.
- * This object must be protected by videodecoder stream lock
- * and codec base classes are working on upstream streaming thread
- * (i.g., single threaded) */
-
- /* Baseclass is not holding this picture. So we can wait for this memory
- * to be consumed by downstream as it will be relased once it's processed
- * by downstream */
- if (GST_MINI_OBJECT_REFCOUNT (picture) == 1)
- return TRUE;
-
- mem = gst_buffer_peek_memory (view_buffer, 0);
- alloc = GST_D3D11_ALLOCATOR_CAST (mem->allocator);
-
- /* something went wrong */
- if (!gst_d3d11_allocator_get_texture_array_size (alloc, &array_size,
- &num_texture_in_use)) {
- GST_ERROR_OBJECT (decoder, "Couldn't query size of texture array");
- return FALSE;
- }
-
- GST_TRACE_OBJECT (decoder, "textures-in-use/array-size: %d/%d",
- num_texture_in_use, array_size);
-
- /* DPB pool is full now */
- if (num_texture_in_use >= array_size)
- return FALSE;
-
- return TRUE;
+ return FALSE;
}
/* Keep sync with chromium and keep in sorted order.