Anton Baskanov : winegstreamer: Set sample timestamps in MPEG audio decoder.

Alexandre Julliard julliard at winehq.org
Wed May 11 16:10:25 CDT 2022


Module: wine
Branch: master
Commit: 2567ff497d40cbc43a1d5d766636b6dd77fc4618
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2567ff497d40cbc43a1d5d766636b6dd77fc4618

Author: Anton Baskanov <baskanov at gmail.com>
Date:   Tue Apr 12 14:38:55 2022 +0700

winegstreamer: Set sample timestamps in MPEG audio decoder.

Signed-off-by: Anton Baskanov <baskanov at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/mpegaudio.c         |  6 +++---
 dlls/winegstreamer/quartz_transform.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/dlls/quartz/tests/mpegaudio.c b/dlls/quartz/tests/mpegaudio.c
index 5fdf443f3c8..75b85ee8716 100644
--- a/dlls/quartz/tests/mpegaudio.c
+++ b/dlls/quartz/tests/mpegaudio.c
@@ -888,11 +888,11 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample
     start = 0xdeadbeef;
     stop = 0xdeadbeef;
     hr = IMediaSample_GetTime(sample, &start, &stop);
-    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (filter->got_sample == 1)
     {
-        todo_wine ok(start == filter->expected_start_time, "Got start time %s.\n", wine_dbgstr_longlong(start));
-        todo_wine ok(stop == filter->expected_stop_time, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
+        ok(start == filter->expected_start_time, "Got start time %s.\n", wine_dbgstr_longlong(start));
+        ok(stop == filter->expected_stop_time, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
     }
 
     return S_OK;
diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c
index 2e5bd5d801e..447f331d474 100644
--- a/dlls/winegstreamer/quartz_transform.c
+++ b/dlls/winegstreamer/quartz_transform.c
@@ -281,6 +281,8 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
 {
     struct transform *filter = impl_from_strmbase_filter(pin->pin.filter);
     struct wg_sample input_wg_sample = {0};
+    REFERENCE_TIME start_time;
+    REFERENCE_TIME end_time;
     HRESULT hr;
 
     /* We do not expect pin connection state to change while the filter is
@@ -306,6 +308,18 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
     if (FAILED(hr))
         return hr;
 
+    hr = IMediaSample_GetTime(sample, &start_time, &end_time);
+    if (SUCCEEDED(hr))
+    {
+        input_wg_sample.pts = start_time;
+        input_wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
+    }
+    if (hr == S_OK)
+    {
+        input_wg_sample.duration = end_time - start_time;
+        input_wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
+    }
+
     hr = wg_transform_push_data(filter->transform, &input_wg_sample);
     if (FAILED(hr))
         return hr;
@@ -347,6 +361,20 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
             return hr;
         }
 
+        if (output_wg_sample.flags & WG_SAMPLE_FLAG_HAS_PTS)
+        {
+            start_time = output_wg_sample.pts;
+            if (output_wg_sample.flags & WG_SAMPLE_FLAG_HAS_DURATION)
+            {
+                end_time = start_time + output_wg_sample.duration;
+                IMediaSample_SetTime(output_sample, &start_time, &end_time);
+            }
+            else
+            {
+                IMediaSample_SetTime(output_sample, &start_time, NULL);
+            }
+        }
+
         hr = IMemInputPin_Receive(filter->source.pMemInputPin, output_sample);
         if (FAILED(hr))
         {




More information about the wine-cvs mailing list