{
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) =>
{
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")]
-using System.IO;
+using System.IO;
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)
{
{
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);