protected void ResolutionTest( MediaConfigurationChangeLog changeLog, VideoEncoding encodingUnderTest, GetResolutionsAvailable getResolutionsAvailable) { //3. ONVIF Client invokes GetVideoEncoderConfigurationsRequest message to retrieve // video configuration list. //4. Verify the GetVideoEncoderConfigurationsResponse message. VideoEncoderConfiguration[] encoderConfigurations = GetVideoEncoderConfigurations(); CheckVideoEncoderConfigurationsList(encoderConfigurations); bool NoProfilesForEncoding = true; List <VideoEncoderConfiguration> selectedConfigs = null; var WhereRes = encoderConfigurations.Where(C => C.Encoding == encodingUnderTest); if (WhereRes != null) { selectedConfigs = WhereRes.ToList(); } if (selectedConfigs == null || selectedConfigs.Count == 0) { LogTestEvent("There are no VideoEncoderConfiguration ready for selected encoder type - will try to reconfigure (if this may fail - please pre-configure before making tests)." + Environment.NewLine); selectedConfigs = encoderConfigurations.ToList(); } selectedConfigs = MediaTestUtils.SelectConfigurations(selectedConfigs); var configGroups = encoderConfigurations.Where(e => !selectedConfigs.Contains(e)).Select(e => new List <VideoEncoderConfiguration>() { e }).ToList(); configGroups.Insert(0, selectedConfigs); //Try to perform steps for selected profiles. //In case of fail for all selected profiles try to perform steps for each another profile until first success. foreach (var configGroup in configGroups) { foreach (VideoEncoderConfiguration encoderConfig in configGroup) { //5. Find or create media profile with Video Source Configuration and Video Encoder // Configuration with token VECToken1 and supporting of JPEG encoding, where VECToken1 // is first video encoder configuration token from GetVideoEncoderConfigurationsResponse // message (see Annex A.8). If it is not possible skip steps 6-61 and go to the step 62. Profile profile = GetProfileForSpecificConfigurationAndCodec(encoderConfig.token, encodingUnderTest, changeLog); if (profile == null) { continue; } NoProfilesForEncoding = false; //6. ONVIF Client invokes GetVideoEncoderConfigurationOptionsRequest message // (ProfileToken = “Profile1”, where “Profile1” is profile token from the step 5) // to get video encoder configuration options. //7. Verify the GetVideoEncoderConfigurationOptionsResponse message from the DUT. VideoEncoderConfigurationOptions options = GetVideoEncoderConfigurationOptions(null, profile.token); Assert(CheckVideoSupport(options, encodingUnderTest), string.Format("{0} encoding is not compatible with current configurations", GetVideoCodecName(encodingUnderTest)), string.Format("Validate {0} options", GetVideoCodecName(encodingUnderTest))); VideoResolution highest = null; VideoResolution lowest = null; VideoResolution median = null; FindResolutions(getResolutionsAvailable(options), out highest, out lowest, out median); //8. ONVIF Client invokes SetVideoEncoderConfigurationRequest message // (ConfigurationToken = VECToken1, Resolution = [Width1, Height1], Encoding = JPEG, // where [Width1, Height1] is maximum resolution from the Options.JPEG.ResolutionsAvailable) // to change video encoder configuration. VideoEncoderConfiguration unchanged = Utils.CopyMaker.CreateCopy(encoderConfig); encoderConfig.Encoding = encodingUnderTest; encoderConfig.Resolution = highest; AdjustVideoEncoderConfiguration(encodingUnderTest, encoderConfig, options); switch (encodingUnderTest) { case VideoEncoding.MPEG4: AdjustMpeg4VideoEncoderConfiguration(encoderConfig, options, false); break; case VideoEncoding.H264: AdjustH264VideoEncoderConfiguration(encoderConfig, options, false); break; } SetVideoEncoderConfiguration(encoderConfig, false); //9. Verify the SetVideoEncoderConfigurationResponse message from the DUT. changeLog.ModifiedVideoEncoderConfigurations.Add(unchanged); //10. ONVIF Client invokes GetVideoEncoderConfigurationRequest message // (ConfigurationToken = VECToken1) to get video encoder configuration. //11. Verify the GetVideoEncoderConfigurationResponse message (ConfigurationToken = // VECToken1, Resolution = [Width1, Height1], Encoding = JPEG) from the DUT. Check // that new setting for Resolution and Encoding was applied. VideoEncoderConfiguration actual = GetVideoEncoderConfiguration(unchanged.token); string reason = string.Empty; // check encoding and resolutions bool ok = ConfigurationValid(actual, encodingUnderTest, highest, out reason); Assert(ok, reason, "Check that the DUT accepted values passed"); //12. ONVIF Client invokes GetStreamUriRequest message (Profile Token, RTP-Unicast, // UDP transport) to retrieve media stream URI for the selected media profile. //13. DUT sends RTSP URI and parameters defining the lifetime of the URI like // ValidUntilConnect, ValidUntilReboot and Timeout in the GetStreamUriResponse message. StreamSetup streamSetup = new StreamSetup(); streamSetup.Transport = new Transport(); streamSetup.Transport.Protocol = TransportProtocol.UDP; streamSetup.Stream = StreamType.RTPUnicast; MediaUri streamUri = GetStreamUri(streamSetup, profile.token); //14. ONVIF Client verifies the RTSP media stream URI provided by the DUT. //15. ONVIF Client invokes RTSP DESCRIBE request. //16. DUT sends 200 OK message and SDP information. //17. ONVIF Client invokes RTSP SETUP request with transport parameter as RTP/UDP. //18. DUT sends 200 OK message and the media stream information. //19. ONVIF Client invokes RTSP PLAY request. //20. DUT sends 200 OK message and starts media streaming. //21. DUT sends JPEG RTP media stream to ONVIF Client over UDP. Verify that stream // has JPEG encoding and [Width1, Height1] resolution. //22. DUT sends RTCP sender report to ONVIF Client. //23. DUT validates the received RTP and RTCP packets, decodes and renders them. //24. ONVIF Client invokes RTSP TEARDOWN control request at the end of media // streaming to terminate the RTSP session. //25. DUT sends 200 OK Response and terminates the RTSP Session. //TestTool.Tests.Common.Media.VideoUtils.AdjustVideo(_videoForm, _username, _password, _messageTimeout, // streamSetup.Transport.Protocol, // streamSetup.Stream, streamUri, encoderConfig); //ValidateStreamSequence(false, true); DoSequence(encoderConfig, streamUri); //26. ONVIF Client invokes SetVideoEncoderConfigurationRequest message // (ConfigurationToken = VECToken1, Resolution = [Width1, Height1], Encoding = JPEG, // where [Width2, Height2] is minimum resolution from the Options.JPEG.ResolutionsAvailable) to change video encoder configuration. //27. Verify the SetVideoEncoderConfigurationResponse message from the DUT. encoderConfig.Encoding = encodingUnderTest; encoderConfig.Resolution = lowest; AdjustVideoEncoderConfiguration(encodingUnderTest, encoderConfig, options); SetVideoEncoderConfiguration(encoderConfig, false); //28. ONVIF Client invokes GetVideoEncoderConfigurationRequest message // (ConfigurationToken = VECToken1) to get video encoder configuration. //29. Verify the GetVideoEncoderConfigurationResponse message (ConfigurationToken = // VECToken1, Resolution = [Width2, Height2], Encoding = JPEG, where [Width2, Height2]) from the DUT. Check that new setting for Resolution and Encoding was applied. actual = GetVideoEncoderConfiguration(unchanged.token); ok = ConfigurationValid(actual, encodingUnderTest, lowest, out reason); Assert(ok, reason, "Check that the DUT accepted values passed"); //30. ONVIF Client invokes GetStreamUriRequest message (Profile Token, RTP-Unicast, // UDP transport) to retrieve media stream URI for the selected media profile. //31. DUT sends RTSP URI and parameters defining the lifetime of the URI like ValidUntilConnect, ValidUntilReboot and Timeout in the GetStreamUriResponse message. streamUri = GetStreamUri(streamSetup, profile.token); //32. ONVIF Client verifies the RTSP media stream URI provided by the DUT. //33. ONVIF Client invokes RTSP DESCRIBE request. //34. DUT sends 200 OK message and SDP information. //35. ONVIF Client invokes RTSP SETUP request with transport parameter as RTP/UDP. //36. DUT sends 200 OK message and the media stream information. //37. ONVIF Client invokes RTSP PLAY request. //38. DUT sends 200 OK message and starts media streaming. //39. DUT sends JPEG RTP media stream to ONVIF Client over UDP. Verify that stream has JPEG encoding and [Width2, Height2] resolution. //40. DUT sends RTCP sender report to ONVIF Client. //41. DUT validates the received RTP and RTCP packets, decodes and renders them. //42. ONVIF Client invokes RTSP TEARDOWN control request at the end of media streaming to terminate the RTSP session. //43. DUT sends 200 OK Response and terminates the RTSP Session. //TestTool.Tests.Common.Media.VideoUtils.AdjustVideo(_videoForm, _username, _password, _messageTimeout, // streamSetup.Transport.Protocol, // streamSetup.Stream, streamUri, encoderConfig); //ValidateStreamSequence(false, true); DoSequence(encoderConfig, streamUri); //44. ONVIF Client invokes SetVideoEncoderConfigurationRequest message (ConfigurationToken = VECToken1, Resolution = [Width1, Height1], Encoding = JPEG, where [Width3, Height3] is middle resolution from the Options.JPEG.ResolutionsAvailable) to change video encoder configuration. //45. Verify the SetVideoEncoderConfigurationResponse message from the DUT. encoderConfig.Encoding = encodingUnderTest; encoderConfig.Resolution = median; AdjustVideoEncoderConfiguration(encodingUnderTest, encoderConfig, options); SetVideoEncoderConfiguration(encoderConfig, false); //46. ONVIF Client invokes GetVideoEncoderConfigurationRequest message (ConfigurationToken = VECToken1) to get video encoder configuration. //47. Verify the GetVideoEncoderConfigurationResponse message (ConfigurationToken = VECToken1, Resolution = [Width3, Height3], Encoding = JPEG) from the DUT. Check that new setting for Resolution and Encoding was applied. actual = GetVideoEncoderConfiguration(unchanged.token); ok = ConfigurationValid(actual, encodingUnderTest, median, out reason); Assert(ok, reason, "Check that the DUT accepted values passed"); //48. ONVIF Client invokes GetStreamUriRequest message (Profile Token, RTP-Unicast, UDP transport) to retrieve media stream URI for the selected media profile. //49. DUT sends RTSP URI and parameters defining the lifetime of the URI like ValidUntilConnect, ValidUntilReboot and Timeout in the GetStreamUriResponse message. streamUri = GetStreamUri(streamSetup, profile.token); //50. ONVIF Client verifies the RTSP media stream URI provided by the DUT. //51. ONVIF Client invokes RTSP DESCRIBE request. //52. DUT sends 200 OK message and SDP information. //53. ONVIF Client invokes RTSP SETUP request with transport parameter as RTP/UDP. //54. DUT sends 200 OK message and the media stream information. //55. ONVIF Client invokes RTSP PLAY request. //56. DUT sends 200 OK message and starts media streaming. //57. DUT sends JPEG RTP media stream to ONVIF Client over UDP. Verify that stream has JPEG encoding and [Width3, Height3] resolution. //58. DUT sends RTCP sender report to ONVIF Client. //59. DUT validates the received RTP and RTCP packets, decodes and renders them. //60. ONVIF Client invokes RTSP TEARDOWN control request at the end of media streaming to terminate the RTSP session. //61. DUT sends 200 OK Response and terminates the RTSP Session. //TestTool.Tests.Common.Media.VideoUtils.AdjustVideo(_videoForm, _username, _password, _messageTimeout, // streamSetup.Transport.Protocol, // streamSetup.Stream, streamUri, encoderConfig); //ValidateStreamSequence(false, true); DoSequence(encoderConfig, streamUri); //62. Repeat steps 5-62 for the rest Video Encoder configurations supported by the DUT with using different multicast ports and the same multicast addresses for Video Encoder Configurations. } if (!NoProfilesForEncoding) { break; } } if (NoProfilesForEncoding) { RunStep(() => { throw new Exception(string.Format("No profiles for {0}", GetVideoCodecName(encodingUnderTest))); }, string.Format("Check if at least one profile were found ({0} not supported?)", GetVideoCodecName(encodingUnderTest))); } }
protected void MultipleStreamTestReduced(MediaConfigurationChangeLog changeLog, GetStreamSetup getStreamSetup) { //3. ONVIF Client will invoke GetVideoSourceConfigurationsRequest message to retrieve // all DUT video source configurations. //4. Verify the GetVideoSourceConfigurationsResponse message from the DUT. VideoSourceConfiguration[] sourceConfigurations = GetVideoSourceConfigurations(); CheckConfigurationsList(sourceConfigurations, "Video Source Configuration"); List <VideoSourceConfiguration> selectedConfigs = MediaTestUtils.SelectConfigurations(sourceConfigurations); foreach (VideoSourceConfiguration config in selectedConfigs) { //5. ONVIF Client will invoke GetGuaranteedNumberOfVideoEncoderInstancesRequest message // (ConfigurationToken = “VSCToken1”, where “VSCToken1” is a first video source configuration // token from GetVideoSourceConfigurationsResponse message) to retrieve guaranteed number of // video encoder instances per first video source configuration. int?jpeg; int?mpeg; int?h264; int totalNumber = GetGuaranteedNumberOfVideoEncoderInstances(config.token, out jpeg, out h264, out mpeg); //6. Verify the GetGuaranteedNumberOfVideoEncoderInstancesResponse message from the DUT. //7. Create or find number of profiles equal to TotalNumber from // GetGuaranteedNumberOfVideoEncoderInstancesResponse message that contains video source // configuration with token “VSCToken1” and video encoder configuration (see Annex A.9). List <Profile> profiles = GetProfilesForMultiStreamingTest(config.token, totalNumber, jpeg, mpeg, h264, changeLog); Assert(profiles.Count == totalNumber, "Required number of profiles could not be found or created", "Check that required number of profiles has been achieved"); SetResourcesUsageToMimimal(changeLog, profiles); //8. ONVIF Client invokes GetStreamUriRequest message (Profile Token, RTP-Unicast, // UDP transport) to retrieve media stream URI for the first media profile from step 7. //9. DUT sends RTSP URI and parameters defining the lifetime of the URI like // ValidUntilConnect, ValidUntilReboot and Timeout in the GetStreamUriResponse message. //10. ONVIF Client verifies the RTSP media stream URI provided by the DUT. //11. ONVIF Client invokes RTSP DESCRIBE request. //12. DUT sends 200 OK message and SDP information. //13. ONVIF Client invokes RTSP SETUP request with transport parameter as RTP/UDP. //14. DUT sends 200 OK message and the media stream information. //15. ONVIF Client invokes RTSP PLAY request. //16. DUT sends 200 OK message and starts media streaming. //17. DUT sends JPEG RTP media stream to ONVIF Client over UDP. //18. DUT sends RTCP sender report to ONVIF Client. //19. DUT validates the received RTP and RTCP packets, decodes and renders them. //20. Repeat steps 8-20 to start video streaming for all profiles from step 7. //21. ONVIF Client invokes RTSP TEARDOWN control request at the end of media streaming // to terminate the RTSP session for each started stream. //22. DUT sends 200 OK Response and terminates the RTSP Session. VideoUtils.ShowMultiple( this, _semaphore.StopEvent, _username, _password, _messageTimeout, getStreamSetup, _videoForm.NICIndex, profiles, GetStreamUri, (a, name, failTest) => RunStep2(a, name, failTest), (ex) => StepFailed(ex)); //23. Repeat steps 5-23 for the rest of video source configurations. } }