diff options
author | Andreas Huber <andih@google.com> | 2013-03-05 10:56:27 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2013-03-05 13:07:19 -0800 |
commit | a556c4822fc205db0d27834ba5b637c351d73ffa (patch) | |
tree | 814471eaca96e0c8e7237563ff3f303171ba8546 /media/libstagefright/wifi-display/rtp/RTPSender.h | |
parent | d573622dc001c23223cb26b1f55fb75be189e77d (diff) | |
download | frameworks_av-a556c4822fc205db0d27834ba5b637c351d73ffa.zip frameworks_av-a556c4822fc205db0d27834ba5b637c351d73ffa.tar.gz frameworks_av-a556c4822fc205db0d27834ba5b637c351d73ffa.tar.bz2 |
Squashed commit of the following:
commit e5919b1f57ea61fa1d380dfdb4e3e832ce73d79d
Author: Andreas Huber <andih@google.com>
Date: Wed Feb 27 16:38:48 2013 -0800
Configure TCP datagram sockets to be TCP_NODELAY.
Change-Id: Ia724a81e6e27dccd00ac84603e712d69ca77a0cd
commit 1b52b393183db8a6dc000a7c31baac544ccfc50c
Author: Andreas Huber <andih@google.com>
Date: Wed Feb 27 14:26:01 2013 -0800
Send IDR frame requests on packet loss.
Change-Id: I53b7fb85cbd6923491113b93ec3e2175726d654a
commit 68d76b4b3a0181b30abc57cd2915273210530a6d
Author: Andreas Huber <andih@google.com>
Date: Tue Feb 26 15:12:34 2013 -0800
Revive TunnelRenderer
Change-Id: I8c5a9d982793b1c5b841c828227b354f1dab618c
commit 3df28a8e9d8bcdc1430016bb088d097eca653b56
Author: Andreas Huber <andih@google.com>
Date: Tue Feb 26 13:53:14 2013 -0800
Disable suspension of video updates.
Change-Id: I7e3a16b8d7dd7a55d9f962a2236388931f664106
commit 2ec7a79de019a26ec415016c1478afd762f069cd
Author: Andreas Huber <andih@google.com>
Date: Tue Feb 26 08:54:40 2013 -0800
Adds an SNTP client to wfd.
Change-Id: Icd7d6104e951e1443e4c1b81ccf6b3731d79d3ec
commit c81c3bb5725bb4079a4d7fb02151ad0bb540632f
Author: Andreas Huber <andih@google.com>
Date: Mon Feb 25 10:00:58 2013 -0800
Squashed commit of the following:
commit b83a4ec96659ef6f6b7c2090fdd866abe3ab78ba
Author: Andreas Huber <andih@google.com>
Date: Mon Feb 25 09:28:11 2013 -0800
Some reorganization of the rtp code, renamed StreamHub -> MediaSender
Change-Id: I8cf67444960e60426bf74880af1acce41e8b2fef
commit 7769cbd739f2a67c58e0c6a7b1a21a12210c7c4d
Author: Andreas Huber <andih@google.com>
Date: Fri Feb 22 16:12:18 2013 -0800
Choose a smaller MTU to avoid fragmented IPv4 packets, fix AVC assembler.
Change-Id: I274b3cc1483c4e9f4d146dbf9f3d9f7557ef7ef9
commit 1f687ee80a88b56d614c2cf408ff729114ff86a0
Author: Andreas Huber <andih@google.com>
Date: Fri Feb 22 11:38:31 2013 -0800
better reporting.
Change-Id: I67f0bb51f106ea77f5cc75938b053c8e8e8f688e
commit 7950c1cd59213eb5f281fcde44a772ecffae473d
Author: Andreas Huber <andih@google.com>
Date: Fri Feb 22 09:07:41 2013 -0800
stuff
Change-Id: Ib99416366d3eec6e6ad69b4d791a8a9408410f3b
commit 33c09045b0f86fcaa4619cbd679b47a074f71231
Author: Andreas Huber <andih@google.com>
Date: Thu Feb 21 15:54:01 2013 -0800
Render frames according to their timestamps.
Change-Id: I8143a95cffe775799d6a4bb093558bd7abb1f063
commit d8b6daae2160bf1c016d7c6251256b46bb89db42
Author: Andreas Huber <andih@google.com>
Date: Thu Feb 21 15:01:27 2013 -0800
Better packet-lost logic.
Change-Id: I611eee5a42bd089638cf45b0e16f628ff2a955ab
commit 782c6b15717e2d062d96665a089d06c0577733d0
Author: Andreas Huber <andih@google.com>
Date: Wed Feb 20 15:06:47 2013 -0800
Add a dedicated looper for the MediaReceiver
Change-Id: I3b79cad367fb69c9a160a8d009af8c5f5142b98e
commit 4c7b8b10861674b773270103bcabd1a99486a691
Author: Andreas Huber <andih@google.com>
Date: Wed Feb 20 14:30:28 2013 -0800
Tweaks to RTPSender and RTPReceiver
Change-Id: Ib535552f289a26cfead6df8c63e4c63d3987d4e9
commit 39226b28177a816cda5c67b321745d396b18277d
Author: Andreas Huber <andih@google.com>
Date: Tue Feb 19 08:48:25 2013 -0800
Playing around with non muxed delivery
Change-Id: I845375f6938d04bc30502840c2ceb7688dc9b237
commit c16d21de75d8ecdbcd9abce14934afe484970061
Author: Andreas Huber <andih@google.com>
Date: Wed Feb 13 14:43:35 2013 -0800
A more solid base for RTP communication.
Change-Id: I52033eeb0feba0ff029d61553a821c82f2fa1c3f
Change-Id: I57e3bcfc1c59a012b15aaaa42ed81f09c34c26bb
Change-Id: I4b09db4a44d0eeded7a1658f6dc6c97d4b8be720
Diffstat (limited to 'media/libstagefright/wifi-display/rtp/RTPSender.h')
-rw-r--r-- | media/libstagefright/wifi-display/rtp/RTPSender.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.h b/media/libstagefright/wifi-display/rtp/RTPSender.h new file mode 100644 index 0000000..2b683a4 --- /dev/null +++ b/media/libstagefright/wifi-display/rtp/RTPSender.h @@ -0,0 +1,112 @@ +/* + * Copyright 2013, 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 RTP_SENDER_H_ + +#define RTP_SENDER_H_ + +#include "RTPBase.h" + +#include <media/stagefright/foundation/AHandler.h> + +namespace android { + +struct ABuffer; +struct ANetworkSession; + +// An object of this class facilitates sending of media data over an RTP +// channel. The channel is established over a UDP or TCP connection depending +// on which "TransportMode" was chosen. In addition different RTP packetization +// schemes are supported such as "Transport Stream Packets over RTP", +// or "AVC/H.264 encapsulation as specified in RFC 3984 (non-interleaved mode)" +struct RTPSender : public RTPBase, public AHandler { + enum { + kWhatInitDone, + kWhatError, + }; + RTPSender( + const sp<ANetworkSession> &netSession, + const sp<AMessage> ¬ify); + + status_t initAsync( + TransportMode mode, + const char *remoteHost, + int32_t remoteRTPPort, + int32_t remoteRTCPPort, + int32_t *outLocalRTPPort); + + status_t queueBuffer( + const sp<ABuffer> &buffer, + uint8_t packetType, + PacketizationMode mode); + +protected: + virtual ~RTPSender(); + virtual void onMessageReceived(const sp<AMessage> &msg); + +private: + enum { + kWhatRTPNotify, + kWhatRTCPNotify, + }; + + enum { + kMaxNumTSPacketsPerRTPPacket = (kMaxUDPPacketSize - 12) / 188, + kMaxHistorySize = 1024, + kSourceID = 0xdeadbeef, + }; + + sp<ANetworkSession> mNetSession; + sp<AMessage> mNotify; + TransportMode mMode; + int32_t mRTPSessionID; + int32_t mRTCPSessionID; + bool mRTPConnected; + bool mRTCPConnected; + + uint64_t mLastNTPTime; + uint32_t mLastRTPTime; + uint32_t mNumRTPSent; + uint32_t mNumRTPOctetsSent; + uint32_t mNumSRsSent; + + uint32_t mRTPSeqNo; + + List<sp<ABuffer> > mHistory; + size_t mHistorySize; + + static uint64_t GetNowNTP(); + + status_t queueTSPackets(const sp<ABuffer> &tsPackets, uint8_t packetType); + status_t queueAVCBuffer(const sp<ABuffer> &accessUnit, uint8_t packetType); + + status_t sendRTPPacket(const sp<ABuffer> &packet, bool storeInHistory); + + void onNetNotify(bool isRTP, const sp<AMessage> &msg); + + status_t onRTCPData(const sp<ABuffer> &data); + status_t parseReceiverReport(const uint8_t *data, size_t size); + status_t parseTSFB(const uint8_t *data, size_t size); + + void notifyInitDone(status_t err); + void notifyError(status_t err); + + DISALLOW_EVIL_CONSTRUCTORS(RTPSender); +}; + +} // namespace android + +#endif // RTP_SENDER_H_ |