Loading media/libaah_rtp/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ LOCAL_SRC_FILES := \ aah_tx_group.cpp \ aah_tx_packet.cpp \ aah_tx_player.cpp \ pipe_event.cpp \ utils.cpp LOCAL_C_INCLUDES := \ Loading media/libaah_rtp/aah_rx_player.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #define LOG_TAG "LibAAH_RTP" //#define LOG_NDEBUG 0 #include <sys/eventfd.h> #include <binder/IServiceManager.h> #include <media/MediaPlayerInterface.h> #include <utils/Log.h> Loading Loading @@ -49,6 +51,7 @@ AAH_RXPlayer::AAH_RXPlayer() memset(&data_source_addr_, 0, sizeof(data_source_addr_)); memset(&transmitter_addr_, 0, sizeof(transmitter_addr_)); wakeup_work_thread_evt_fd_ = eventfd(0, EFD_NONBLOCK); fetchAudioFlinger(); } Loading @@ -57,6 +60,10 @@ AAH_RXPlayer::~AAH_RXPlayer() { reset_l(); CHECK(substreams_.size() == 0); omx_.disconnect(); if (wakeup_work_thread_evt_fd_ >= 0) { ::close(wakeup_work_thread_evt_fd_); } } status_t AAH_RXPlayer::initCheck() { Loading @@ -70,6 +77,11 @@ status_t AAH_RXPlayer::initCheck() { return NO_MEMORY; } if (wakeup_work_thread_evt_fd_ < 0) { LOGE("Failed to allocate wakeup eventfd"); return NO_MEMORY; } // Check for the presense of the common time service by attempting to query // for CommonTime's frequency. If we get an error back, we cannot talk to // the service at all and should abort now. Loading media/libaah_rtp/aah_rx_player.h +1 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ #include <utils/threads.h> #include "aah_decoder_pump.h" #include "pipe_event.h" #include "utils.h" namespace android { Loading Loading @@ -273,7 +272,7 @@ class AAH_RXPlayer : public MediaPlayerInterface { void sendUnicastGroupLeave(); void fetchAudioFlinger(); PipeEvent wakeup_work_thread_evt_; int wakeup_work_thread_evt_fd_; sp<ThreadWrapper> thread_wrapper_; Mutex api_lock_; bool is_playing_; Loading media/libaah_rtp/aah_rx_player_core.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ status_t AAH_RXPlayer::startWorkThread() { void AAH_RXPlayer::stopWorkThread() { thread_wrapper_->requestExit(); // set the exit pending flag wakeup_work_thread_evt_.setEvent(); signalEventFD(wakeup_work_thread_evt_fd_); status_t res; res = thread_wrapper_->requestExitAndWait(); // block until thread exit. Loading @@ -74,7 +74,7 @@ void AAH_RXPlayer::stopWorkThread() { LOGE("Failed to stop work thread (res = %d)", res); } wakeup_work_thread_evt_.clearPendingEvents(); clearEventFD(wakeup_work_thread_evt_fd_); } void AAH_RXPlayer::cleanupSocket() { Loading Loading @@ -292,7 +292,7 @@ bool AAH_RXPlayer::threadLoop() { if ((0 != timeout) && (!process_more_right_now)) { // Set up the events to wait on. Start with the wakeup pipe. memset(&poll_fds, 0, sizeof(poll_fds)); poll_fds[0].fd = wakeup_work_thread_evt_.getWakeupHandle(); poll_fds[0].fd = wakeup_work_thread_evt_fd_; poll_fds[0].events = POLLIN; // Add the RX socket. Loading @@ -313,7 +313,7 @@ bool AAH_RXPlayer::threadLoop() { break; } wakeup_work_thread_evt_.clearPendingEvents(); clearEventFD(wakeup_work_thread_evt_fd_); process_more_right_now = false; // Step 2: Do we have data waiting in the socket? If so, drain the Loading media/libaah_rtp/aah_tx_group.cpp +3 −16 Original line number Diff line number Diff line Loading @@ -955,20 +955,6 @@ bool AAH_TXGroup::CmdAndControlRXer::init() { return (mWakeupEventFD >= 0); } void AAH_TXGroup::CmdAndControlRXer::wakeupThread() { if (mWakeupEventFD >= 0) { uint64_t tmp = 1; ::write(mWakeupEventFD, &tmp, sizeof(tmp)); } } void AAH_TXGroup::CmdAndControlRXer::clearWakeupEvent() { if (mWakeupEventFD >= 0) { uint64_t tmp; ::read(mWakeupEventFD, &tmp, sizeof(tmp)); } } bool AAH_TXGroup::CmdAndControlRXer::threadLoop() { // Implementation for main command and control receiver thread. Its primary // job is to service command and control requests from clients. These Loading Loading @@ -1053,8 +1039,9 @@ bool AAH_TXGroup::CmdAndControlRXer::threadLoop() { } // clear the wakeup event if needed. if (pollFds[0].revents) clearWakeupEvent(); if (pollFds[0].revents) { clearEventFD(mWakeupEventFD); } // Handle any pending C&C requests and heartbeat timeouts. Also, trim the // retry buffers if its time to do so. Loading Loading
media/libaah_rtp/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ LOCAL_SRC_FILES := \ aah_tx_group.cpp \ aah_tx_packet.cpp \ aah_tx_player.cpp \ pipe_event.cpp \ utils.cpp LOCAL_C_INCLUDES := \ Loading
media/libaah_rtp/aah_rx_player.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #define LOG_TAG "LibAAH_RTP" //#define LOG_NDEBUG 0 #include <sys/eventfd.h> #include <binder/IServiceManager.h> #include <media/MediaPlayerInterface.h> #include <utils/Log.h> Loading Loading @@ -49,6 +51,7 @@ AAH_RXPlayer::AAH_RXPlayer() memset(&data_source_addr_, 0, sizeof(data_source_addr_)); memset(&transmitter_addr_, 0, sizeof(transmitter_addr_)); wakeup_work_thread_evt_fd_ = eventfd(0, EFD_NONBLOCK); fetchAudioFlinger(); } Loading @@ -57,6 +60,10 @@ AAH_RXPlayer::~AAH_RXPlayer() { reset_l(); CHECK(substreams_.size() == 0); omx_.disconnect(); if (wakeup_work_thread_evt_fd_ >= 0) { ::close(wakeup_work_thread_evt_fd_); } } status_t AAH_RXPlayer::initCheck() { Loading @@ -70,6 +77,11 @@ status_t AAH_RXPlayer::initCheck() { return NO_MEMORY; } if (wakeup_work_thread_evt_fd_ < 0) { LOGE("Failed to allocate wakeup eventfd"); return NO_MEMORY; } // Check for the presense of the common time service by attempting to query // for CommonTime's frequency. If we get an error back, we cannot talk to // the service at all and should abort now. Loading
media/libaah_rtp/aah_rx_player.h +1 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ #include <utils/threads.h> #include "aah_decoder_pump.h" #include "pipe_event.h" #include "utils.h" namespace android { Loading Loading @@ -273,7 +272,7 @@ class AAH_RXPlayer : public MediaPlayerInterface { void sendUnicastGroupLeave(); void fetchAudioFlinger(); PipeEvent wakeup_work_thread_evt_; int wakeup_work_thread_evt_fd_; sp<ThreadWrapper> thread_wrapper_; Mutex api_lock_; bool is_playing_; Loading
media/libaah_rtp/aah_rx_player_core.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ status_t AAH_RXPlayer::startWorkThread() { void AAH_RXPlayer::stopWorkThread() { thread_wrapper_->requestExit(); // set the exit pending flag wakeup_work_thread_evt_.setEvent(); signalEventFD(wakeup_work_thread_evt_fd_); status_t res; res = thread_wrapper_->requestExitAndWait(); // block until thread exit. Loading @@ -74,7 +74,7 @@ void AAH_RXPlayer::stopWorkThread() { LOGE("Failed to stop work thread (res = %d)", res); } wakeup_work_thread_evt_.clearPendingEvents(); clearEventFD(wakeup_work_thread_evt_fd_); } void AAH_RXPlayer::cleanupSocket() { Loading Loading @@ -292,7 +292,7 @@ bool AAH_RXPlayer::threadLoop() { if ((0 != timeout) && (!process_more_right_now)) { // Set up the events to wait on. Start with the wakeup pipe. memset(&poll_fds, 0, sizeof(poll_fds)); poll_fds[0].fd = wakeup_work_thread_evt_.getWakeupHandle(); poll_fds[0].fd = wakeup_work_thread_evt_fd_; poll_fds[0].events = POLLIN; // Add the RX socket. Loading @@ -313,7 +313,7 @@ bool AAH_RXPlayer::threadLoop() { break; } wakeup_work_thread_evt_.clearPendingEvents(); clearEventFD(wakeup_work_thread_evt_fd_); process_more_right_now = false; // Step 2: Do we have data waiting in the socket? If so, drain the Loading
media/libaah_rtp/aah_tx_group.cpp +3 −16 Original line number Diff line number Diff line Loading @@ -955,20 +955,6 @@ bool AAH_TXGroup::CmdAndControlRXer::init() { return (mWakeupEventFD >= 0); } void AAH_TXGroup::CmdAndControlRXer::wakeupThread() { if (mWakeupEventFD >= 0) { uint64_t tmp = 1; ::write(mWakeupEventFD, &tmp, sizeof(tmp)); } } void AAH_TXGroup::CmdAndControlRXer::clearWakeupEvent() { if (mWakeupEventFD >= 0) { uint64_t tmp; ::read(mWakeupEventFD, &tmp, sizeof(tmp)); } } bool AAH_TXGroup::CmdAndControlRXer::threadLoop() { // Implementation for main command and control receiver thread. Its primary // job is to service command and control requests from clients. These Loading Loading @@ -1053,8 +1039,9 @@ bool AAH_TXGroup::CmdAndControlRXer::threadLoop() { } // clear the wakeup event if needed. if (pollFds[0].revents) clearWakeupEvent(); if (pollFds[0].revents) { clearEventFD(mWakeupEventFD); } // Handle any pending C&C requests and heartbeat timeouts. Also, trim the // retry buffers if its time to do so. Loading