I've a grid view containing media player elements and I'm getting video frames for each user encoded in I420 format from mixed reality webrtc. I'm following the exact steps in https://microsoft.github.io/MixedReality-WebRTC/manual/cs/helloworld-cs-mediatracks-uwp.html to make the video frames render in MediaPlayerElement. This works well if the number of media player elements in the grid view is 12-13. When it crosses, 14-16, we are seeing lags/freezes in the UI (all user actions are getting slow and resizing taking a hit affecting the user experience).
Went through this msdn documentation (https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/play-audio-and-video-with-mediaplayer) and tried a) Use MediaPlayerSurface to render video to a Windows.UI.Composition surface b) Using Media player in frame server mode. But, didn't work
Any pointers on what I'm missing or directions ?
<GridView
x:Name="AdaptiveGridViewControl"
Grid.Row="3"
Margin="0,0,5,0"
Padding="0,0,0,8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="center"
x:Load="True"
IsItemClickEnabled="False"
ItemContainerTransitions="{x:Null}"
ItemsSource="{x:Bind Users, Mode=OneWay}"
RotationTransition="{x:Null}"
ScaleTransition="{x:Null}"
SelectionMode="None"
Transitions="{x:Null}"
TranslationTransition="{x:Null}">
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Margin" Value="5,5,0,0" />
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ParticipantViewPanels:AdaptiveGridPanel x:Name="panel" Loaded="CustomPanel_Loaded" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate>
<MediaPlayerElement
x:Name="VideoPlayerElement"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AutoPlay="True"
Background="Black"
BorderBrush="Black"
BorderThickness="0"
Canvas.ZIndex="1"
CornerRadius="5"
Opacity="0.8"
RotationTransition="{x:Null}"
ScaleTransition="{x:Null}"
Transitions="{x:Null}"
TranslationTransition="{x:Null}"
Visibility="Visible" />
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
EDITS:-
On running a performance profiler (Application timeline), I see time is being spent by the xaml runtime.
