d3d11: Use gst_util_get_timestamp()

instead of duplicating the same code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4794>
This commit is contained in:
Seungha Yang 2023-06-07 20:32:41 +09:00 committed by GStreamer Marge Bot
parent c79649b6ec
commit 3c5684e085
5 changed files with 4 additions and 20 deletions

View file

@ -344,20 +344,6 @@ gst_d3d11_ipc_clock_is_system (GstClock * clock)
return false;
}
GstClockTime
gst_d3d11_ipc_clock_now (void)
{
static LARGE_INTEGER freq;
LARGE_INTEGER cur_time;
GST_D3D11_CALL_ONCE_BEGIN {
QueryPerformanceFrequency (&freq);
} GST_D3D11_CALL_ONCE_END;
QueryPerformanceCounter (&cur_time);
return gst_util_uint64_scale (cur_time.QuadPart, GST_SECOND, freq.QuadPart);
}
std::string
gst_d3d11_ipc_wstring_to_string (const std::wstring & str)
{

View file

@ -138,8 +138,6 @@ void gst_d3d11_ipc_pkt_build_fin (std::vector<guint8> & buf);
bool gst_d3d11_ipc_clock_is_system (GstClock * clock);
GstClockTime gst_d3d11_ipc_clock_now (void);
std::string gst_d3d11_ipc_wstring_to_string (const std::wstring & str);
std::wstring gst_d3d11_ipc_string_to_wstring (const std::string & str);

View file

@ -857,7 +857,7 @@ gst_d3d11_ipc_client_loop_thread_func (GstD3D11IpcClient * self)
DWORD mode = PIPE_READMODE_MESSAGE;
guint wait_ret;
HANDLE pipe = INVALID_HANDLE_VALUE;
GstClockTime start_time = gst_d3d11_ipc_clock_now ();
GstClockTime start_time = gst_util_get_timestamp ();
HANDLE waitables[] = { priv->cancellable, priv->wakeup_event };
std::wstring address = gst_d3d11_ipc_string_to_wstring (priv->address);
@ -895,7 +895,7 @@ gst_d3d11_ipc_client_loop_thread_func (GstD3D11IpcClient * self)
break;
if (priv->timeout > 0) {
diff = gst_d3d11_ipc_clock_now () - start_time;
diff = gst_util_get_timestamp () - start_time;
if (diff > priv->timeout) {
GST_WARNING_OBJECT (self, "Timeout");
priv->aborted = true;

View file

@ -713,7 +713,7 @@ gst_d3d11_ipc_sink_render (GstBaseSink * sink, GstBuffer * buf)
return GST_FLOW_ERROR;
}
pts = now_system = gst_d3d11_ipc_clock_now ();
pts = now_system = gst_util_get_timestamp ();
buf_pts = GST_BUFFER_PTS (buf);
if (!GST_CLOCK_TIME_IS_VALID (buf_pts))
buf_pts = GST_BUFFER_DTS (buf);

View file

@ -479,7 +479,7 @@ gst_d3d11_ipc_src_create (GstBaseSrc * src, guint64 offset, guint size,
if (ret != GST_FLOW_OK)
return ret;
now_system = gst_d3d11_ipc_clock_now ();
now_system = gst_util_get_timestamp ();
clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
now_gst = gst_clock_get_time (clock);
base_time = GST_ELEMENT_CAST (self)->base_time;