1 /** 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.telephony.imsmedia; 18 19 import android.annotation.IntDef; 20 import android.hardware.radio.ims.media.RtpError; 21 import android.os.IBinder; 22 23 import java.lang.annotation.Retention; 24 import java.lang.annotation.RetentionPolicy; 25 26 /** 27 * Implemented by classes that encapsulates RTP session eg. Audio, Video or RTT 28 * 29 * Use the instanceof keyword to determine the underlying type. 30 * 31 * @hide 32 */ 33 public interface ImsMediaSession { 34 int SESSION_TYPE_AUDIO = 0; 35 int SESSION_TYPE_VIDEO = 1; 36 int SESSION_TYPE_RTT = 2; 37 38 /** @hide */ 39 @IntDef(value = { 40 SESSION_TYPE_AUDIO, 41 SESSION_TYPE_VIDEO, 42 SESSION_TYPE_RTT, 43 }) 44 @Retention(RetentionPolicy.SOURCE) 45 public @interface SessionType { 46 } 47 48 @Retention(RetentionPolicy.SOURCE) 49 public @interface SessionState { 50 } 51 52 /** Real Time Protocol, see RFC 3550 */ 53 int PACKET_TYPE_RTP = 0; 54 /** Real Time Control Protocol, see RFC 3550 */ 55 int PACKET_TYPE_RTCP = 1; 56 57 /** @hide */ 58 @IntDef(value = { 59 PACKET_TYPE_RTP, 60 PACKET_TYPE_RTCP, 61 }) 62 @Retention(RetentionPolicy.SOURCE) 63 public @interface PacketType { 64 } 65 66 /** Result of a session operation is successful */ 67 int RESULT_SUCCESS = RtpError.NONE; 68 /** Failed because of invalid parameters passed in the request */ 69 int RESULT_INVALID_PARAM = RtpError.INVALID_PARAM; 70 /** The RTP stack is not ready to handle the request */ 71 int RESULT_NOT_READY = RtpError.NOT_READY; 72 /** Unable to handle the request due to memory allocation failure */ 73 int RESULT_NO_MEMORY = RtpError.NO_MEMORY; 74 /** 75 * Unable to handle the request due to no sufficient resources such as audio, codec 76 */ 77 int RESULT_NO_RESOURCES = RtpError.NO_RESOURCES; 78 /** The requested port number is not available */ 79 int RESULT_PORT_UNAVAILABLE = RtpError.PORT_UNAVAILABLE; 80 /** The request is not supported by the vendor implementation */ 81 int RESULT_NOT_SUPPORTED = RtpError.NOT_SUPPORTED; 82 83 /** @hide */ 84 @IntDef(value = { 85 RESULT_SUCCESS, 86 RESULT_INVALID_PARAM, 87 RESULT_NOT_READY, 88 RESULT_NO_MEMORY, 89 RESULT_NO_RESOURCES, 90 RESULT_PORT_UNAVAILABLE, 91 RESULT_NOT_SUPPORTED, 92 }) 93 @Retention(RetentionPolicy.SOURCE) 94 public @interface SessionOperationResult { 95 } 96 97 /** @hide */ getBinder()98 public IBinder getBinder(); 99 100 /** Returns the unique session identifier */ getSessionId()101 public int getSessionId(); 102 103 /** 104 * Modifies the configuration of the RTP session after the session is opened. It can be used to 105 * modify the direction, access network, codec parameters, {@link RtcpConfig}, remote address 106 * and remote port number. The service will apply if anything changed in this invocation 107 * compared to previous and respond the updated {@link RtpConfig} in 108 * {@link ImsMediaSession#onModifySessionResponse()} API. 109 * 110 * @param config provides remote end point info and codec details 111 */ modifySession(final RtpConfig config)112 void modifySession(final RtpConfig config); 113 114 /** 115 * Sets the media quality threshold parameters of the session to get 116 * media quality notifications. 117 * 118 * @param threshold media quality thresholds for various quality 119 * parameters 120 */ setMediaQualityThreshold(final MediaQualityThreshold threshold)121 void setMediaQualityThreshold(final MediaQualityThreshold threshold); 122 } 123