diff options
Diffstat (limited to 'src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h')
-rw-r--r-- | src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h | 118 |
1 files changed, 60 insertions, 58 deletions
diff --git a/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h b/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h index cb1c144706..b956f2c9e2 100644 --- a/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h +++ b/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h @@ -39,13 +39,16 @@ #include "utils/conditional_variable.h" #include "utils/lock.h" - namespace NsSmartDeviceLink { namespace NsSmartObjects { class SmartObject; } } +namespace application_manager { +class ApplicationManager; +} + namespace media_manager { typedef enum { @@ -62,68 +65,67 @@ typedef enum { ACQ_16_BIT = 1 } AudioCaptureQuality; -typedef enum { - AT_INVALID = -1, - AT_PCM = 0 -} AudioType; +typedef enum { AT_INVALID = -1, AT_PCM = 0 } AudioType; /* - * @brief AudioStreamSenderThread class used to read binary data written from microphone + * @brief AudioStreamSenderThread class used to read binary data written from + * microphone * and send it every 1 second to mobile device. */ class AudioStreamSenderThread : public threads::ThreadDelegate { - public: - /* - * @brief AudioStreamSenderThread class constructor - * - * @param session_key Session key of connection for Mobile side - * @param correlation_id Correlation id for response for Mobile side - */ - AudioStreamSenderThread(const std::string fileName, - uint32_t session_key); - - /* - * @brief AudioStreamSenderThread class destructor - */ - ~AudioStreamSenderThread(); - - /** - * @brief Thread procedure. - */ - void threadMain(); - - /* - * @brief Retrieve session key - * - * @return Stored session key - */ - uint32_t session_key() const; - - void exitThreadMain(); - - private: - /* - * @brief Sends AudioPassThru request - */ - bool SendEndAudioPassThru(); - - void sendAudioChunkToMobile(); - - - bool getShouldBeStopped(); - void setShouldBeStopped(bool should_stop); - - uint32_t session_key_; - const std::string fileName_; - int32_t offset_; - volatile bool shouldBeStoped_; - sync_primitives::Lock shouldBeStoped_lock_; - sync_primitives::ConditionalVariable shouldBeStoped_cv_; - - static const int32_t kAudioPassThruTimeout; - - - DISALLOW_COPY_AND_ASSIGN(AudioStreamSenderThread); + public: + /* + * @brief AudioStreamSenderThread class constructor + * + * @param session_key Session key of connection for Mobile side + * @param correlation_id Correlation id for response for Mobile side + */ + AudioStreamSenderThread(const std::string& fileName, + uint32_t session_key, + application_manager::ApplicationManager& app_mngr); + + /* + * @brief AudioStreamSenderThread class destructor + */ + ~AudioStreamSenderThread(); + + /** + * @brief Thread procedure. + */ + void threadMain(); + + /* + * @brief Retrieve session key + * + * @return Stored session key + */ + uint32_t session_key() const; + + void exitThreadMain(); + + private: + /* + * @brief Sends AudioPassThru request + */ + bool SendEndAudioPassThru(); + + void sendAudioChunkToMobile(); + + bool getShouldBeStopped(); + void setShouldBeStopped(bool should_stop); + + uint32_t session_key_; + const std::string fileName_; + int32_t offset_; + volatile bool shouldBeStoped_; + sync_primitives::Lock shouldBeStoped_lock_; + sync_primitives::ConditionalVariable shouldBeStoped_cv_; + + static const int32_t kAudioPassThruTimeout; + + application_manager::ApplicationManager& application_manager_; + + DISALLOW_COPY_AND_ASSIGN(AudioStreamSenderThread); }; } // namespace media_manager |