From bd28efb4c702f3119043d8d365fdc7ba98cd8b7d Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Sat, 13 Jun 2020 10:34:22 -0500 Subject: [PATCH] winegstreamer: Also wait for EOS events when retrieving duration. The mpegaudioparse element will not send a duration-changed message if no Xing or VBRI headers are present. Signed-off-by: Akihiro Sagawa Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/tests/mpegsplit.c | 8 ++++---- dlls/quartz/tests/rsrc.rc | 2 +- dlls/quartz/tests/test.mp3 | Bin 2349 -> 2157 bytes dlls/winegstreamer/gstdemux.c | 13 ++++++++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index 9bfd7e3bb19..e407fe44eeb 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -523,13 +523,13 @@ static void test_media_types(void) { MPEG1WAVEFORMAT expect_wfx = { - {WAVE_FORMAT_MPEG, 1, 48000, 8000, 192, 0, sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX)}, - ACM_MPEG_LAYER3, 64000, ACM_MPEG_SINGLECHANNEL, 0, 1, ACM_MPEG_PROTECTIONBIT | ACM_MPEG_ID_MPEG1, 0, 0 + {WAVE_FORMAT_MPEG, 1, 48000, 4000, 96, 0, sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX)}, + ACM_MPEG_LAYER3, 32000, ACM_MPEG_SINGLECHANNEL, 4096, 1, ACM_MPEG_ORIGINALHOME | ACM_MPEG_PROTECTIONBIT | ACM_MPEG_ID_MPEG1, 0, 0 }; static const MPEGLAYER3WAVEFORMAT expect_mp3_wfx = { - {WAVE_FORMAT_MPEGLAYER3, 1, 48000, 8000, 1, 0, sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX)}, - MPEGLAYER3_ID_MPEG, 0, 192, 1, 0 + {WAVE_FORMAT_MPEGLAYER3, 1, 48000, 4000, 1, 0, sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX)}, + MPEGLAYER3_ID_MPEG, 0, 96, 1, 0 }; const WCHAR *filename = load_resource(L"test.mp3"); diff --git a/dlls/quartz/tests/rsrc.rc b/dlls/quartz/tests/rsrc.rc index 753415cf8de..d28c2bd6edc 100644 --- a/dlls/quartz/tests/rsrc.rc +++ b/dlls/quartz/tests/rsrc.rc @@ -28,7 +28,7 @@ test.avi RCDATA "test.avi" /* @makedep: test.mpg */ test.mpg RCDATA "test.mpg" -/* ffmpeg -f lavfi -i "sine=frequency=500" -t 0.5 -ar 48000 -b:a 32k -f mp3 -acodec mp3 test.mp3 */ +/* ffmpeg -f lavfi -i "sine=frequency=500" -t 0.5 -ar 48000 -b:a 32k -f mp3 -acodec mp3 -write_xing 0 test.mp3 */ /* @makedep: test.mp3 */ test.mp3 RCDATA "test.mp3" diff --git a/dlls/quartz/tests/test.mp3 b/dlls/quartz/tests/test.mp3 index 78d8dd2af62027147a3f169a8306b601ab37c3b6..b35e6b77d1315fa5b742085226ecd0cefbdf4896 100644 GIT binary patch literal 2157 zcmbuAeN+=?7RKLX5(p&H2n1OJb`rG$i5L}K^lZ07AQ&;x5DB4_j|8k%vox_h}S{I>S@~kh+J#G#{|FeLOZbE!gc}7xU-@L&Fv>ME>bT1MSr!uas`vwAOEA!g^(J zNxAO0##$RBU-o7GGMw*>LNiPnwQm=q*C#0tf6{r0x!3pad-|uXvS$&QGvI*|q2R~B#{(#R7Dr{C%G}RtCg_uh>W-Ds0hXncenr5PH(aqL1+C zHrAT|qzGCvKw2*%<7Q{n(G4lnvwti&Fj9^n2q8p)^B1GgRVD)r@KGIw8uvEvFfApxu%eJPx z`KdC;2%G7-|KCU`|GaUox~M8~dhGVqm9;Pd5%8$H+uoanHul}1$%{iG{C8I;#!qWM zu;6@O6l!34Q2!c^Xrbh_>Y;ow1vV=c|LtPwy~R1{=?v+;u|vO(^ILwimIT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rj)WV3-^dxP=rA=FwH(eiSg$-mgr$exweQ3<-?p;TDnUY6F^T zFf_;YS=d11^gw^vFY(atha>q!{)zK}h#%I^`4Qgs4$Ifbt`TJ&DXh(~>A=x*fr{hv z_EwU+3*+}#nETy7lvAR4_O(}u7AdL)hV)|lI8O8NH@{Jb+KIN%p`Q$tg{e%Y)@dMIV?Sdpl_gj!xLi7C#s`vgHAw!SFT%=_n^{bG)B#-*!9ZH*Q7 z39Rn?D}mx%)(1bUwd_OUoRqynFT80PFM>?PFzf-%QC0c_1 zaKHg?>jx1si1T^5qD!v_9${P{&$q7fWZWGr*6&f++rjOOKR8vL|8eePjEovmE@@*e zXuPin($|S5kpj$2G;wbfDGv_2=!H0TfmPPfe^^Xe%hUyrgt$0MXhP&C$^>Ioyku=? z%@HtB6pb@GDRC^Uoyw#Lt)FWN-WY=yzPCs(m5Tc3xtDImzWI!n-L9EeVk^I*!CML` z{CT6H+ZlTY&mKi>Xbbd<0L4+=zeN5^i2mj28)Y-(m7O0Nr^$TX{J0LbE-toCE1&cC zy+D7g_?D7s*h8HEr?Q@rZ=f3QEBTZ4(EkOlg^S#;H{w8?^Em4Qi}WY!-*@Uipin.pin.peer) IPin_EndOfStream(pin->pin.pin.peer); + else + SetEvent(pin->eos_event); return TRUE; case GST_EVENT_FLUSH_START: if (impl_from_strmbase_filter(pin->pin.pin.filter)->ignore_flush) { @@ -2129,6 +2131,7 @@ static void free_source_pin(struct gstdemux_source *pin) } gst_object_unref(pin->my_sink); CloseHandle(pin->caps_event); + CloseHandle(pin->eos_event); FreeMediaType(&pin->mt); gst_segment_free(pin->segment); @@ -2161,6 +2164,7 @@ static struct gstdemux_source *create_pin(struct gstdemux *filter, const WCHAR * strmbase_source_init(&pin->pin, &filter->filter, name, &source_ops); pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL); + pin->eos_event = CreateEventW(NULL, FALSE, FALSE, NULL); pin->segment = gst_segment_new(); gst_segment_init(pin->segment, GST_FORMAT_TIME); pin->IQualityControl_iface.lpVtbl = &GSTOutPin_QualityControl_Vtbl; @@ -2561,7 +2565,8 @@ static BOOL mpeg_splitter_init_gst(struct gstdemux *filter) static const WCHAR source_name[] = {'A','u','d','i','o',0}; struct gstdemux_source *pin; GstElement *element; - HANDLE events[2]; + HANDLE events[3]; + DWORD res; int ret; if (!(element = gst_element_factory_make("mpegaudioparse", NULL))) @@ -2600,7 +2605,9 @@ static BOOL mpeg_splitter_init_gst(struct gstdemux *filter) events[0] = filter->duration_event; events[1] = filter->error_event; - if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) + events[2] = pin->eos_event; + res = WaitForMultipleObjects(3, events, FALSE, INFINITE); + if (res == 1) return FALSE; pin->seek.llDuration = pin->seek.llStop = query_duration(pin->their_src);