summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext.c
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2022-01-05 11:52:07 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2022-01-05 11:56:58 +0800
commit7c6f9b9d638a9ae6020c8a388d5a6f2a89620663 (patch)
tree0da5f31b4b67a9b1895fdef0c1ee5c5d4d5bfca5 /libavutil/hwcontext.c
parent8d4c0c8823194c71bb825f2ccd28b912f3791e08 (diff)
Revert "avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions"
This reverts commit a4289497755386435783774a4f520eb7fc23cbc9. There were objections on ML (see https://ffmpeg.org/pipermail/ffmpeg-devel/2021-December/290530.html) Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Diffstat (limited to 'libavutil/hwcontext.c')
-rw-r--r--libavutil/hwcontext.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 1a50635018..31c7840dba 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -122,7 +122,6 @@ static const AVClass hwdevice_ctx_class = {
static void hwdevice_ctx_free(void *opaque, uint8_t *data)
{
AVHWDeviceContext *ctx = (AVHWDeviceContext*)data;
- int i;
/* uninit might still want access the hw context and the user
* free() callback might destroy it, so uninit has to be called first */
@@ -133,8 +132,6 @@ static void hwdevice_ctx_free(void *opaque, uint8_t *data)
ctx->free(ctx);
av_buffer_unref(&ctx->internal->source_device);
- for (i = 0; i < AV_HWDEVICE_TYPE_NB; i++)
- av_buffer_unref(&ctx->internal->derived_devices[i]);
av_freep(&ctx->hwctx);
av_freep(&ctx->internal->priv);
@@ -646,26 +643,6 @@ fail:
return ret;
}
-static AVBufferRef* find_derived_hwdevice_ctx(AVBufferRef *src_ref, enum AVHWDeviceType type)
-{
- AVBufferRef *tmp_ref;
- AVHWDeviceContext *src_ctx;
- int i;
-
- src_ctx = (AVHWDeviceContext*)src_ref->data;
- if (src_ctx->type == type)
- return src_ref;
-
- for (i = 0; i < AV_HWDEVICE_TYPE_NB; i++)
- if (src_ctx->internal->derived_devices[i]) {
- tmp_ref = find_derived_hwdevice_ctx(src_ctx->internal->derived_devices[i], type);
- if (tmp_ref)
- return tmp_ref;
- }
-
- return NULL;
-}
-
int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr,
enum AVHWDeviceType type,
AVBufferRef *src_ref,
@@ -689,16 +666,6 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr,
tmp_ref = tmp_ctx->internal->source_device;
}
- tmp_ref = find_derived_hwdevice_ctx(src_ref, type);
- if (tmp_ref) {
- dst_ref = av_buffer_ref(tmp_ref);
- if (!dst_ref) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- goto done;
- }
-
dst_ref = av_hwdevice_ctx_alloc(type);
if (!dst_ref) {
ret = AVERROR(ENOMEM);
@@ -720,11 +687,6 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr,
ret = AVERROR(ENOMEM);
goto fail;
}
- tmp_ctx->internal->derived_devices[type] = av_buffer_ref(dst_ref);
- if (!tmp_ctx->internal->derived_devices[type]) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
ret = av_hwdevice_ctx_init(dst_ref);
if (ret < 0)
goto fail;