[MediaCodec][TCSACR-344] Add new codec type - Opus 15/241115/1
authorHaesu Gwon <haesu.gwon@samsung.com>
Mon, 17 Aug 2020 07:18:50 +0000 (16:18 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 17 Aug 2020 07:18:50 +0000 (16:18 +0900)
Change-Id: I8b1bde188f6bc849cebd475da6c2f18dca337128

tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSMediaCodec.cs

index f72c48df9af7005e4fffc617062a6296c87f034a..23decf96e48fe3181ad5278ef461ef4b0b14ea0a 100644 (file)
@@ -1,7 +1,10 @@
 using NUnit.Framework;
 using System;
+using System.Collections;
+using System.Collections.Generic;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Linq;
 
 namespace Tizen.Multimedia.MediaCodec.Tests
 {
@@ -26,6 +29,58 @@ namespace Tizen.Multimedia.MediaCodec.Tests
             Assert.DoesNotThrow(() => new MediaCodec());
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("Configure throws nothing with various audio/video mimetype")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.Configure M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Configure_CHECK_THROW_NOTHING()
+        {
+            int[] supportedBit = { 16, 32 };
+
+            foreach (MediaFormatAudioMimeType mimetype in Enum.GetValues(typeof(MediaFormatAudioMimeType)))
+            {
+                Log.Info("Tizen.MediaCodec.Tests", mimetype.ToString());
+
+                if (MediaCodec.SupportedAudioCodecs.Contains(mimetype))
+                {
+                    foreach (var bit in supportedBit)
+                    {
+                        Log.Info("Tizen.MediaCodec.Tests",
+                            $"{mimetype.ToString()} is supported, test with {bit.ToString()}");
+
+                        try
+                        {
+                            var audioMediaFormat = new AudioMediaFormat(mimetype, 1, 8000, bit, 128);
+                            _codec.Configure(audioMediaFormat, false, MediaCodecTypes.Software);
+                            break;
+                        }
+                        catch (ArgumentException)
+                        {
+                            Log.Info("Tizen.MediaCodec.Tests", "Not supported bit. Try to set another bit.");
+                            continue;
+                        }
+                        catch (Exception)
+                        {
+                            Assert.Fail("Method should not throw exception.");
+                        }
+                    }
+                }
+            }
+
+            foreach (MediaFormatVideoMimeType mimetype in Enum.GetValues(typeof(MediaFormatVideoMimeType)))
+            {
+                if (MediaCodec.SupportedVideoCodecs.Contains(mimetype))
+                {
+                    Log.Info("Tizen.MediaCodec.Tests", $"{mimetype.ToString()} is supported.");
+                    var videoMediaFormat = new VideoMediaFormat(mimetype, 352, 288, 30, 128);
+                    Assert.DoesNotThrow(() => _codec.Configure(videoMediaFormat, false, MediaCodecTypes.Software));
+                }
+            }
+        }
+
         [Test]
         [Category("P2")]
         [Description("Configure throws if the specified format is null")]