Modified MediaDirection to provide more granular control over RTP and RTCP flow.

Bug: 270657968
Test: Build
Change-Id: Ic0a75dce6aaf7f9a25216d01243c69bbb44f1407
This commit is contained in:
Avinash Malipatil 2023-02-24 10:06:07 +00:00
parent 4da12781df
commit cc072f6859
10 changed files with 97 additions and 73 deletions

View file

@ -34,13 +34,13 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum AmrMode {
AMR_MODE_0 = (1 << 0),
AMR_MODE_1 = (1 << 1),
AMR_MODE_2 = (1 << 2),
AMR_MODE_3 = (1 << 3),
AMR_MODE_4 = (1 << 4),
AMR_MODE_5 = (1 << 5),
AMR_MODE_6 = (1 << 6),
AMR_MODE_7 = (1 << 7),
AMR_MODE_8 = (1 << 8),
AMR_MODE_0 = (1 << 0) /* 1 */,
AMR_MODE_1 = (1 << 1) /* 2 */,
AMR_MODE_2 = (1 << 2) /* 4 */,
AMR_MODE_3 = (1 << 3) /* 8 */,
AMR_MODE_4 = (1 << 4) /* 16 */,
AMR_MODE_5 = (1 << 5) /* 32 */,
AMR_MODE_6 = (1 << 6) /* 64 */,
AMR_MODE_7 = (1 << 7) /* 128 */,
AMR_MODE_8 = (1 << 8) /* 256 */,
}

View file

@ -34,9 +34,9 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum CodecType {
AMR = (1 << 0),
AMR_WB = (1 << 1),
EVS = (1 << 2),
PCMA = (1 << 3),
PCMU = (1 << 4),
AMR = (1 << 0) /* 1 */,
AMR_WB = (1 << 1) /* 2 */,
EVS = (1 << 2) /* 4 */,
PCMA = (1 << 3) /* 8 */,
PCMU = (1 << 4) /* 16 */,
}

View file

@ -35,8 +35,8 @@ package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum EvsBandwidth {
NONE = 0,
NARROW_BAND = (1 << 0),
WIDE_BAND = (1 << 1),
SUPER_WIDE_BAND = (1 << 2),
FULL_BAND = (1 << 3),
NARROW_BAND = (1 << 0) /* 1 */,
WIDE_BAND = (1 << 1) /* 2 */,
SUPER_WIDE_BAND = (1 << 2) /* 4 */,
FULL_BAND = (1 << 3) /* 8 */,
}

View file

@ -34,25 +34,25 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum EvsMode {
EVS_MODE_0 = (1 << 0),
EVS_MODE_1 = (1 << 1),
EVS_MODE_2 = (1 << 2),
EVS_MODE_3 = (1 << 3),
EVS_MODE_4 = (1 << 4),
EVS_MODE_5 = (1 << 5),
EVS_MODE_6 = (1 << 6),
EVS_MODE_7 = (1 << 7),
EVS_MODE_8 = (1 << 8),
EVS_MODE_9 = (1 << 9),
EVS_MODE_10 = (1 << 10),
EVS_MODE_11 = (1 << 11),
EVS_MODE_12 = (1 << 12),
EVS_MODE_13 = (1 << 13),
EVS_MODE_14 = (1 << 14),
EVS_MODE_15 = (1 << 15),
EVS_MODE_16 = (1 << 16),
EVS_MODE_17 = (1 << 17),
EVS_MODE_18 = (1 << 18),
EVS_MODE_19 = (1 << 19),
EVS_MODE_20 = (1 << 20),
EVS_MODE_0 = (1 << 0) /* 1 */,
EVS_MODE_1 = (1 << 1) /* 2 */,
EVS_MODE_2 = (1 << 2) /* 4 */,
EVS_MODE_3 = (1 << 3) /* 8 */,
EVS_MODE_4 = (1 << 4) /* 16 */,
EVS_MODE_5 = (1 << 5) /* 32 */,
EVS_MODE_6 = (1 << 6) /* 64 */,
EVS_MODE_7 = (1 << 7) /* 128 */,
EVS_MODE_8 = (1 << 8) /* 256 */,
EVS_MODE_9 = (1 << 9) /* 512 */,
EVS_MODE_10 = (1 << 10) /* 1024 */,
EVS_MODE_11 = (1 << 11) /* 2048 */,
EVS_MODE_12 = (1 << 12) /* 4096 */,
EVS_MODE_13 = (1 << 13) /* 8192 */,
EVS_MODE_14 = (1 << 14) /* 16384 */,
EVS_MODE_15 = (1 << 15) /* 32768 */,
EVS_MODE_16 = (1 << 16) /* 65536 */,
EVS_MODE_17 = (1 << 17) /* 131072 */,
EVS_MODE_18 = (1 << 18) /* 262144 */,
EVS_MODE_19 = (1 << 19) /* 524288 */,
EVS_MODE_20 = (1 << 20) /* 1048576 */,
}

View file

@ -35,8 +35,8 @@ package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum MediaDirection {
NO_FLOW = 0,
SEND_ONLY = 1,
RECEIVE_ONLY = 2,
SEND_RECEIVE = 3,
INACTIVE = 4,
RTP_TX = (1 << 0) /* 1 */,
RTP_RX = (1 << 1) /* 2 */,
RTCP_TX = (1 << 2) /* 4 */,
RTCP_RX = (1 << 3) /* 8 */,
}

View file

@ -35,11 +35,11 @@ package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum RtcpXrReportBlockType {
RTCPXR_NONE = 0,
RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0),
RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1),
RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2),
RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3),
RTCPXR_DLRR_REPORT_BLOCK = (1 << 4),
RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5),
RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6),
RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0) /* 1 */,
RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1) /* 2 */,
RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2) /* 4 */,
RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3) /* 8 */,
RTCPXR_DLRR_REPORT_BLOCK = (1 << 4) /* 16 */,
RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5) /* 32 */,
RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6) /* 64 */,
}

View file

@ -34,7 +34,7 @@
package android.hardware.radio.ims.media;
@VintfStability
parcelable RtpConfig {
android.hardware.radio.ims.media.MediaDirection direction;
int direction;
android.hardware.radio.AccessNetwork accessNetwork;
android.hardware.radio.ims.media.RtpAddress remoteAddress;
android.hardware.radio.ims.media.RtpSessionParams sessionParams;

View file

@ -16,6 +16,17 @@
package android.hardware.radio.ims.media;
/**
* Directions can be combined to meet various media direction
* requirements depending on the scenario.
*
* Examples:
* No Flow : NO_FLOW - eg. SRVCC.
* RTCP-only : RTCP_TX | RTCP_RX - eg. Local Hold or Dual Hold.
* Receive-Only : RTP_RX | RTCP_TX | RTCP_RX - eg. Remote Hold.
* Send-Receive : RTP_TX | RTP_RX | RTCP_TX | RTCP_RX - eg. Active call.
* Send-Only : RTP_TX | RTCP_TX | RTCP_RX - eg. Simplex call, voice mail, etc
*/
@VintfStability
@Backing(type="int")
enum MediaDirection {
@ -24,12 +35,16 @@ enum MediaDirection {
* may release the audio resource. Eg. SRVCC.
*/
NO_FLOW = 0,
/** Device sends outgoing RTP and drops incoming RTP */
SEND_ONLY = 1,
/** Device receives the downlink RTP and does not transmit any uplink RTP */
RECEIVE_ONLY = 2,
/** Device sends and receive RTP in both directions */
SEND_RECEIVE = 3,
/** No RTP flow however RTCP continues to flow. Eg. HOLD */
INACTIVE = 4,
/** Send RTP packets */
RTP_TX = 1 << 0,
/** Receive and processes RTP packets */
RTP_RX = 1 << 1,
/** Send RTCP packets */
RTCP_TX = 1 << 2,
/** Receive RTCP packets */
RTCP_RX = 1 << 3,
}

View file

@ -18,15 +18,14 @@ package android.hardware.radio.ims.media;
import android.hardware.radio.AccessNetwork;
import android.hardware.radio.ims.media.AnbrMode;
import android.hardware.radio.ims.media.MediaDirection;
import android.hardware.radio.ims.media.RtcpConfig;
import android.hardware.radio.ims.media.RtpAddress;
import android.hardware.radio.ims.media.RtpSessionParams;
@VintfStability
parcelable RtpConfig {
/** Media flow direction */
MediaDirection direction;
/** Media flow direction. The bitfield of MediaDirection(s) */
int direction;
/** Radio Access Network */
AccessNetwork accessNetwork;
/** IP address and port number of the other party for RTP media */

View file

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <aidl/android/hardware/radio/ims/media/MediaDirection.h>
#include <android-base/logging.h>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
@ -44,8 +45,10 @@ TEST_P(RadioImsMediaTest, MOCallSuccess) {
int32_t sessionId = 1;
RtpConfig modifyRtpConfig;
modifyRtpConfig.direction =
::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
static_cast<int32_t>(MediaDirection::RTP_RX) |
static_cast<int32_t>(MediaDirection::RTCP_TX) |
static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@ -90,8 +93,10 @@ TEST_P(RadioImsMediaTest, testDtmfOperation) {
int32_t duration = 200;
RtpConfig modifyRtpConfig;
modifyRtpConfig.direction =
::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
static_cast<int32_t>(MediaDirection::RTP_RX) |
static_cast<int32_t>(MediaDirection::RTCP_TX) |
static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@ -143,8 +148,10 @@ TEST_P(RadioImsMediaTest, sendHeaderExtension) {
std::vector<RtpHeaderExtension> extensions;
RtpConfig modifyRtpConfig;
modifyRtpConfig.direction =
::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
static_cast<int32_t>(MediaDirection::RTP_RX) |
static_cast<int32_t>(MediaDirection::RTCP_TX) |
static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@ -190,8 +197,10 @@ TEST_P(RadioImsMediaTest, setMediaQualityThreshold) {
MediaQualityThreshold threshold;
RtpConfig modifyRtpConfig;
modifyRtpConfig.direction =
::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
static_cast<int32_t>(MediaDirection::RTP_RX) |
static_cast<int32_t>(MediaDirection::RTCP_TX) |
static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@ -243,13 +252,14 @@ ndk::ScopedAStatus RadioImsMediaTest::triggerOpenSession(int32_t sessionId) {
localEndPoint.rtcpFd = ndk::ScopedFileDescriptor(mRtcpSocketFd);
localEndPoint.modemId = 1;
rtpConfig.direction =
::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
rtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
static_cast<int32_t>(MediaDirection::RTP_RX) |
static_cast<int32_t>(MediaDirection::RTCP_TX) |
static_cast<int32_t>(MediaDirection::RTCP_RX);
rtpConfig.remoteAddress.ipAddress = "122.22.22.22";
rtpConfig.remoteAddress.portNumber = 2222;
result = radio_imsmedia->openSession(sessionId, localEndPoint, rtpConfig);
return result;
}