Version 1.10 alexa-client-sdk
Changes in this update:
**Enhancements**
* New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes.
* Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES.
* New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144).
* A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA.
* Added Bluetooth A2DP source and AVRCP target support for Linux.
* Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`.
* Added locale support for IT and ES.
* The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command.
* Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes.
* `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic.
**Bug Fixes**
* Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS.
* [Issue 973](https://github.com/alexa/avs-device-sdk/issues/973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets.
* An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices.
* [Issue 948](https://github.com/alexa/avs-device-sdk/issues/948) - Fixed a bug in which the sample app was stuck in a listening state.
* Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert.
* [Issue 839](https://github.com/alexa/avs-device-sdk/issues/839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state.
* Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus.
* `CapabilitiesDelegateTest` now works on Android.
* [Issue 950](https://github.com/alexa/avs-device-sdk/issues/950) - Improved Android Media Player audio quality.
* [Issue 908](https://github.com/alexa/avs-device-sdk/issues/908) - Fixed compile error on g++ 7.x in which includes were missing.
2018-10-24 17:01:29 +00:00
|
|
|
/*
|
Version 1.12.1 alexa-client-sdk
Changes in this update:
**Bug Fixes**
* Fixed a bug where the same URL was being requested twice when streaming iHeartRadio. Now, a single request is sent.
* Corrected pause/resume handling in `ProgressTimer` so that extra `ProgressReportDelayElapsed` events are not sent to AVS.
**Known Issues**
* Music playback history isn't being displayed in the Alexa app for certain account and device types.
* On GCC 8+, issues related to `-Wclass-memaccess` will trigger warnings. However, this won't cause the build to fail and these warnings can be ignored.
* Android error ("libDefaultClient.so" not found) can be resolved by upgrading to ADB version 1.0.40
* When network connection is lost, lost connection status is not returned via local TTS.
* `ACL` may encounter issues if audio attachments are received but not consumed.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* The Alexa app doesn't always indicate when a device is successfully connected via Bluetooth.
* Connecting a product to streaming media via Bluetooth will sometimes stop media playback within the source application. Resuming playback through the source application or toggling next/previous will correct playback.
* When a source device is streaming silence via Bluetooth, the Alexa app indicates that audio content is streaming.
* The Bluetooth agent assumes that the Bluetooth adapter is always connected to a power source. Disconnecting from a power source during operation is not yet supported.
* On some products, interrupted Bluetooth playback may not resume if other content is locally streamed.
* `make integration` is currently not available for Android. In order to run integration tests on Android, you'll need to manually upload the test binary file along with any input file. At that point, the adb can be used to run the integration tests.
* On Raspberry Pi running Android Things with HDMI output audio, beginning of speech is truncated when Alexa responds to user text-to-speech (TTS).
* When the sample app is restarted and the network connection is lost, the Reminder TTS message does not play. Instead, the default alarm tone will play twice.
2019-04-03 00:25:10 +00:00
|
|
|
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
Version 1.10 alexa-client-sdk
Changes in this update:
**Enhancements**
* New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes.
* Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES.
* New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144).
* A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA.
* Added Bluetooth A2DP source and AVRCP target support for Linux.
* Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`.
* Added locale support for IT and ES.
* The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command.
* Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes.
* `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic.
**Bug Fixes**
* Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS.
* [Issue 973](https://github.com/alexa/avs-device-sdk/issues/973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets.
* An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices.
* [Issue 948](https://github.com/alexa/avs-device-sdk/issues/948) - Fixed a bug in which the sample app was stuck in a listening state.
* Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert.
* [Issue 839](https://github.com/alexa/avs-device-sdk/issues/839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state.
* Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus.
* `CapabilitiesDelegateTest` now works on Android.
* [Issue 950](https://github.com/alexa/avs-device-sdk/issues/950) - Improved Android Media Player audio quality.
* [Issue 908](https://github.com/alexa/avs-device-sdk/issues/908) - Fixed compile error on g++ 7.x in which includes were missing.
2018-10-24 17:01:29 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
|
|
|
#include <AVSCommon/Utils/PromiseFuturePair.h>
|
|
|
|
#include <AVSCommon/Utils/Timing/Stopwatch.h>
|
|
|
|
|
|
|
|
#include "AudioPlayer/ProgressTimer.h"
|
|
|
|
|
|
|
|
namespace alexaClientSDK {
|
|
|
|
namespace capabilityAgents {
|
|
|
|
namespace audioPlayer {
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
using namespace avsCommon::utils;
|
|
|
|
using namespace avsCommon::utils::timing;
|
|
|
|
using namespace testing;
|
|
|
|
|
|
|
|
/// 10 millisecond delay or interval value.
|
|
|
|
static const std::chrono::milliseconds MILLIS_10{10};
|
|
|
|
|
|
|
|
/// 25 millisecond delay or interval value (something not an interval of @c MILLIS_10).
|
|
|
|
static const std::chrono::milliseconds MILLIS_25{25};
|
|
|
|
|
|
|
|
/// 100 millisecond duration to allow ProgressTimer to misbehave.
|
|
|
|
static const std::chrono::milliseconds MILLIS_100{100};
|
|
|
|
|
|
|
|
/// 5 second timer to allow plenty of time for expected behaviors to be detected.
|
|
|
|
static const std::chrono::seconds FAIL_TIMEOUT{5};
|
|
|
|
|
|
|
|
/// Delay value to use for test to verify offsets.
|
|
|
|
static const std::chrono::milliseconds OFFSET_TEST_DELAY{300};
|
|
|
|
|
|
|
|
/// Interval value to use for test to verify offsets.
|
|
|
|
static const std::chrono::milliseconds OFFSET_TEST_INTERVAL{500};
|
|
|
|
|
|
|
|
/// Amount an offset can be less than expected and still be acceptable.
|
|
|
|
static const std::chrono::milliseconds LOWER_ERROR{100};
|
|
|
|
|
|
|
|
/// Amount an offset can be greater than expected and still be acceptable.
|
|
|
|
static const std::chrono::milliseconds UPPER_ERROR{200};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function used to validate received offset values.
|
|
|
|
*
|
|
|
|
* @param expected The expected offset.
|
|
|
|
* @param received The received offset.
|
|
|
|
*/
|
|
|
|
static void verifyOffset(std::chrono::milliseconds expected, std::chrono::milliseconds received) {
|
|
|
|
ASSERT_GE(received, expected - LOWER_ERROR);
|
|
|
|
ASSERT_LE(received, expected + UPPER_ERROR);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mock of ProgressTimer::ContextInterface with which to verify ProgressTimer behavior.
|
|
|
|
*/
|
|
|
|
class MockContext : public ProgressTimer::ContextInterface {
|
|
|
|
public:
|
|
|
|
MOCK_METHOD0(requestProgress, void());
|
|
|
|
MOCK_METHOD0(onProgressReportDelayElapsed, void());
|
|
|
|
MOCK_METHOD0(onProgressReportIntervalElapsed, void());
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test fixture for exercising ProgressTimer.
|
|
|
|
*
|
|
|
|
* The player methods (i.e. play(), pause(), resume(), stop()) control reporting mock progress in the
|
|
|
|
* audio stream, and call ProgressTimer methods (rather than directly in the tests) to simplify the
|
|
|
|
* tests and assure proper ordering of ersatz player state and ProgressTimer calls.
|
|
|
|
*/
|
|
|
|
class ProgressTimerTest : public ::testing::Test {
|
|
|
|
public:
|
|
|
|
/// @{
|
|
|
|
/// @name Test methods
|
|
|
|
void SetUp() override;
|
|
|
|
/// @}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start the the audio offset generator and then the ProgressTimer.
|
|
|
|
*/
|
|
|
|
void play();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pause the ProgressTimer and then the audio offset generator.
|
|
|
|
*/
|
|
|
|
void pause();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resume the audio offset generator and then the ProgressTimer.
|
|
|
|
*/
|
|
|
|
void resume();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop the ProgressTimer and then the offset generator.
|
|
|
|
*/
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current offset in to the mock audio stream and call m_timer.onProgress() with it.
|
|
|
|
*/
|
|
|
|
void callOnProgress();
|
|
|
|
|
|
|
|
/// The MockContext with which to monitor @c m_timer's behavior.
|
|
|
|
std::shared_ptr<MockContext> m_mockContext;
|
|
|
|
|
|
|
|
/// The ProgressTimer to test.
|
|
|
|
ProgressTimer m_timer;
|
|
|
|
|
|
|
|
/// A stopwatch with which to generate offsets.
|
|
|
|
Stopwatch m_stopwatch;
|
|
|
|
};
|
|
|
|
|
|
|
|
void ProgressTimerTest::SetUp() {
|
|
|
|
m_mockContext = std::make_shared<NiceMock<MockContext>>();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressTimerTest::play() {
|
|
|
|
ASSERT_TRUE(m_stopwatch.start());
|
|
|
|
m_timer.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressTimerTest::pause() {
|
|
|
|
ASSERT_TRUE(m_stopwatch.pause());
|
|
|
|
m_timer.pause();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressTimerTest::resume() {
|
|
|
|
ASSERT_TRUE(m_stopwatch.resume());
|
|
|
|
m_timer.resume();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressTimerTest::stop() {
|
|
|
|
m_stopwatch.stop();
|
|
|
|
m_timer.stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressTimerTest::callOnProgress() {
|
|
|
|
auto progress = m_stopwatch.getElapsed();
|
|
|
|
m_timer.onProgress(progress);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that with invalid delay and interval, no progress is reported.
|
|
|
|
TEST_F(ProgressTimerTest, testNoDelayOrInterval) {
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(0);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(0);
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, ProgressTimer::NO_DELAY, ProgressTimer::NO_INTERVAL);
|
|
|
|
|
|
|
|
play();
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that an interval of zero does not trigger progress reports or a crash.
|
|
|
|
TEST_F(ProgressTimerTest, testZeroInterval) {
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(0);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(0);
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, ProgressTimer::NO_DELAY, std::chrono::milliseconds{0});
|
|
|
|
|
|
|
|
play();
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that with a valid delay and invalid interval, a delay notification is generated.
|
|
|
|
TEST_F(ProgressTimerTest, testJustDelay) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(1);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(0);
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, MILLIS_10, ProgressTimer::NO_INTERVAL);
|
|
|
|
|
|
|
|
play();
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that with a invalid delay and a valid interval, interval notifications are generated.
|
|
|
|
TEST_F(ProgressTimerTest, testJustInterval) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
int reportCounter = 0;
|
|
|
|
PromiseFuturePair<void> gotTenReports;
|
|
|
|
auto notifyOnTenReports = [&reportCounter, &gotTenReports]() {
|
|
|
|
if (10 == ++reportCounter) {
|
|
|
|
gotTenReports.setValue();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(0);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).WillRepeatedly(Invoke(notifyOnTenReports));
|
|
|
|
|
Version 1.12.1 alexa-client-sdk
Changes in this update:
**Bug Fixes**
* Fixed a bug where the same URL was being requested twice when streaming iHeartRadio. Now, a single request is sent.
* Corrected pause/resume handling in `ProgressTimer` so that extra `ProgressReportDelayElapsed` events are not sent to AVS.
**Known Issues**
* Music playback history isn't being displayed in the Alexa app for certain account and device types.
* On GCC 8+, issues related to `-Wclass-memaccess` will trigger warnings. However, this won't cause the build to fail and these warnings can be ignored.
* Android error ("libDefaultClient.so" not found) can be resolved by upgrading to ADB version 1.0.40
* When network connection is lost, lost connection status is not returned via local TTS.
* `ACL` may encounter issues if audio attachments are received but not consumed.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* The Alexa app doesn't always indicate when a device is successfully connected via Bluetooth.
* Connecting a product to streaming media via Bluetooth will sometimes stop media playback within the source application. Resuming playback through the source application or toggling next/previous will correct playback.
* When a source device is streaming silence via Bluetooth, the Alexa app indicates that audio content is streaming.
* The Bluetooth agent assumes that the Bluetooth adapter is always connected to a power source. Disconnecting from a power source during operation is not yet supported.
* On some products, interrupted Bluetooth playback may not resume if other content is locally streamed.
* `make integration` is currently not available for Android. In order to run integration tests on Android, you'll need to manually upload the test binary file along with any input file. At that point, the adb can be used to run the integration tests.
* On Raspberry Pi running Android Things with HDMI output audio, beginning of speech is truncated when Alexa responds to user text-to-speech (TTS).
* When the sample app is restarted and the network connection is lost, the Reminder TTS message does not play. Instead, the default alarm tone will play twice.
2019-04-03 00:25:10 +00:00
|
|
|
m_timer.init(m_mockContext, ProgressTimer::NO_DELAY, MILLIS_10);
|
Version 1.10 alexa-client-sdk
Changes in this update:
**Enhancements**
* New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes.
* Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES.
* New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144).
* A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA.
* Added Bluetooth A2DP source and AVRCP target support for Linux.
* Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`.
* Added locale support for IT and ES.
* The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command.
* Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes.
* `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic.
**Bug Fixes**
* Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS.
* [Issue 973](https://github.com/alexa/avs-device-sdk/issues/973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets.
* An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices.
* [Issue 948](https://github.com/alexa/avs-device-sdk/issues/948) - Fixed a bug in which the sample app was stuck in a listening state.
* Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert.
* [Issue 839](https://github.com/alexa/avs-device-sdk/issues/839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state.
* Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus.
* `CapabilitiesDelegateTest` now works on Android.
* [Issue 950](https://github.com/alexa/avs-device-sdk/issues/950) - Improved Android Media Player audio quality.
* [Issue 908](https://github.com/alexa/avs-device-sdk/issues/908) - Fixed compile error on g++ 7.x in which includes were missing.
2018-10-24 17:01:29 +00:00
|
|
|
|
|
|
|
play();
|
|
|
|
ASSERT_TRUE(gotTenReports.waitFor(FAIL_TIMEOUT));
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that with both a valid delay and interval, both types of notifications are generated.
|
|
|
|
TEST_F(ProgressTimerTest, testDelayAndInterval) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
int reportCounter = 0;
|
|
|
|
PromiseFuturePair<void> gotTenReports;
|
|
|
|
auto notifyOnTenReports = [&reportCounter, &gotTenReports]() {
|
|
|
|
if (10 == ++reportCounter) {
|
|
|
|
gotTenReports.setValue();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
|
|
|
|
{
|
|
|
|
InSequence sequence;
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed())
|
|
|
|
.Times(2)
|
|
|
|
.WillRepeatedly(Invoke(notifyOnTenReports))
|
|
|
|
.RetiresOnSaturation();
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(1);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed())
|
|
|
|
.WillRepeatedly(Invoke(notifyOnTenReports));
|
|
|
|
}
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, MILLIS_25, MILLIS_10);
|
|
|
|
|
|
|
|
play();
|
|
|
|
ASSERT_TRUE(gotTenReports.waitFor(FAIL_TIMEOUT));
|
|
|
|
|
|
|
|
stop();
|
|
|
|
|
|
|
|
// Also verify that notifications are not generated after stop.
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(0);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(0);
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that when paused, a ProgressTimer will not generate notifications.
|
|
|
|
TEST_F(ProgressTimerTest, testPause) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
std::mutex counterMutex;
|
|
|
|
std::condition_variable wake;
|
|
|
|
int reportCounter = 0;
|
|
|
|
|
|
|
|
auto notifyOnTenReports = [&counterMutex, &wake, &reportCounter]() {
|
|
|
|
std::lock_guard<std::mutex> lock(counterMutex);
|
|
|
|
if (10 == ++reportCounter) {
|
|
|
|
wake.notify_all();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
auto wakeOnTenReports = [&counterMutex, &wake, &reportCounter] {
|
|
|
|
std::unique_lock<std::mutex> lock(counterMutex);
|
|
|
|
ASSERT_TRUE(wake.wait_for(lock, FAIL_TIMEOUT, [&reportCounter] { return reportCounter >= 10; }));
|
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(1).RetiresOnSaturation();
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).WillRepeatedly(Invoke(notifyOnTenReports));
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, MILLIS_10, MILLIS_10);
|
|
|
|
|
|
|
|
play();
|
|
|
|
wakeOnTenReports();
|
|
|
|
|
|
|
|
// Loop to verify that ProgressTimer can handle multiple pauses.
|
|
|
|
for (int ix = 0; ix < 2; ix++) {
|
|
|
|
pause();
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(0);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(0);
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
|
|
|
|
reportCounter = 0;
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed())
|
|
|
|
.WillRepeatedly(Invoke(notifyOnTenReports));
|
|
|
|
resume();
|
|
|
|
wakeOnTenReports();
|
|
|
|
}
|
|
|
|
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
Version 1.12.1 alexa-client-sdk
Changes in this update:
**Bug Fixes**
* Fixed a bug where the same URL was being requested twice when streaming iHeartRadio. Now, a single request is sent.
* Corrected pause/resume handling in `ProgressTimer` so that extra `ProgressReportDelayElapsed` events are not sent to AVS.
**Known Issues**
* Music playback history isn't being displayed in the Alexa app for certain account and device types.
* On GCC 8+, issues related to `-Wclass-memaccess` will trigger warnings. However, this won't cause the build to fail and these warnings can be ignored.
* Android error ("libDefaultClient.so" not found) can be resolved by upgrading to ADB version 1.0.40
* When network connection is lost, lost connection status is not returned via local TTS.
* `ACL` may encounter issues if audio attachments are received but not consumed.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* The Alexa app doesn't always indicate when a device is successfully connected via Bluetooth.
* Connecting a product to streaming media via Bluetooth will sometimes stop media playback within the source application. Resuming playback through the source application or toggling next/previous will correct playback.
* When a source device is streaming silence via Bluetooth, the Alexa app indicates that audio content is streaming.
* The Bluetooth agent assumes that the Bluetooth adapter is always connected to a power source. Disconnecting from a power source during operation is not yet supported.
* On some products, interrupted Bluetooth playback may not resume if other content is locally streamed.
* `make integration` is currently not available for Android. In order to run integration tests on Android, you'll need to manually upload the test binary file along with any input file. At that point, the adb can be used to run the integration tests.
* On Raspberry Pi running Android Things with HDMI output audio, beginning of speech is truncated when Alexa responds to user text-to-speech (TTS).
* When the sample app is restarted and the network connection is lost, the Reminder TTS message does not play. Instead, the default alarm tone will play twice.
2019-04-03 00:25:10 +00:00
|
|
|
// Verify that when resumed, a ProgressTimer will not repeat delay progress reports.
|
|
|
|
TEST_F(ProgressTimerTest, testResumeDoesNotRepeat) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(1);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(0);
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, MILLIS_10, ProgressTimer::NO_INTERVAL);
|
|
|
|
|
|
|
|
play();
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
pause();
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
resume();
|
|
|
|
std::this_thread::sleep_for(MILLIS_100);
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
Version 1.10 alexa-client-sdk
Changes in this update:
**Enhancements**
* New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes.
* Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES.
* New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144).
* A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA.
* Added Bluetooth A2DP source and AVRCP target support for Linux.
* Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`.
* Added locale support for IT and ES.
* The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command.
* Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes.
* `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic.
**Bug Fixes**
* Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS.
* [Issue 973](https://github.com/alexa/avs-device-sdk/issues/973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets.
* An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices.
* [Issue 948](https://github.com/alexa/avs-device-sdk/issues/948) - Fixed a bug in which the sample app was stuck in a listening state.
* Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert.
* [Issue 839](https://github.com/alexa/avs-device-sdk/issues/839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state.
* Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus.
* `CapabilitiesDelegateTest` now works on Android.
* [Issue 950](https://github.com/alexa/avs-device-sdk/issues/950) - Improved Android Media Player audio quality.
* [Issue 908](https://github.com/alexa/avs-device-sdk/issues/908) - Fixed compile error on g++ 7.x in which includes were missing.
2018-10-24 17:01:29 +00:00
|
|
|
// Verify that the generated offsets are approximately correct.
|
|
|
|
TEST_F(ProgressTimerTest, testOffsets) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
auto verifyDelayOffset = [this]() { verifyOffset(OFFSET_TEST_DELAY, m_stopwatch.getElapsed()); };
|
|
|
|
|
|
|
|
int reportCounter = 0;
|
|
|
|
PromiseFuturePair<void> gotTenReports;
|
|
|
|
auto notifyOnTenReports = [this, &reportCounter, &gotTenReports]() {
|
|
|
|
++reportCounter;
|
|
|
|
verifyOffset(reportCounter * OFFSET_TEST_INTERVAL, m_stopwatch.getElapsed());
|
|
|
|
if (3 == reportCounter) {
|
|
|
|
gotTenReports.setValue();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(1).WillOnce(Invoke(verifyDelayOffset));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).WillRepeatedly(Invoke(notifyOnTenReports));
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, OFFSET_TEST_DELAY, OFFSET_TEST_INTERVAL);
|
|
|
|
|
|
|
|
play();
|
|
|
|
ASSERT_TRUE(gotTenReports.waitFor(FAIL_TIMEOUT));
|
|
|
|
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify that when delay and interval coincide, both types of notifications are generated.
|
|
|
|
TEST_F(ProgressTimerTest, testDelayAndIntervalCoincide) {
|
|
|
|
auto requestProgress = [this] { callOnProgress(); };
|
|
|
|
|
|
|
|
PromiseFuturePair<void> gotReport;
|
|
|
|
auto notifyGotReport = [&gotReport]() { gotReport.setValue(); };
|
|
|
|
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), requestProgress()).WillRepeatedly(Invoke(requestProgress));
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportDelayElapsed()).Times(1);
|
|
|
|
EXPECT_CALL(*(m_mockContext.get()), onProgressReportIntervalElapsed()).Times(1).WillOnce(Invoke(notifyGotReport));
|
|
|
|
|
|
|
|
m_timer.init(m_mockContext, MILLIS_100, MILLIS_100);
|
|
|
|
|
|
|
|
play();
|
|
|
|
ASSERT_TRUE(gotReport.waitFor(FAIL_TIMEOUT));
|
|
|
|
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
} // namespace audioPlayer
|
|
|
|
} // namespace capabilityAgents
|
|
|
|
} // namespace alexaClientSDK
|