Rémi Bernon : winegstreamer: Set the MF_MT_AUDIO_AVG_BYTES_PER_SECOND attribute.

Alexandre Julliard julliard at winehq.org
Tue Aug 2 14:53:35 CDT 2022


Module: wine
Branch: master
Commit: e5a512eb93663238f0ea85a19bdfec662b101134
URL:    https://gitlab.winehq.org/wine/wine/-/commit/e5a512eb93663238f0ea85a19bdfec662b101134

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Jun 27 11:38:57 2022 +0200

winegstreamer: Set the MF_MT_AUDIO_AVG_BYTES_PER_SECOND attribute.

This is required by the Resampler transform, and will be used in next
patch as well as for session buffer size heuristic.

---

 dlls/winegstreamer/mfplat.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c
index 33557211243..9c27c5c7d60 100644
--- a/dlls/winegstreamer/mfplat.c
+++ b/dlls/winegstreamer/mfplat.c
@@ -698,8 +698,8 @@ static inline UINT64 make_uint64(UINT32 high, UINT32 low)
 
 static IMFMediaType *mf_media_type_from_wg_format_audio(const struct wg_format *format)
 {
+    unsigned int i, block_align;
     IMFMediaType *type;
-    unsigned int i;
 
     for (i = 0; i < ARRAY_SIZE(audio_formats); ++i)
     {
@@ -715,7 +715,10 @@ static IMFMediaType *mf_media_type_from_wg_format_audio(const struct wg_format *
             IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, format->u.audio.channels);
             IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_CHANNEL_MASK, format->u.audio.channel_mask);
             IMFMediaType_SetUINT32(type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
-            IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, format->u.audio.channels * audio_formats[i].depth / 8);
+
+            block_align = format->u.audio.channels * audio_formats[i].depth / 8;
+            IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, block_align);
+            IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, block_align * format->u.audio.rate);
 
             return type;
         }




More information about the wine-cvs mailing list