avs-device-sdk/CapabilityAgents/TemplateRuntime/test/TemplateRuntimeTest.cpp

565 lines
25 KiB
C++
Raw Normal View History

Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
/*
* TemplateRuntimeTest.cpp
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/// @file TemplateRuntimeTest
#include <memory>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <rapidjson/document.h>
#include <AVSCommon/AVS/Attachment/MockAttachmentManager.h>
#include <AVSCommon/SDKInterfaces/AudioPlayerInterface.h>
#include <AVSCommon/SDKInterfaces/AudioPlayerObserverInterface.h>
#include <AVSCommon/SDKInterfaces/MockDirectiveHandlerResult.h>
#include <AVSCommon/SDKInterfaces/MockExceptionEncounteredSender.h>
#include <AVSCommon/SDKInterfaces/TemplateRuntimeObserverInterface.h>
#include <AVSCommon/Utils/JSON/JSONUtils.h>
#include <AVSCommon/Utils/Memory/Memory.h>
#include "TemplateRuntime/TemplateRuntime.h"
namespace alexaClientSDK {
namespace capabilityAgents {
namespace templateRuntime {
namespace test {
using namespace avsCommon::avs;
using namespace avsCommon::avs::attachment::test;
using namespace avsCommon::sdkInterfaces;
using namespace avsCommon::sdkInterfaces::test;
using namespace avsCommon::utils::memory;
using namespace rapidjson;
using namespace ::testing;
/// Timeout when waiting for futures to be set.
static std::chrono::milliseconds TIMEOUT(1000);
/// The namespace for this capability agent.
static const std::string NAMESPACE{"TemplateRuntime"};
/// An unknown directive signature.
static const std::string UNKNOWN_DIRECTIVE{"Unknown"};
/// The RenderTemplate directive signature.
static const NamespaceAndName TEMPLATE{NAMESPACE, "RenderTemplate"};
/// The RenderPlayerInfo directive signature.
static const NamespaceAndName PLAYER_INFO{NAMESPACE, "RenderPlayerInfo"};
/// The @c MessageId identifer.
static const std::string MESSAGE_ID("messageId");
/// An audioItemId for the RenderPlayerInfo directive.
static const std::string AUDIO_ITEM_ID("AudioItemId abcdefgh");
/// An audioItemId without a corresponding RenderPlayerInfo directive.
static const std::string AUDIO_ITEM_ID_1("AudioItemId 12345678");
/// A RenderTemplate directive payload.
// clang-format off
static const std::string TEMPLATE_PAYLOAD = "{"
"\"token\":\"TOKEN1\","
"\"type\":\"BodyTemplate1\","
"\"title\":{"
"\"mainTitle\":\"MAIN_TITLE\","
"\"subTitle\":\"SUB_TITLE\""
"}"
"}";
// clang-format on
/// A RenderPlayerInfo directive payload.
// clang-format off
static const std::string PLAYERINFO_PAYLOAD = "{"
"\"audioItemId\":\"" + AUDIO_ITEM_ID + "\","
"\"content\":{"
"\"title\":\"TITLE\","
"\"header\":\"HEADER\""
"}"
"}";
// clang-format on
/// A malformed RenderPlayerInfo directive payload.
// clang-format off
static const std::string MALFORM_PLAYERINFO_PAYLOAD = "{"
"\"audioItemId\"::::\"" + AUDIO_ITEM_ID + "\","
"\"content\":{{{{"
"\"title\":\"TITLE\","
"\"header\":\"HEADER\""
"}"
"}";
// clang-format on
class MockAudioPlayer : public AudioPlayerInterface {
public:
MOCK_METHOD1(addObserver, void(std::shared_ptr<avsCommon::sdkInterfaces::AudioPlayerObserverInterface> observer));
MOCK_METHOD1(
removeObserver,
void(std::shared_ptr<avsCommon::sdkInterfaces::AudioPlayerObserverInterface> observer));
MOCK_METHOD0(getAudioItemOffset, std::chrono::milliseconds());
};
class MockGui : public TemplateRuntimeObserverInterface {
public:
MOCK_METHOD1(renderTemplateCard, void(const std::string& jsonPayload));
MOCK_METHOD2(
renderPlayerInfoCard,
void(const std::string& jsonPayload, TemplateRuntimeObserverInterface::AudioPlayerInfo audioPlayerInfo));
};
/// Test harness for @c TemplateRuntime class.
class TemplateRuntimeTest : public ::testing::Test {
public:
/// Set up the test harness for running a test.
void SetUp() override;
/// Clean up the test harness after running a test.
void TearDown() override;
/// Function to set the promise and wake @c m_wakeSetCompleteFuture.
void wakeOnSetCompleted();
/// Function to set the promise and wake @c m_wakeRenderTemplateCardFuture.
void wakeOnRenderTemplateCard();
/// Function to set the promise and wake @c m_wakeRenderPlayerInfoCardFuture.
void wakeOnRenderPlayerInfoCard();
/// A constructor which initializes the promises and futures needed for the test class.
TemplateRuntimeTest() :
m_wakeSetCompletedPromise{},
m_wakeSetCompletedFuture{m_wakeSetCompletedPromise.get_future()},
m_wakeRenderTemplateCardPromise{},
m_wakeRenderTemplateCardFuture{m_wakeRenderTemplateCardPromise.get_future()},
m_wakeRenderPlayerInfoCardPromise{},
m_wakeRenderPlayerInfoCardFuture{m_wakeRenderPlayerInfoCardPromise.get_future()} {
}
protected:
/// Promise to synchronize directive handling through setCompleted.
std::promise<void> m_wakeSetCompletedPromise;
/// Future to synchronize directive handling through setCompleted.
std::future<void> m_wakeSetCompletedFuture;
/// Promise to synchronize directive handling with RenderTemplateCard callback.
std::promise<void> m_wakeRenderTemplateCardPromise;
/// Future to synchronize directive handling with RenderTemplateCard callback.
std::future<void> m_wakeRenderTemplateCardFuture;
/// Promise to synchronize directive handling with RenderPlayerInfoCard callback.
std::promise<void> m_wakeRenderPlayerInfoCardPromise;
/// Future to synchronize directive handling with RenderPlayerInfoCard callback.
std::future<void> m_wakeRenderPlayerInfoCardFuture;
/// A nice mock for the AudioPlayerInterface calls.
std::shared_ptr<NiceMock<MockAudioPlayer>> m_mockAudioPlayerInterface;
/// A strict mock that allows the test to strictly monitor the exceptions being sent.
std::shared_ptr<StrictMock<MockExceptionEncounteredSender>> m_mockExceptionSender;
/// A strict mock that allows the test to strictly monitor the handling of directives.
std::unique_ptr<StrictMock<MockDirectiveHandlerResult>> m_mockDirectiveHandlerResult;
/// A strict mock to allow testing of the observer callback.
std::shared_ptr<StrictMock<MockGui>> m_mockGui;
/// A pointer to an instance of the TemplateRuntime that will be instantiated per test.
std::shared_ptr<TemplateRuntime> m_templateRuntime;
};
void TemplateRuntimeTest::SetUp() {
m_mockExceptionSender = std::make_shared<StrictMock<MockExceptionEncounteredSender>>();
m_mockDirectiveHandlerResult = make_unique<StrictMock<MockDirectiveHandlerResult>>();
m_mockAudioPlayerInterface = std::make_shared<NiceMock<MockAudioPlayer>>();
m_mockGui = std::make_shared<StrictMock<MockGui>>();
}
void TemplateRuntimeTest::TearDown() {
if (m_templateRuntime) {
m_templateRuntime->shutdown();
m_templateRuntime.reset();
}
}
void TemplateRuntimeTest::wakeOnSetCompleted() {
m_wakeSetCompletedPromise.set_value();
}
void TemplateRuntimeTest::wakeOnRenderTemplateCard() {
m_wakeRenderTemplateCardPromise.set_value();
}
void TemplateRuntimeTest::wakeOnRenderPlayerInfoCard() {
m_wakeRenderPlayerInfoCardPromise.set_value();
}
/**
* Tests creating the TemplateRuntime with a null audioPlayerInterface.
*/
TEST_F(TemplateRuntimeTest, testNullAudioPlayerInterface) {
m_templateRuntime = TemplateRuntime::create(nullptr, m_mockExceptionSender);
ASSERT_EQ(m_templateRuntime, nullptr);
}
/**
* Tests creating the TemplateRuntime with a null exceptionSender.
*/
TEST_F(TemplateRuntimeTest, testNullExceptionSender) {
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, nullptr);
ASSERT_EQ(m_templateRuntime, nullptr);
}
/**
* Tests that the TemplateRuntime successfully add itself with the AudioPlayer at constructor time, and
* successfully remove itself with the AudioPlayer during shutdown.
*/
TEST_F(TemplateRuntimeTest, testAudioPlayerAddRemoveObserver) {
EXPECT_CALL(*m_mockAudioPlayerInterface, addObserver(NotNull())).Times(Exactly(1));
EXPECT_CALL(*m_mockAudioPlayerInterface, removeObserver(NotNull())).Times(Exactly(1));
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
}
/**
* Tests unknown Directive. Expect that the sendExceptionEncountered and setFailed will be called.
*/
TEST_F(TemplateRuntimeTest, testUnknownDirective) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(NAMESPACE, UNKNOWN_DIRECTIVE, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive = AVSDirective::create("", avsMessageHeader, "", attachmentManager, "");
EXPECT_CALL(*m_mockExceptionSender, sendExceptionEncountered(_, _, _)).Times(Exactly(1));
EXPECT_CALL(*m_mockDirectiveHandlerResult, setFailed(_))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
}
/**
* Tests RenderTemplate Directive. Expect that the renderTemplateCard callback will be called.
*/
TEST_F(TemplateRuntimeTest, testRenderTemplateDirective) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(TEMPLATE.nameSpace, TEMPLATE.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, TEMPLATE_PAYLOAD, attachmentManager, "");
EXPECT_CALL(*m_mockGui, renderTemplateCard(TEMPLATE_PAYLOAD)).Times(Exactly(1));
EXPECT_CALL(*m_mockDirectiveHandlerResult, setCompleted())
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_templateRuntime->CapabilityAgent::handleDirective(MESSAGE_ID);
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
}
/**
* Tests RenderTemplate Directive using the handleDirectiveImmediately. Expect that the renderTemplateCard
* callback will be called.
*/
TEST_F(TemplateRuntimeTest, testHandleDirectiveImmediately) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(TEMPLATE.nameSpace, TEMPLATE.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, TEMPLATE_PAYLOAD, attachmentManager, "");
EXPECT_CALL(*m_mockGui, renderTemplateCard(TEMPLATE_PAYLOAD))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnRenderTemplateCard));
m_templateRuntime->handleDirectiveImmediately(directive);
m_wakeRenderTemplateCardFuture.wait_for(TIMEOUT);
}
/**
* Tests RenderTemplate Directive received before the corresponding AudioPlayer call. Expect
* that the renderTemplateCard callback will be called.
*/
TEST_F(TemplateRuntimeTest, testRenderPlayerInfoDirectiveBefore) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(PLAYER_INFO.nameSpace, PLAYER_INFO.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, PLAYERINFO_PAYLOAD, attachmentManager, "");
::testing::InSequence s;
EXPECT_CALL(*m_mockDirectiveHandlerResult, setCompleted())
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
EXPECT_CALL(*m_mockGui, renderTemplateCard(_)).Times(Exactly(0));
// do not expect renderPlayerInfo card call until AudioPlayer notify with the correct audioItemId
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(_, _)).Times(Exactly(0));
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_templateRuntime->CapabilityAgent::handleDirective(MESSAGE_ID);
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnRenderPlayerInfoCard));
AudioPlayerObserverInterface::Context context;
context.audioItemId = AUDIO_ITEM_ID;
context.offset = TIMEOUT;
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::PLAYING, context);
m_wakeRenderPlayerInfoCardFuture.wait_for(TIMEOUT);
}
/**
* Tests RenderTemplate Directive received after the corresponding AudioPlayer call. Expect
* that the renderTemplateCard callback will be called.
*/
TEST_F(TemplateRuntimeTest, testRenderPlayerInfoDirectiveAfter) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(PLAYER_INFO.nameSpace, PLAYER_INFO.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, PLAYERINFO_PAYLOAD, attachmentManager, "");
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnRenderPlayerInfoCard));
EXPECT_CALL(*m_mockDirectiveHandlerResult, setCompleted())
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
AudioPlayerObserverInterface::Context context;
context.audioItemId = AUDIO_ITEM_ID;
context.offset = TIMEOUT;
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::PLAYING, context);
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_templateRuntime->CapabilityAgent::handleDirective(MESSAGE_ID);
m_wakeRenderPlayerInfoCardFuture.wait_for(TIMEOUT);
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
}
/**
* Tests RenderTemplate Directive received without an audioItemId. Expect that the
* sendExceptionEncountered and setFailed will be called.
*/
TEST_F(TemplateRuntimeTest, testRenderPlayerInfoDirectiveWithoutAudioItemId) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(PLAYER_INFO.nameSpace, PLAYER_INFO.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, TEMPLATE_PAYLOAD, attachmentManager, "");
EXPECT_CALL(*m_mockExceptionSender, sendExceptionEncountered(_, _, _)).Times(Exactly(1));
EXPECT_CALL(*m_mockDirectiveHandlerResult, setFailed(_))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
}
/**
* Tests when a malformed RenderTemplate Directive is received. Expect that the
* sendExceptionEncountered and setFailed will be called.
*/
TEST_F(TemplateRuntimeTest, testMalformedRenderPlayerInfoDirective) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(PLAYER_INFO.nameSpace, PLAYER_INFO.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, MALFORM_PLAYERINFO_PAYLOAD, attachmentManager, "");
EXPECT_CALL(*m_mockExceptionSender, sendExceptionEncountered(_, _, _)).Times(Exactly(1));
EXPECT_CALL(*m_mockDirectiveHandlerResult, setFailed(_))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
}
/**
* Tests AudioPlayer notified the handling of AUDIO_ITEM_ID_1, and then RenderTemplate Directive with
* AUDIO_ITEM_ID is received. Expect that the renderTemplateCard callback will not be called until
* the AudioPlayer notified the handling of AUDIO_ITEM_ID later.
*/
TEST_F(TemplateRuntimeTest, testRenderPlayerInfoDirectiveDifferentAudioItemId) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(PLAYER_INFO.nameSpace, PLAYER_INFO.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, PLAYERINFO_PAYLOAD, attachmentManager, "");
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _)).Times(Exactly(0));
EXPECT_CALL(*m_mockDirectiveHandlerResult, setCompleted())
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
AudioPlayerObserverInterface::Context context;
context.audioItemId = AUDIO_ITEM_ID_1;
context.offset = TIMEOUT;
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::PLAYING, context);
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_templateRuntime->CapabilityAgent::handleDirective(MESSAGE_ID);
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnRenderPlayerInfoCard));
context.audioItemId = AUDIO_ITEM_ID;
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::PLAYING, context);
m_wakeRenderPlayerInfoCardFuture.wait_for(TIMEOUT);
}
/**
* Tests AudioPlayer callbacks will trigger the correct renderPlayerInfoCard callbacks. Expect
* the payload, audioPlayerState and offset to match to the ones passed in by the
* AudioPlayerObserverInterface.
*/
TEST_F(TemplateRuntimeTest, testRenderPlayerInfoDirectiveAudioStateUpdate) {
// Create TemplateRuntime and add m_mockGui and its observer.
m_templateRuntime = TemplateRuntime::create(m_mockAudioPlayerInterface, m_mockExceptionSender);
m_templateRuntime->addObserver(m_mockGui);
// Create Directive.
auto attachmentManager = std::make_shared<StrictMock<MockAttachmentManager>>();
auto avsMessageHeader = std::make_shared<AVSMessageHeader>(PLAYER_INFO.nameSpace, PLAYER_INFO.name, MESSAGE_ID);
std::shared_ptr<AVSDirective> directive =
AVSDirective::create("", avsMessageHeader, PLAYERINFO_PAYLOAD, attachmentManager, "");
::testing::InSequence s;
// Send a directive first to TemplateRuntime
EXPECT_CALL(*m_mockDirectiveHandlerResult, setCompleted())
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(this, &TemplateRuntimeTest::wakeOnSetCompleted));
m_templateRuntime->CapabilityAgent::preHandleDirective(directive, std::move(m_mockDirectiveHandlerResult));
m_templateRuntime->CapabilityAgent::handleDirective(MESSAGE_ID);
m_wakeSetCompletedFuture.wait_for(TIMEOUT);
AudioPlayerObserverInterface::Context context;
context.audioItemId = AUDIO_ITEM_ID;
// Test onAudioPlayed() callback with 100ms offset
std::promise<void> wakePlayPromise;
std::future<void> wakePlayFuture = wakePlayPromise.get_future();
context.offset = std::chrono::milliseconds(100);
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(Invoke(
v1.3.0 released 12/08/2017: **Enhancements** * ContextManager now passes the namespace/name of the desired state to StateProv iderInterface::provideState(). This is helpful when a single StateProvider obje ct provides multiple states, and needs to know which one ContextManager is askin g for. * The mime parser was hardened against duplicate boundaries. * Added functionality to add and remove AudioPlayer observers to the DefaultClie nt. * Unit tests for Alerts were added. * Added en-IN, en-CA and ja-JP to the SampleApp locale selection menu. * Added default alert and timer audio data to the SDK SampleApp. There is no lo nger a requirement to download these audio files and configure them in the json configuration file. * Added support in SDS Reader and AttachmentReader for seeking into the future. This allows a reader to move to an index which has not yet arrived in the SDS a nd poll/block until it arrives. * Added support for blocking Writers in the SharedDataStream class. * Changed the default status code sent by MessageRequestObserverInterface::onSen dCompleted() to SERVER_OTHER_ERROR, and mapped HTTP code 500 to SERVER_INTERNAL_ ERROR_V2. * Added support for parsing stream duration out of playlists. * Added a configuration option ("sampleApp":"displayCardsSupported") that allows the displaying of display cards to be enabled or disabled. * Named Timers and Reminders have been updated to fall back to the on-device bac kground audio sound when cloud urls cannot be accessed or rendered. **Bug Fixes** * Removed floating point dependencies from core SDK libraries. * Fixed bug in SpeechSynthesizer where it's erroneously calling stop more than once. * Fixed an issue in ContentFetcher where it could hang during destruction until an active GET request completed. * Fixed a couple of parsing bugs in LibCurlHttpContentFetcher related to case-sensitivity and mime-type handling. * Fixed a bug where MediaPlayerObserverInterface::onPlaybackResumed() wasn't being called after resuming from a pause with a pending play/resume. * Fixed a bug in LibCurlContentFetcher where it could error out if data is written to the SDS faster than it is consumed. * The GStreamer-based MediaPlayer reference implementation now uses the ACL HTTP configured client. * An API change has been made to MediaPlayerInterface::setSource(). This method now takes in an optional offset as well to allow for immediately streaming to the offset if possible. * Next and Previous buttons now work with Audible. * Pandora resume stuttering is addressed. * Pausing and resuming Amazon music no longer seeks back to the beginning of the song. * libcurl CURLOPT_NOSIGNAL option is set to 1 (https://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html) to avoid crashes observed in SampleApp. * Fixed the timing of the PlaybackReportIntervalEvent and PlaybackReportDelayEvent as specified in the directives. * Fixed potential deadlocks in MediaPlayer during shutdown related to queued callbacks. * Fixed a crash in MediaPlayer that could occur if the network is disconnected during playback. * Fixed a bug where music could keep playing while Alexa is speaking. * Fixed a bug which was causing problems with pause/resume and next/previous with Amazon Music. * Fixed a bug where music could briefly start playing between speaks. * Fixed a bug where HLS playlists would stop streaming after the initial playlist had been played to completion. * Fixed a bug where Audible playback could not advance to the next chapter. * Fixed some occurrences of SDK entering the IDLE state during the transition between Listening and Speaking states. * Fixed a bug where PlaybackFinished events were not reporting the correct offset. * An API change has been made to MediaPlayerInterface::getOffset(). This method is now required to return the final offset when called after playback has stopped. * Fixed a problem where AIP was erroneously resetting its state upon getting a cancelDirective() callback. **Known Issues** * Capability agent for Notifications is not included in this release. * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed. * GUI cards don't show for Kindle. * The new SpeechSynthesizerState state values GAINING_FOCUS and LOSING_FOCUS were added as part of a work-around. The will likely be removed in subsequent releases. * With the gstreamer-based MediaPlayer, after muting and unmuting, the next item starts playing rather than continuing with the current item.
2017-12-09 00:07:37 +00:00
[&wakePlayPromise, context](
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
const std::string& jsonPayload, TemplateRuntimeObserverInterface::AudioPlayerInfo audioPlayerInfo) {
EXPECT_EQ(audioPlayerInfo.audioPlayerState, avsCommon::avs::PlayerActivity::PLAYING);
EXPECT_EQ(audioPlayerInfo.offset, context.offset);
wakePlayPromise.set_value();
}));
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::PLAYING, context);
wakePlayFuture.wait_for(TIMEOUT);
// Test onAudioPaused() callback with 200ms offset
std::promise<void> wakePausePromise;
std::future<void> wakePauseFuture = wakePausePromise.get_future();
context.offset = std::chrono::milliseconds(200);
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(Invoke(
v1.3.0 released 12/08/2017: **Enhancements** * ContextManager now passes the namespace/name of the desired state to StateProv iderInterface::provideState(). This is helpful when a single StateProvider obje ct provides multiple states, and needs to know which one ContextManager is askin g for. * The mime parser was hardened against duplicate boundaries. * Added functionality to add and remove AudioPlayer observers to the DefaultClie nt. * Unit tests for Alerts were added. * Added en-IN, en-CA and ja-JP to the SampleApp locale selection menu. * Added default alert and timer audio data to the SDK SampleApp. There is no lo nger a requirement to download these audio files and configure them in the json configuration file. * Added support in SDS Reader and AttachmentReader for seeking into the future. This allows a reader to move to an index which has not yet arrived in the SDS a nd poll/block until it arrives. * Added support for blocking Writers in the SharedDataStream class. * Changed the default status code sent by MessageRequestObserverInterface::onSen dCompleted() to SERVER_OTHER_ERROR, and mapped HTTP code 500 to SERVER_INTERNAL_ ERROR_V2. * Added support for parsing stream duration out of playlists. * Added a configuration option ("sampleApp":"displayCardsSupported") that allows the displaying of display cards to be enabled or disabled. * Named Timers and Reminders have been updated to fall back to the on-device bac kground audio sound when cloud urls cannot be accessed or rendered. **Bug Fixes** * Removed floating point dependencies from core SDK libraries. * Fixed bug in SpeechSynthesizer where it's erroneously calling stop more than once. * Fixed an issue in ContentFetcher where it could hang during destruction until an active GET request completed. * Fixed a couple of parsing bugs in LibCurlHttpContentFetcher related to case-sensitivity and mime-type handling. * Fixed a bug where MediaPlayerObserverInterface::onPlaybackResumed() wasn't being called after resuming from a pause with a pending play/resume. * Fixed a bug in LibCurlContentFetcher where it could error out if data is written to the SDS faster than it is consumed. * The GStreamer-based MediaPlayer reference implementation now uses the ACL HTTP configured client. * An API change has been made to MediaPlayerInterface::setSource(). This method now takes in an optional offset as well to allow for immediately streaming to the offset if possible. * Next and Previous buttons now work with Audible. * Pandora resume stuttering is addressed. * Pausing and resuming Amazon music no longer seeks back to the beginning of the song. * libcurl CURLOPT_NOSIGNAL option is set to 1 (https://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html) to avoid crashes observed in SampleApp. * Fixed the timing of the PlaybackReportIntervalEvent and PlaybackReportDelayEvent as specified in the directives. * Fixed potential deadlocks in MediaPlayer during shutdown related to queued callbacks. * Fixed a crash in MediaPlayer that could occur if the network is disconnected during playback. * Fixed a bug where music could keep playing while Alexa is speaking. * Fixed a bug which was causing problems with pause/resume and next/previous with Amazon Music. * Fixed a bug where music could briefly start playing between speaks. * Fixed a bug where HLS playlists would stop streaming after the initial playlist had been played to completion. * Fixed a bug where Audible playback could not advance to the next chapter. * Fixed some occurrences of SDK entering the IDLE state during the transition between Listening and Speaking states. * Fixed a bug where PlaybackFinished events were not reporting the correct offset. * An API change has been made to MediaPlayerInterface::getOffset(). This method is now required to return the final offset when called after playback has stopped. * Fixed a problem where AIP was erroneously resetting its state upon getting a cancelDirective() callback. **Known Issues** * Capability agent for Notifications is not included in this release. * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed. * GUI cards don't show for Kindle. * The new SpeechSynthesizerState state values GAINING_FOCUS and LOSING_FOCUS were added as part of a work-around. The will likely be removed in subsequent releases. * With the gstreamer-based MediaPlayer, after muting and unmuting, the next item starts playing rather than continuing with the current item.
2017-12-09 00:07:37 +00:00
[&wakePausePromise, context](
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
const std::string& jsonPayload, TemplateRuntimeObserverInterface::AudioPlayerInfo audioPlayerInfo) {
EXPECT_EQ(audioPlayerInfo.audioPlayerState, avsCommon::avs::PlayerActivity::PAUSED);
EXPECT_EQ(audioPlayerInfo.offset, context.offset);
wakePausePromise.set_value();
}));
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::PAUSED, context);
wakePauseFuture.wait_for(TIMEOUT);
// Test onAudioStopped() callback with 300ms offset
std::promise<void> wakeStopPromise;
std::future<void> wakeStopFuture = wakeStopPromise.get_future();
context.offset = std::chrono::milliseconds(300);
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(Invoke(
v1.3.0 released 12/08/2017: **Enhancements** * ContextManager now passes the namespace/name of the desired state to StateProv iderInterface::provideState(). This is helpful when a single StateProvider obje ct provides multiple states, and needs to know which one ContextManager is askin g for. * The mime parser was hardened against duplicate boundaries. * Added functionality to add and remove AudioPlayer observers to the DefaultClie nt. * Unit tests for Alerts were added. * Added en-IN, en-CA and ja-JP to the SampleApp locale selection menu. * Added default alert and timer audio data to the SDK SampleApp. There is no lo nger a requirement to download these audio files and configure them in the json configuration file. * Added support in SDS Reader and AttachmentReader for seeking into the future. This allows a reader to move to an index which has not yet arrived in the SDS a nd poll/block until it arrives. * Added support for blocking Writers in the SharedDataStream class. * Changed the default status code sent by MessageRequestObserverInterface::onSen dCompleted() to SERVER_OTHER_ERROR, and mapped HTTP code 500 to SERVER_INTERNAL_ ERROR_V2. * Added support for parsing stream duration out of playlists. * Added a configuration option ("sampleApp":"displayCardsSupported") that allows the displaying of display cards to be enabled or disabled. * Named Timers and Reminders have been updated to fall back to the on-device bac kground audio sound when cloud urls cannot be accessed or rendered. **Bug Fixes** * Removed floating point dependencies from core SDK libraries. * Fixed bug in SpeechSynthesizer where it's erroneously calling stop more than once. * Fixed an issue in ContentFetcher where it could hang during destruction until an active GET request completed. * Fixed a couple of parsing bugs in LibCurlHttpContentFetcher related to case-sensitivity and mime-type handling. * Fixed a bug where MediaPlayerObserverInterface::onPlaybackResumed() wasn't being called after resuming from a pause with a pending play/resume. * Fixed a bug in LibCurlContentFetcher where it could error out if data is written to the SDS faster than it is consumed. * The GStreamer-based MediaPlayer reference implementation now uses the ACL HTTP configured client. * An API change has been made to MediaPlayerInterface::setSource(). This method now takes in an optional offset as well to allow for immediately streaming to the offset if possible. * Next and Previous buttons now work with Audible. * Pandora resume stuttering is addressed. * Pausing and resuming Amazon music no longer seeks back to the beginning of the song. * libcurl CURLOPT_NOSIGNAL option is set to 1 (https://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html) to avoid crashes observed in SampleApp. * Fixed the timing of the PlaybackReportIntervalEvent and PlaybackReportDelayEvent as specified in the directives. * Fixed potential deadlocks in MediaPlayer during shutdown related to queued callbacks. * Fixed a crash in MediaPlayer that could occur if the network is disconnected during playback. * Fixed a bug where music could keep playing while Alexa is speaking. * Fixed a bug which was causing problems with pause/resume and next/previous with Amazon Music. * Fixed a bug where music could briefly start playing between speaks. * Fixed a bug where HLS playlists would stop streaming after the initial playlist had been played to completion. * Fixed a bug where Audible playback could not advance to the next chapter. * Fixed some occurrences of SDK entering the IDLE state during the transition between Listening and Speaking states. * Fixed a bug where PlaybackFinished events were not reporting the correct offset. * An API change has been made to MediaPlayerInterface::getOffset(). This method is now required to return the final offset when called after playback has stopped. * Fixed a problem where AIP was erroneously resetting its state upon getting a cancelDirective() callback. **Known Issues** * Capability agent for Notifications is not included in this release. * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed. * GUI cards don't show for Kindle. * The new SpeechSynthesizerState state values GAINING_FOCUS and LOSING_FOCUS were added as part of a work-around. The will likely be removed in subsequent releases. * With the gstreamer-based MediaPlayer, after muting and unmuting, the next item starts playing rather than continuing with the current item.
2017-12-09 00:07:37 +00:00
[&wakeStopPromise, context](
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
const std::string& jsonPayload, TemplateRuntimeObserverInterface::AudioPlayerInfo audioPlayerInfo) {
EXPECT_EQ(audioPlayerInfo.audioPlayerState, avsCommon::avs::PlayerActivity::STOPPED);
EXPECT_EQ(audioPlayerInfo.offset, context.offset);
wakeStopPromise.set_value();
}));
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::STOPPED, context);
wakeStopFuture.wait_for(TIMEOUT);
// Test onAudioFinished() callback with 400ms offset
std::promise<void> wakeFinishPromise;
std::future<void> wakeFinishFuture = wakeFinishPromise.get_future();
context.offset = std::chrono::milliseconds(400);
EXPECT_CALL(*m_mockGui, renderPlayerInfoCard(PLAYERINFO_PAYLOAD, _))
.Times(Exactly(1))
.WillOnce(Invoke(
v1.3.0 released 12/08/2017: **Enhancements** * ContextManager now passes the namespace/name of the desired state to StateProv iderInterface::provideState(). This is helpful when a single StateProvider obje ct provides multiple states, and needs to know which one ContextManager is askin g for. * The mime parser was hardened against duplicate boundaries. * Added functionality to add and remove AudioPlayer observers to the DefaultClie nt. * Unit tests for Alerts were added. * Added en-IN, en-CA and ja-JP to the SampleApp locale selection menu. * Added default alert and timer audio data to the SDK SampleApp. There is no lo nger a requirement to download these audio files and configure them in the json configuration file. * Added support in SDS Reader and AttachmentReader for seeking into the future. This allows a reader to move to an index which has not yet arrived in the SDS a nd poll/block until it arrives. * Added support for blocking Writers in the SharedDataStream class. * Changed the default status code sent by MessageRequestObserverInterface::onSen dCompleted() to SERVER_OTHER_ERROR, and mapped HTTP code 500 to SERVER_INTERNAL_ ERROR_V2. * Added support for parsing stream duration out of playlists. * Added a configuration option ("sampleApp":"displayCardsSupported") that allows the displaying of display cards to be enabled or disabled. * Named Timers and Reminders have been updated to fall back to the on-device bac kground audio sound when cloud urls cannot be accessed or rendered. **Bug Fixes** * Removed floating point dependencies from core SDK libraries. * Fixed bug in SpeechSynthesizer where it's erroneously calling stop more than once. * Fixed an issue in ContentFetcher where it could hang during destruction until an active GET request completed. * Fixed a couple of parsing bugs in LibCurlHttpContentFetcher related to case-sensitivity and mime-type handling. * Fixed a bug where MediaPlayerObserverInterface::onPlaybackResumed() wasn't being called after resuming from a pause with a pending play/resume. * Fixed a bug in LibCurlContentFetcher where it could error out if data is written to the SDS faster than it is consumed. * The GStreamer-based MediaPlayer reference implementation now uses the ACL HTTP configured client. * An API change has been made to MediaPlayerInterface::setSource(). This method now takes in an optional offset as well to allow for immediately streaming to the offset if possible. * Next and Previous buttons now work with Audible. * Pandora resume stuttering is addressed. * Pausing and resuming Amazon music no longer seeks back to the beginning of the song. * libcurl CURLOPT_NOSIGNAL option is set to 1 (https://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html) to avoid crashes observed in SampleApp. * Fixed the timing of the PlaybackReportIntervalEvent and PlaybackReportDelayEvent as specified in the directives. * Fixed potential deadlocks in MediaPlayer during shutdown related to queued callbacks. * Fixed a crash in MediaPlayer that could occur if the network is disconnected during playback. * Fixed a bug where music could keep playing while Alexa is speaking. * Fixed a bug which was causing problems with pause/resume and next/previous with Amazon Music. * Fixed a bug where music could briefly start playing between speaks. * Fixed a bug where HLS playlists would stop streaming after the initial playlist had been played to completion. * Fixed a bug where Audible playback could not advance to the next chapter. * Fixed some occurrences of SDK entering the IDLE state during the transition between Listening and Speaking states. * Fixed a bug where PlaybackFinished events were not reporting the correct offset. * An API change has been made to MediaPlayerInterface::getOffset(). This method is now required to return the final offset when called after playback has stopped. * Fixed a problem where AIP was erroneously resetting its state upon getting a cancelDirective() callback. **Known Issues** * Capability agent for Notifications is not included in this release. * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed. * GUI cards don't show for Kindle. * The new SpeechSynthesizerState state values GAINING_FOCUS and LOSING_FOCUS were added as part of a work-around. The will likely be removed in subsequent releases. * With the gstreamer-based MediaPlayer, after muting and unmuting, the next item starts playing rather than continuing with the current item.
2017-12-09 00:07:37 +00:00
[&wakeFinishPromise, context](
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
const std::string& jsonPayload, TemplateRuntimeObserverInterface::AudioPlayerInfo audioPlayerInfo) {
EXPECT_EQ(audioPlayerInfo.audioPlayerState, avsCommon::avs::PlayerActivity::FINISHED);
EXPECT_EQ(audioPlayerInfo.offset, context.offset);
wakeFinishPromise.set_value();
}));
m_templateRuntime->onPlayerActivityChanged(avsCommon::avs::PlayerActivity::FINISHED, context);
wakeFinishFuture.wait_for(TIMEOUT);
}
} // namespace test
} // namespace templateRuntime
} // namespace capabilityAgents
} // namespace alexaClientSDK