mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
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:
parent
c79649b6ec
commit
3c5684e085
5 changed files with 4 additions and 20 deletions
|
@ -344,20 +344,6 @@ gst_d3d11_ipc_clock_is_system (GstClock * clock)
|
||||||
return false;
|
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
|
std::string
|
||||||
gst_d3d11_ipc_wstring_to_string (const std::wstring & str)
|
gst_d3d11_ipc_wstring_to_string (const std::wstring & str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,8 +138,6 @@ void gst_d3d11_ipc_pkt_build_fin (std::vector<guint8> & buf);
|
||||||
|
|
||||||
bool gst_d3d11_ipc_clock_is_system (GstClock * clock);
|
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::string gst_d3d11_ipc_wstring_to_string (const std::wstring & str);
|
||||||
|
|
||||||
std::wstring gst_d3d11_ipc_string_to_wstring (const std::string & str);
|
std::wstring gst_d3d11_ipc_string_to_wstring (const std::string & str);
|
||||||
|
|
|
@ -857,7 +857,7 @@ gst_d3d11_ipc_client_loop_thread_func (GstD3D11IpcClient * self)
|
||||||
DWORD mode = PIPE_READMODE_MESSAGE;
|
DWORD mode = PIPE_READMODE_MESSAGE;
|
||||||
guint wait_ret;
|
guint wait_ret;
|
||||||
HANDLE pipe = INVALID_HANDLE_VALUE;
|
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 };
|
HANDLE waitables[] = { priv->cancellable, priv->wakeup_event };
|
||||||
std::wstring address = gst_d3d11_ipc_string_to_wstring (priv->address);
|
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;
|
break;
|
||||||
|
|
||||||
if (priv->timeout > 0) {
|
if (priv->timeout > 0) {
|
||||||
diff = gst_d3d11_ipc_clock_now () - start_time;
|
diff = gst_util_get_timestamp () - start_time;
|
||||||
if (diff > priv->timeout) {
|
if (diff > priv->timeout) {
|
||||||
GST_WARNING_OBJECT (self, "Timeout");
|
GST_WARNING_OBJECT (self, "Timeout");
|
||||||
priv->aborted = true;
|
priv->aborted = true;
|
||||||
|
|
|
@ -713,7 +713,7 @@ gst_d3d11_ipc_sink_render (GstBaseSink * sink, GstBuffer * buf)
|
||||||
return GST_FLOW_ERROR;
|
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);
|
buf_pts = GST_BUFFER_PTS (buf);
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (buf_pts))
|
if (!GST_CLOCK_TIME_IS_VALID (buf_pts))
|
||||||
buf_pts = GST_BUFFER_DTS (buf);
|
buf_pts = GST_BUFFER_DTS (buf);
|
||||||
|
|
|
@ -479,7 +479,7 @@ gst_d3d11_ipc_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
now_system = gst_d3d11_ipc_clock_now ();
|
now_system = gst_util_get_timestamp ();
|
||||||
clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
|
clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
|
||||||
now_gst = gst_clock_get_time (clock);
|
now_gst = gst_clock_get_time (clock);
|
||||||
base_time = GST_ELEMENT_CAST (self)->base_time;
|
base_time = GST_ELEMENT_CAST (self)->base_time;
|
||||||
|
|
Loading…
Reference in a new issue