diff options
author | Rakesh Raghava <rakeshraghava@google.com> | 2022-11-15 18:30:58 +0000 |
---|---|---|
committer | Rakesh Raghava <rakeshraghava@google.com> | 2022-11-15 18:33:35 +0000 |
commit | f5f331a8c78fe2223de7885e7a9fda71eb1e7787 (patch) | |
tree | c600305cf96658602ee73482cc6165fab759a1c0 /service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioSession.h | |
parent | 5c60b21cc38bfac7887f51588e2323d686e84efb (diff) | |
download | ImsMedia-f5f331a8c78fe2223de7885e7a9fda71eb1e7787.tar.gz |
ImsMedia update to support presubmit
- core, config, protocol submodule static libs are created
- libimsmedia shared lib accesses these static libs
- ImsMediaNativeTests accesses these static libs
- Folder structure updated accordingly
Bug: 258455118
Test: Verified MO and MT calls and atest ImsMediaNativeTests
Change-Id: I06e98c7d3dded536ec8a78fc332f9213f4279269
Diffstat (limited to 'service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioSession.h')
-rw-r--r-- | service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioSession.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioSession.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioSession.h new file mode 100644 index 00000000..f67215bc --- /dev/null +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioSession.h @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AUDIO_SESSION_H +#define AUDIO_SESSION_H + +#include <ImsMediaDefine.h> +#include <BaseSession.h> +#include <AudioStreamGraphRtpTx.h> +#include <AudioStreamGraphRtpRx.h> +#include <AudioStreamGraphRtcp.h> +#include <RtpConfig.h> +#include <MediaQualityAnalyzer.h> +#include <list> + +class AudioSession : public BaseSession +{ +public: + AudioSession(); + virtual ~AudioSession(); + virtual SessionState getState(); + virtual void onEvent(int32_t type, uint64_t param1, uint64_t param2); + virtual void setMediaQualityThreshold(const MediaQualityThreshold& threshold); + virtual ImsMediaResult startGraph(RtpConfig* config); + + /** + * @brief Add and start stream graph instance of the session. It has to be called only to + * create new StreamGraph should be added with different RtpConfig as a argument. + * + * @param config The parameters to operate nodes in the StreamGraph. + * @param enableRtcp {@code true} when the rtcp needs to be enabled to the rest of the graphs + * @return ImsMediaResult result of create or start graph. If the result has no error, it + * returns RESULT_SUCCESS. check #ImsMediaDefine.h. + */ + ImsMediaResult addGraph(RtpConfig* config, bool enableRtcp); + + /** + * @brief Determine to remain only one StreamGraph instance and remove other StreamGraph. + * If the target StreamGraph is not in RUN state, call start instance to change to + * RUN state. when the call session is converted to confirmed session. It has to be + * called with proper RtpConfig argument that can choose the StreamGraph with the + * config. If there is no matched StreamGraph with same RtpConfig, it returns failure + * of RESULT_INVALID_PARAM. + * + * @param config The parameters to operate nodes in the StreamGraph. + * @return ImsMediaResult result of create or start graph. If the result has no error, it + * returns RESULT_SUCCESS. check #ImsMediaDefine.h. + */ + ImsMediaResult confirmGraph(RtpConfig* config); + + /** + * @brief Delete a StreamGraph which has a matched RtpConfig argument. + * + * @param config A parameter to find the matching StreamGraph instance. + * @return ImsMediaResult A result of deleting StreamGraph instance. If the result has + * no error, it returns RESULT_SUCCESS. check #ImsMediaDefine.h. + */ + ImsMediaResult deleteGraph(RtpConfig* config); + + /** + * @brief Send Dtmf digit to the network + * + * @param digit A digit character + * @param duration The duration of millisecond unit indicate how long to send the digit as a rtp + * event packet + */ + void sendDtmf(char digit, int duration); + + /** + * @brief Send internal event to process in the stream graph + * + * @param type The type of internal event defined in ImsMediaDefine.h + * @param param1 The additional parameter to set + * @param param2 The additional parameter to set + */ + void SendInternalEvent(int32_t type, uint64_t param1, uint64_t param2); + + /** + * @brief Check whether the graph has the same remote address or not + * + * @param config The RtpConfig to check the remote address + */ + bool IsGraphAlreadyExist(RtpConfig* config); + +private: + void onCollectInfo(ImsMediaStreamType streamType, RtpPacket* packet); + void onCollectOptionalInfo(int32_t optionType, int32_t seq, int32_t value); + void onCollectRxRtpStatus(int32_t seq, kRtpPacketStatus status); + void onCollectJitterBufferSize(int32_t currSize, int32_t maxSize); + bool onGetRtcpXrReportBlock(uint32_t nReportBlocks, uint8_t* data, uint32_t& size); + + std::list<AudioStreamGraphRtpTx*> mListGraphRtpTx; + std::list<AudioStreamGraphRtpRx*> mListGraphRtpRx; + std::list<AudioStreamGraphRtcp*> mListGraphRtcp; + std::unique_ptr<MediaQualityAnalyzer> mMediaQualityAnalyzer; +}; + +#endif
\ No newline at end of file |