Skip to content

Commit 2921612

Browse files
committed
LibAAH_RTP: Add unicast mode support to the RXPlayer
Add support for unicast mode to the AAH RXPlayer. At the API level, things should be pretty simple. To use unicast mode, instead of passing the multicast address and port in the data source URL, just pass the unicast address and port of the transmitters command and control port. For example, instead of aahRX://224.128.60.5:8867 one might instead pass aahRX://192.168.63.5:55476 Change-Id: I7b40716983d7a91def86dcf40f093dda4255aae3 Signed-off-by: John Grossman <johngro@google.com>
1 parent 0693887 commit 2921612

File tree

8 files changed

+225
-110
lines changed

8 files changed

+225
-110
lines changed

media/libaah_rtp/aah_rx_player.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ AAH_RXPlayer::AAH_RXPlayer()
3939

4040
is_playing_ = false;
4141
multicast_joined_ = false;
42+
multicast_mode_ = false;
4243
transmitter_known_ = false;
4344
current_epoch_known_ = false;
4445
data_source_set_ = false;
4546
sock_fd_ = -1;
4647

4748
substreams_.setCapacity(4);
4849

49-
memset(&listen_addr_, 0, sizeof(listen_addr_));
50+
memset(&data_source_addr_, 0, sizeof(data_source_addr_));
5051
memset(&transmitter_addr_, 0, sizeof(transmitter_addr_));
5152

5253
fetchAudioFlinger();
@@ -112,10 +113,10 @@ status_t AAH_RXPlayer::setDataSource(
112113

113114
a = (a << 24) | (b << 16) | (c << 8) | d;
114115

115-
memset(&listen_addr_, 0, sizeof(listen_addr_));
116-
listen_addr_.sin_family = AF_INET;
117-
listen_addr_.sin_port = htons(port);
118-
listen_addr_.sin_addr.s_addr = htonl(a);
116+
memset(&data_source_addr_, 0, sizeof(data_source_addr_));
117+
data_source_addr_.sin_family = AF_INET;
118+
data_source_addr_.sin_port = htons(port);
119+
data_source_addr_.sin_addr.s_addr = htonl(a);
119120
data_source_set_ = true;
120121

121122
return OK;
@@ -202,9 +203,9 @@ void AAH_RXPlayer::reset_l() {
202203
CHECK(sock_fd_ < 0);
203204
CHECK(!multicast_joined_);
204205
is_playing_ = false;
205-
data_source_set_ = false;
206206
transmitter_known_ = false;
207-
memset(&listen_addr_, 0, sizeof(listen_addr_));
207+
memset(&data_source_addr_, 0, sizeof(data_source_addr_));
208+
data_source_set_ = false;
208209
}
209210

210211
status_t AAH_RXPlayer::setLooping(int loop) {

media/libaah_rtp/aah_rx_player.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,23 @@ class AAH_RXPlayer : public MediaPlayerInterface {
266266
void processRingBuffer();
267267
void processCommandPacket(PacketBuffer* pb);
268268
bool processGaps();
269+
bool processRetransmitNAK(const uint8_t* data, size_t amt);
269270
void setGapStatus(GapStatus status);
270271
void cleanoutExpiredSubstreams();
272+
void sendUnicastGroupJoin();
273+
void sendUnicastGroupLeave();
271274
void fetchAudioFlinger();
272275

273276
PipeEvent wakeup_work_thread_evt_;
274277
sp<ThreadWrapper> thread_wrapper_;
275278
Mutex api_lock_;
276279
bool is_playing_;
277-
bool data_source_set_;
278280

279-
struct sockaddr_in listen_addr_;
280-
int sock_fd_;
281+
struct sockaddr_in data_source_addr_;
282+
bool data_source_set_;
283+
bool multicast_mode_;
281284
bool multicast_joined_;
285+
int sock_fd_;
282286

283287
struct sockaddr_in transmitter_addr_;
284288
bool transmitter_known_;
@@ -291,6 +295,7 @@ class AAH_RXPlayer : public MediaPlayerInterface {
291295
Timeout next_retrans_req_timeout_;
292296

293297
Timeout ss_cleanout_timeout_;
298+
Timeout unicast_group_report_timeout_;
294299

295300
RXRingBuffer ring_buffer_;
296301
SubstreamVec substreams_;
@@ -301,13 +306,13 @@ class AAH_RXPlayer : public MediaPlayerInterface {
301306
sp<IAudioFlinger> audio_flinger_;
302307

303308
static const uint32_t kRTPRingBufferSize;
304-
static const uint32_t kRetransRequestMagic;
305-
static const uint32_t kFastStartRequestMagic;
306-
static const uint32_t kRetransNAKMagic;
309+
307310
static const uint32_t kGapRerequestTimeoutMsec;
308311
static const uint32_t kFastStartTimeoutMsec;
309312
static const uint32_t kRTPActivityTimeoutMsec;
310313
static const uint32_t kSSCleanoutTimeoutMsec;
314+
static const uint32_t kGrpMemberSlowReportIntervalMsec;
315+
static const uint32_t kGrpMemberFastReportIntervalMsec;
311316

312317
static const uint32_t INVOKE_GET_MASTER_VOLUME = 3;
313318
static const uint32_t INVOKE_SET_MASTER_VOLUME = 4;

0 commit comments

Comments
 (0)