[MediaCodec][Non-ACR] Fix AAC bit rate 05/175205/1
authorHaesu Gwon <haesu.gwon@samsung.com>
Wed, 4 Apr 2018 03:30:01 +0000 (12:30 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 9 Apr 2018 08:04:58 +0000 (08:04 +0000)
Change-Id: I19ae596e3729d37e0304bbef4dae077c9cfc563f

tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSBufferStatusChangedEventArgs.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSInputProcessedEventArgs.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSMediaCodec.cs
tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSMediaCodecErrorOccurredEventArgs.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSOutputAvailableEventArgs.cs [changed mode: 0644->0755]
tct-suite-vs/Tizen.MediaCodec.Tests/testcase/support/AudioEncoderFeeder.cs [changed mode: 0755->0644]

index 1da4d2c..95ca48e 100755 (executable)
@@ -308,8 +308,25 @@ namespace Tizen.Multimedia.MediaCodec.Tests
         {
             CountdownEvent countdownEvent = new CountdownEvent(5);
 
-            _codec.Configure(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 2, 48000, 16, 128),
-                true, MediaCodecTypes.Software);
+            int[] aacSupportedBit = { 16, 32 };
+
+            for (int i = 0; i < aacSupportedBit.Length; i++)
+            {
+                try
+                {
+                    _codec.Configure(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 2, 48000, aacSupportedBit[i], 128),
+                        true, MediaCodecTypes.Software);
+
+                    // If Configuration is set successfully, we should not configure it again.
+                    break;
+                }
+                catch
+                {
+                    Log.Info("Tizen.Multimedia.MediaCodec",
+                        $"{aacSupportedBit[i]} bit for aac is not supported in this target. " +
+                        $"try again with {aacSupportedBit[i + 1]} bit.");
+                }
+            }
 
             _codec.OutputAvailable += (object sender, OutputAvailableEventArgs e) =>
             {
@@ -319,17 +336,15 @@ namespace Tizen.Multimedia.MediaCodec.Tests
                     countdownEvent.Signal();
                 }
             };
-
             _codec.Prepare();
 
-            new AudioEncoderFeeder().Feed(packet => _codec.ProcessInput(packet)); ;
+            new AudioEncoderFeeder().Feed(packet => _codec.ProcessInput(packet));
 
             Assert.True(countdownEvent.Wait(4000));
 
             _codec.Unprepare();
         }
 
-
         [Test]
         [Category("P1")]
         [Description("Check if the FlushBuffers can be invoked without any exception")]
old mode 100755 (executable)
new mode 100644 (file)
index 191b5c1..ae62806
@@ -1,4 +1,4 @@
-using System.IO;
+using System.IO;
 
 namespace Tizen.Multimedia.MediaCodec.Tests
 {
@@ -6,8 +6,10 @@ namespace Tizen.Multimedia.MediaCodec.Tests
     {
         public const string PcmFile = "/opt/usr/home/owner/share/res/test.pcm";
 
+        private const int testPcmBit = 32;
+
         public static readonly MediaFormat Format =
-            new AudioMediaFormat(MediaFormatAudioMimeType.Pcm, 2, 48000, 16, 128000);
+            new AudioMediaFormat(MediaFormatAudioMimeType.Pcm, 2, 44100, testPcmBit, 128000);
 
         public AudioEncoderFeeder() : base(PcmFile)
         {
@@ -17,7 +19,7 @@ namespace Tizen.Multimedia.MediaCodec.Tests
         {
             MediaPacket packet = MediaPacket.Create(Format);
 
-            const int readSize = 1024 * 2 * 2 * 2;
+            const int readSize = 1024 * 2 * (testPcmBit / 8) * 2;
             byte[] arr = new byte[readSize];
 
             file.Read(arr, 0, readSize);