Commit c7f26d8b authored by Ghislain MARY's avatar Ghislain MARY

Add button to test video in the tester for Windows 10.

parent e1ee7498
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<Page.BottomAppBar> <Page.BottomAppBar>
<CommandBar x:Name="CommandBar"> <CommandBar x:Name="CommandBar">
<AppBarToggleButton x:Name="VideoToggleButton" Icon="Video" Label="Video tester" Checked="VideoToggleButton_Checked" Unchecked="VideoToggleButton_Checked"/>
<AppBarButton x:Name="Run" Icon="Play" Label="Run" Click="RunSelected_Click"/> <AppBarButton x:Name="Run" Icon="Play" Label="Run" Click="RunSelected_Click"/>
<AppBarButton x:Name="SelectAll" Icon="SelectAll" Label="Select all" Click="SelectAll_Click"/> <AppBarButton x:Name="SelectAll" Icon="SelectAll" Label="Select all" Click="SelectAll_Click"/>
<AppBarToggleButton x:Name="Verbose" Icon="Comment" IsChecked="True" Label="Verbose"/> <AppBarToggleButton x:Name="Verbose" Icon="Comment" IsChecked="True" Label="Verbose"/>
...@@ -98,6 +99,7 @@ ...@@ -98,6 +99,7 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Test result" Style="{StaticResource HeaderTextBlockStyle}" Margin="12,0,0,0"/> <TextBlock Grid.Row="0" Text="Test result" Style="{StaticResource HeaderTextBlockStyle}" Margin="12,0,0,0"/>
...@@ -120,6 +122,10 @@ ...@@ -120,6 +122,10 @@
<ScrollViewer Grid.Row="2"> <ScrollViewer Grid.Row="2">
<ItemsControl ItemsSource="{Binding Traces}" ItemTemplate="{StaticResource TraceTemplate}" Margin="20,12,0,0"/> <ItemsControl ItemsSource="{Binding Traces}" ItemTemplate="{StaticResource TraceTemplate}" Margin="20,12,0,0"/>
</ScrollViewer> </ScrollViewer>
<StackPanel Orientation="Horizontal" Grid.Row="3" MaxHeight="320">
<CaptureElement x:Name="LocalVideo" Stretch="Uniform"/>
<MediaElement x:Name="RemoteVideo" Stretch="Uniform" MediaFailed="RemoteVideo_MediaFailed" MediaEnded="RemoteVideo_MediaEnded" MediaOpened="RemoteVideo_MediaOpened" PartialMediaFailureDetected="RemoteVideo_PartialMediaFailureDetected" RateChanged="RemoteVideo_RateChanged" SizeChanged="RemoteVideo_SizeChanged" CurrentStateChanged="RemoteVideo_CurrentStateChanged"/>
</StackPanel>
</Grid> </Grid>
</SplitView> </SplitView>
<ProgressBar x:Name="ProgressIndicator" Grid.Row="1" <ProgressBar x:Name="ProgressIndicator" Grid.Row="1"
......
...@@ -193,5 +193,56 @@ namespace ms2_tester ...@@ -193,5 +193,56 @@ namespace ms2_tester
private UnitTestCase RunningTestCase; private UnitTestCase RunningTestCase;
private UnitTestCase DisplayedTestCase; private UnitTestCase DisplayedTestCase;
private void VideoToggleButton_Checked(object sender, RoutedEventArgs e)
{
AppBarToggleButton b = sender as AppBarToggleButton;
if (b.IsChecked == true)
{
MS2Tester.Instance.startVideoStream(LocalVideo, RemoteVideo);
Run.IsEnabled = false;
}
else
{
MS2Tester.Instance.stopVideoStream();
Run.IsEnabled = true;
}
}
private void RemoteVideo_MediaFailed(object sender, ExceptionRoutedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("RemoteVideo_MediaFailed");
}
private void RemoteVideo_MediaEnded(object sender, RoutedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("RemoteVideo_MediaEnded");
}
private void RemoteVideo_MediaOpened(object sender, RoutedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("RemoteVideo_MediaOpened");
}
private void RemoteVideo_PartialMediaFailureDetected(MediaElement sender, PartialMediaFailureDetectedEventArgs args)
{
System.Diagnostics.Debug.WriteLine("RemoteVideo_PartialMediaFailureDetected");
}
private void RemoteVideo_RateChanged(object sender, RateChangedRoutedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("RemoteVideo_RateChanged");
}
private void RemoteVideo_SizeChanged(object sender, SizeChangedEventArgs e)
{
System.Diagnostics.Debug.WriteLine(String.Format("RemoteVideo_SizeChanged from {0}x{1} to {2}x{3}", e.PreviousSize.Width, e.PreviousSize.Height, e.NewSize.Width, e.NewSize.Height));
}
private void RemoteVideo_CurrentStateChanged(object sender, RoutedEventArgs e)
{
MediaElement mediaElement = sender as MediaElement;
System.Diagnostics.Debug.WriteLine(String.Format("RemoteVideo_CurrentStateChanged: {0}", mediaElement.CurrentState));
}
} }
} }
...@@ -45,5 +45,6 @@ ...@@ -45,5 +45,6 @@
<Capabilities> <Capabilities>
<Capability Name="internetClient" /> <Capability Name="internetClient" />
<DeviceCapability Name="microphone" /> <DeviceCapability Name="microphone" />
<DeviceCapability Name="webcam" />
</Capabilities> </Capabilities>
</Package> </Package>
\ No newline at end of file
...@@ -51,6 +51,9 @@ ...@@ -51,6 +51,9 @@
<ProjectReference Include="..\..\..\..\..\..\mswebrtc\build\windows10\libmswebrtc\libmswebrtc.vcxproj"> <ProjectReference Include="..\..\..\..\..\..\mswebrtc\build\windows10\libmswebrtc\libmswebrtc.vcxproj">
<Project>{878cf9d3-9761-479e-a715-a1de9f99cb78}</Project> <Project>{878cf9d3-9761-479e-a715-a1de9f99cb78}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\mswinrtvid\windows10\libmswinrtvid\libmswinrtvid.vcxproj">
<Project>{2d0e44c4-e51d-4911-b876-345d1e5e5209}</Project>
</ProjectReference>
<ProjectReference Include="..\ms2-tester-static\ms2-tester-static.vcxproj"> <ProjectReference Include="..\ms2-tester-static\ms2-tester-static.vcxproj">
<Project>{6f92d56c-620f-4d56-8dba-c02c0e06a0d1}</Project> <Project>{6f92d56c-620f-4d56-8dba-c02c0e06a0d1}</Project>
</ProjectReference> </ProjectReference>
...@@ -97,7 +100,7 @@ ...@@ -97,7 +100,7 @@
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories> <AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings> <DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\include;$(ProjectDir)..\..\..\..\tester;$(ProjectDir)..\..\..\..\tester\common;$(ProjectDir)..\..\..\..\..\oRTP\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\include;$(ProjectDir)..\..\..\..\tester;$(ProjectDir)..\..\..\..\tester\common;$(ProjectDir)..\..\..\..\..\oRTP\include;$(ProjectDir)..\..\..\..\..\..\mswinrtvid\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
......
...@@ -53,6 +53,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmswebrtc", "..\..\..\..\ ...@@ -53,6 +53,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmswebrtc", "..\..\..\..\
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmsbcg729", "..\..\..\..\..\bcg729\build\windows10\libmsbcg729\libmsbcg729.vcxproj", "{ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmsbcg729", "..\..\..\..\..\bcg729\build\windows10\libmsbcg729\libmsbcg729.vcxproj", "{ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmswinrtvid", "..\..\..\..\..\mswinrtvid\windows10\libmswinrtvid\libmswinrtvid.vcxproj", "{2D0E44C4-E51D-4911-B876-345D1E5E5209}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM Debug|ARM = Debug|ARM
...@@ -369,6 +371,18 @@ Global ...@@ -369,6 +371,18 @@ Global
{ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}.Release|x64.Build.0 = Release|x64 {ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}.Release|x64.Build.0 = Release|x64
{ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}.Release|x86.ActiveCfg = Release|Win32 {ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}.Release|x86.ActiveCfg = Release|Win32
{ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}.Release|x86.Build.0 = Release|Win32 {ACF5EA95-D647-4D0C-8F97-2CD9AAE8A2E0}.Release|x86.Build.0 = Release|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|ARM.ActiveCfg = Debug|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|ARM.Build.0 = Debug|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x64.ActiveCfg = Debug|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x64.Build.0 = Debug|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x86.ActiveCfg = Debug|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x86.Build.0 = Debug|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|ARM.ActiveCfg = Release|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|ARM.Build.0 = Release|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x64.ActiveCfg = Release|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x64.Build.0 = Release|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x86.ActiveCfg = Release|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
#include <string> #include <string>
#include "mediastreamer2_tester_windows.h" #include "mediastreamer2_tester_windows.h"
#include "mswinrtvid.h"
using namespace ms2_tester_runtime_component; using namespace ms2_tester_runtime_component;
using namespace Platform; using namespace Platform;
...@@ -18,12 +19,12 @@ MS2Tester^ MS2Tester::_instance = ref new MS2Tester(); ...@@ -18,12 +19,12 @@ MS2Tester^ MS2Tester::_instance = ref new MS2Tester();
static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args) static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
{ {
wchar_t wstr[MAX_TRACE_SIZE];
std::string str;
str.resize(MAX_TRACE_SIZE);
vsnprintf((char *)str.c_str(), MAX_TRACE_SIZE, fmt, args);
mbstowcs(wstr, str.c_str(), MAX_TRACE_SIZE - 1);
if (sTraceListener) { if (sTraceListener) {
wchar_t wstr[MAX_TRACE_SIZE];
std::string str;
str.resize(MAX_TRACE_SIZE);
vsnprintf((char *)str.c_str(), MAX_TRACE_SIZE, fmt, args);
mbstowcs(wstr, str.c_str(), MAX_TRACE_SIZE - 1);
String^ msg = ref new String(wstr); String^ msg = ref new String(wstr);
String^ l; String^ l;
switch (lev) { switch (lev) {
...@@ -43,6 +44,8 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args) ...@@ -43,6 +44,8 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
} }
sTraceListener->outputTrace(l, msg); sTraceListener->outputTrace(l, msg);
} }
OutputDebugStringW(wstr);
OutputDebugStringW(L"\n");
} }
static void ms2NativeOutputTraceHandler(OrtpLogLevel lev, const char *fmt, va_list args) static void ms2NativeOutputTraceHandler(OrtpLogLevel lev, const char *fmt, va_list args)
...@@ -147,3 +150,35 @@ Platform::String^ MS2Tester::testName(Platform::String^ suiteName, int testIndex ...@@ -147,3 +150,35 @@ Platform::String^ MS2Tester::testName(Platform::String^ suiteName, int testIndex
mbstowcs(wcname, cname, sizeof(wcname)); mbstowcs(wcname, cname, sizeof(wcname));
return ref new String(wcname); return ref new String(wcname);
} }
void MS2Tester::startVideoStream(Platform::Object^ CaptureElement, Platform::Object^ MediaElement)
{
ortp_init();
ms_base_init();
ortp_set_log_level_mask(ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
ortp_set_log_handler(ms2NativeOutputTraceHandler);
ms_voip_init();
ms_plugins_init();
rtp_profile_set_payload(&av_profile, 102, &payload_type_h264);
ms_filter_enable_statistics(TRUE);
ms_filter_reset_statistics();
MSWebCamManager *manager = ms_web_cam_manager_get();
MSWebCam *camera = ms_web_cam_manager_get_default_cam(manager);
_videoStream = video_stream_new(20000, 0, FALSE);
RefToPtrProxy<Platform::Object^> *previewWindowId = new RefToPtrProxy<Platform::Object^>(CaptureElement);
video_stream_set_native_preview_window_id(_videoStream, previewWindowId);
RefToPtrProxy<Platform::Object^> *nativeWindowId = new RefToPtrProxy<Platform::Object^>(MediaElement);
video_stream_set_native_window_id(_videoStream, nativeWindowId);
video_stream_set_display_filter_name(_videoStream, "MSWinRTDis");
video_stream_set_direction(_videoStream, VideoStreamRecvOnly);
video_stream_start(_videoStream, &av_profile, "127.0.0.1", 21000, NULL, 0, 102, 0, camera);
}
void MS2Tester::stopVideoStream()
{
ms_filter_log_statistics();
video_stream_stop(_videoStream);
_videoStream = NULL;
ms_exit();
}
...@@ -21,6 +21,8 @@ namespace ms2_tester_runtime_component ...@@ -21,6 +21,8 @@ namespace ms2_tester_runtime_component
Platform::String^ testName(Platform::String^ suiteName, int testIndex); Platform::String^ testName(Platform::String^ suiteName, int testIndex);
bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose); bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose);
void runAllToXml(); void runAllToXml();
void startVideoStream(Platform::Object^ CaptureElement, Platform::Object^ MediaElement);
void stopVideoStream();
static property MS2Tester^ Instance static property MS2Tester^ Instance
{ {
...@@ -37,5 +39,6 @@ namespace ms2_tester_runtime_component ...@@ -37,5 +39,6 @@ namespace ms2_tester_runtime_component
static MS2Tester^ _instance; static MS2Tester^ _instance;
Windows::Foundation::IAsyncAction^ _asyncAction; Windows::Foundation::IAsyncAction^ _asyncAction;
VideoStream *_videoStream;
}; };
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment