Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • gst-plugins-base gst-plugins-base
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 630
    • Issues 630
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 65
    • Merge requests 65
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamerGStreamer
  • gst-plugins-basegst-plugins-base
  • Issues
  • #799
Closed
Open
Issue created Jul 30, 2020 by Howard@YuHaoLin

Poor performance when doing gst_buffer_map after gldownload

OS: Windows 10 64bit
CPU: intel i7-8700 3.2GHz
Graphics Card: AMD Radeon RX5700
Gstreamer: 1.16.2/1.17.2

When I try to call gst_buffer_map to get data, it costs about 24ms to doing gst_buffer_map. It only happens when fetching data downloaded from glMemory on AMD graphics card. I tried to use another AMD graphics card, but the same result.

If I use NVIDIA or Intel graphics card, everything is ok.

The sample code below shows the problem which costs 24ms to do gst_buffer_map. Please help, thanks.

GTimer *ti;
GstPadProbeReturn get_data(GstPad *pPad, GstPadProbeInfo *pInfo, gpointer data) {
  GstBuffer *pBuffer = GST_BUFFER(pInfo->data);
  g_timer_start(ti);
  GstMapInfo mapInfo;
  gst_buffer_map(pBuffer, &mapInfo, GST_MAP_READ);
  gst_buffer_unmap(pBuffer, &mapInfo);
  gdouble second = g_timer_elapsed(ti, nullptr);  // 24 milliseconds
  return GST_PAD_PROBE_OK;
}

void play() {
  ti = g_timer_new();
  GstElement *p = gst_pipeline_new(nullptr);
  GstElement *src = gst_element_factory_make("gltestsrc", nullptr);
  g_object_set(src, "is-live", TRUE, nullptr);
  GstElement *download = gst_element_factory_make("gldownload", nullptr);
  GstElement *capsfilter = gst_element_factory_make("capsfilter", nullptr);
  GstCaps *caps = gst_caps_from_string("video/x-raw, width=1920, height=1080, framerate=60/1");
  g_object_set(capsfilter, "caps", caps, nullptr);
  GstElement *sink = gst_element_factory_make("fakesink", nullptr);
  gst_bin_add_many(GST_BIN(p), src, download, capsfilter, sink, nullptr);
  gst_element_link_many(src, download, capsfilter, sink, nullptr);
  GstPad *pad = gst_element_get_static_pad(sink, "sink");
  gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, get_data, this, nullptr);
  gst_object_unref(pad);
  gst_element_set_state(p, GST_STATE_PLAYING);
}
Edited Jul 30, 2020 by Howard
Assignee
Assign to
Time tracking