AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Macros | Typedefs | Functions | Variables
AndroidSLESMediaQueueTest.cpp File Reference
#include <fstream>
#include <thread>
#include <tuple>
#include <SLES/OpenSLES_Android.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <AVSCommon/AVS/Attachment/AttachmentWriter.h>
#include <AVSCommon/AVS/Attachment/InProcessAttachment.h>
#include <AVSCommon/Utils/Logger/LoggerSinkManager.h>
#include <AndroidUtilities/AndroidLogger.h>
#include <AndroidUtilities/MockAndroidSLESObject.h>
#include "AndroidSLESMediaPlayer/AndroidSLESMediaQueue.h"
Include dependency graph for AndroidSLESMediaQueueTest.cpp:

Classes

class  alexaClientSDK::mediaPlayer::android::test::MockDecoder
 Mock decoder. More...
 
class  alexaClientSDK::mediaPlayer::android::test::MockCallback
 Mock status callback. More...
 
class  alexaClientSDK::mediaPlayer::android::test::AndroidSLESMediaQueueTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::mediaPlayer
 
 alexaClientSDK::mediaPlayer::android
 
 alexaClientSDK::mediaPlayer::android::test
 

Macros

#define TAG   "AndroidSLESMediaQueueTest"
 String to identify log entries originating from this file. More...
 
#define LX(event)   alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
 

Typedefs

using alexaClientSDK::mediaPlayer::android::test::MockSlSimpleBufferQueue = MockInterfaceImpl< SLAndroidSimpleBufferQueueItf_ >
 

Functions

static const std::string alexaClientSDK::mediaPlayer::android::test::MP3_FILE_PATH ("/fox_dog.mp3")
 MP3 test file path. More...
 
static SLresult alexaClientSDK::mediaPlayer::android::test::mockRegisterCallbackOk (SLAndroidSimpleBufferQueueItf self, slAndroidSimpleBufferQueueCallback callback, void *pCallbackContext)
 Mock register callback succeeds. More...
 
static SLresult alexaClientSDK::mediaPlayer::android::test::mockRegisterCallbackFailed (SLAndroidSimpleBufferQueueItf self, slAndroidSimpleBufferQueueCallback callback, void *pCallbackContext)
 Mock register callback fails. More...
 
static SLresult alexaClientSDK::mediaPlayer::android::test::mockEnqueueOk (SLAndroidSimpleBufferQueueItf self, const void *pBuffer, SLuint32 size)
 Mock enqueue call succeeds. More...
 
SLresult alexaClientSDK::mediaPlayer::android::test::mockEnqueueFailed (SLAndroidSimpleBufferQueueItf self, const void *pBuffer, SLuint32 size)
 Mock enqueue call fails. More...
 
SLresult alexaClientSDK::mediaPlayer::android::test::mockGetState (SLAndroidSimpleBufferQueueItf self, SLAndroidSimpleBufferQueueState *pState)
 Mock get state. More...
 
static SLresult alexaClientSDK::mediaPlayer::android::test::mockClearOk (SLAndroidSimpleBufferQueueItf self)
 Mock clear call succeeds. More...
 
static void alexaClientSDK::mediaPlayer::android::test::bufferFree (AndroidSLESMediaQueue &mediaQueue)
 Mock buffer free call. Increment index and decrement counter. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_createSucceed)
 Test buffer queue create. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_createFailMissingSlObject)
 Check that create fail if we are missing the OpenSL ES object. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_createFailMissingInterface)
 Check that create fail if the SL_IID_ANDROIDSIMPLEBUFFERQUEUE is missing. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_createFailMissingDecoder)
 Check that create fail if the decoder is missing. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_createFailMissingCallback)
 Check that create fail if the callback function is missing. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_createFailRegisterCallback)
 Check that create fail if the callback function cannot be registered. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_onBufferQueueSucceed)
 Test buffer queue events when the media queue succeeds to read data from the decoder. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_enqueueTillDone)
 Test buffer queue events when the media queue succeeds to read data from the decoder till the end of the stream. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_decoderFailure)
 Test that the buffer queue emits an error event when the decoder fails. More...
 
 alexaClientSDK::mediaPlayer::android::test::TEST_F (AndroidSLESMediaQueueTest, test_enqueueFailure)
 Test buffer queue events emits an error event when it fails to enqueue a buffer. More...
 

Variables

static std::string alexaClientSDK::mediaPlayer::android::test::inputsDirPath
 The path to the input Dir containing the test audio files. More...
 
static const std::chrono::milliseconds alexaClientSDK::mediaPlayer::android::test::TIMEOUT {100}
 Timeout for wait callback. More...
 
static const auto alexaClientSDK::mediaPlayer::android::test::NUMBER_OF_BUFFERS = AndroidSLESMediaQueue::NUMBER_OF_BUFFERS
 Number of buffers used by the buffer queue. More...
 
static std::atomic< int > alexaClientSDK::mediaPlayer::android::test::counter
 Mock buffer count. More...
 
static int alexaClientSDK::mediaPlayer::android::test::index
 Mock buffer index. More...
 
static std::mutex alexaClientSDK::mediaPlayer::android::test::bufferMutex
 Mutex used to synchronize the enqueueBuffer and onBufferFree. More...
 
static std::condition_variable alexaClientSDK::mediaPlayer::android::test::bufferCondition
 Condition variable used to guarantee that onBufferFree only happens after counter > 0;. More...
 

Macro Definition Documentation

◆ LX

#define LX (   event)    alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

Create a LogEntry using this file's TAG and the specified event string.

Parameters
Theevent string for this LogEntry.

◆ TAG

#define TAG   "AndroidSLESMediaQueueTest"

String to identify log entries originating from this file.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0