16 #ifndef ACSDKALERTS_RENDERER_RENDERER_H_ 17 #define ACSDKALERTS_RENDERER_RENDERER_H_ 36 #include <condition_variable> 43 namespace acsdkAlerts {
58 ,
public std::enable_shared_from_this<Renderer> {
71 const std::shared_ptr<acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface>&
73 const std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>&
metricRecorder,
74 const std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface>& shutdownNotifier,
75 const std::shared_ptr<avsCommon::sdkInterfaces::InternetConnectionMonitorInterface>& internetConnectionMonitor);
86 static std::shared_ptr<Renderer>
create(
87 std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> mediaPlayer,
88 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> metricRecorder =
nullptr,
89 std::shared_ptr<avsCommon::sdkInterfaces::InternetConnectionMonitorInterface> internetConnectionMonitor =
93 std::shared_ptr<RendererObserverInterface> observer,
95 bool volumeRampEnabled,
96 const std::vector<std::string>& urls = std::vector<std::string>(),
98 std::chrono::milliseconds loopPause = std::chrono::milliseconds{0},
99 bool startWithPause =
false)
override;
101 void stop()
override;
130 std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> mediaPlayer,
131 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> metricRecorder,
132 std::shared_ptr<avsCommon::sdkInterfaces::InternetConnectionMonitorInterface> internetConnectionMonitor);
160 std::shared_ptr<RendererObserverInterface> observer,
162 bool volumeRampEnabled,
163 const std::vector<std::string>& urls,
165 std::chrono::milliseconds loopPause,
166 bool startWithPause);
178 void executeOnPlaybackStarted(
SourceId sourceId);
185 void executeOnPlaybackStopped(
SourceId sourceId);
192 void executeOnPlaybackFinished(
SourceId sourceId);
200 void executeOnPlaybackError(
217 void resetSourceId();
224 bool shouldPlayDefault();
231 bool shouldMediaPlayerRepeat();
238 bool shouldRenderNext();
252 bool isLastSourceInLoop();
268 bool pause(std::chrono::milliseconds duration);
293 bool renderNextAudioAsset(
bool* pauseInterruptedOut =
nullptr);
301 void handlePlaybackError(
const std::string& error);
307 void doShutdown()
override;
319 std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_mediaPlayer;
322 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> m_metricRecorder;
325 std::shared_ptr<RendererObserverInterface> m_observer;
329 std::vector<std::string> m_urls;
332 int m_numberOfStreamsRenderedThisLoop;
335 int m_remainingLoopCount;
338 int m_directiveLoopCount;
341 std::chrono::milliseconds m_loopPause;
344 bool m_shouldPauseBeforeRender;
347 std::chrono::time_point<std::chrono::steady_clock> m_loopStartTime;
358 bool m_isStartPending;
361 std::condition_variable m_waitCondition;
364 std::mutex m_waitMutex;
370 bool m_volumeRampEnabled;
383 std::chrono::steady_clock::time_point m_renderStartTime;
386 std::atomic_bool m_isNetworkConnected;
389 std::shared_ptr<avsCommon::sdkInterfaces::InternetConnectionMonitorInterface> m_internetConnectionMonitor;
396 #endif // ACSDKALERTS_RENDERER_RENDERER_H_
static const constexpr char * ALERTS_MEDIA_PLAYER_NAME
String to identify the alerts media player to render audio.
Definition: Renderer.h:46
void onPlaybackError(SourceId sourceId, const avsCommon::utils::mediaPlayer::ErrorType &type, std::string error, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
void onFirstByteRead(SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
static std::shared_ptr< Renderer > create(std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > mediaPlayer, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr, std::shared_ptr< avsCommon::sdkInterfaces::InternetConnectionMonitorInterface > internetConnectionMonitor=nullptr)
::std::string string
Definition: gtest-port.h:1097
Single-thread executor implementation.
Definition: Executor.h:45
Definition: RendererInterface.h:36
Definition: RequiresShutdown.h:32
MediaType
Definition: MediaType.h:29
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
Definition: Renderer.h:53
void onPlaybackFinished(SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
static std::shared_ptr< Renderer > createAlertRenderer(const std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > &audioPipelineFactory, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const std::shared_ptr< avsCommon::sdkInterfaces::InternetConnectionMonitorInterface > &internetConnectionMonitor)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void start(std::shared_ptr< RendererObserverInterface > observer, std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, bool volumeRampEnabled, const std::vector< std::string > &urls=std::vector< std::string >(), int loopCount=0, std::chrono::milliseconds loopPause=std::chrono::milliseconds{0}, bool startWithPause=false) override
void onConnectionStatusChanged(bool connected) override
type
Definition: upload.py:443
void onPlaybackStarted(SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
Definition: InternetConnectionObserverInterface.h:26
void onPlaybackStopped(SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
State
Definition: RendererObserverInterface.h:33
tuple message
Definition: gtest_output_test.py:331