2012-12-18 15:40:53 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_
|
|
|
|
|
#define MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_
|
2012-12-18 15:40:53 +00:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
|
|
|
|
#include "rtc_base/criticalsection.h"
|
2012-12-18 15:40:53 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-11-24 09:34:46 -08:00
|
|
|
struct CodecInst;
|
|
|
|
|
|
2012-12-18 15:40:53 +00:00
|
|
|
// This strategy deals with media-specific RTP packet processing.
|
|
|
|
|
// This class is not thread-safe and must be protected by its caller.
|
|
|
|
|
class RTPReceiverStrategy {
|
|
|
|
|
public:
|
2014-04-08 11:06:12 +00:00
|
|
|
static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback);
|
2016-03-30 02:42:32 -07:00
|
|
|
static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2018-02-07 09:38:31 +01:00
|
|
|
virtual ~RTPReceiverStrategy();
|
2012-12-18 15:40:53 +00:00
|
|
|
|
2013-01-14 10:01:55 +00:00
|
|
|
// Parses the RTP packet and calls the data callback with the payload data.
|
|
|
|
|
// Implementations are encouraged to use the provided packet buffer and RTP
|
|
|
|
|
// header as arguments to the callback; implementations are also allowed to
|
|
|
|
|
// make changes in the data as necessary. The specific_payload argument
|
2017-09-26 14:05:05 +02:00
|
|
|
// provides audio or video-specific data.
|
2013-08-15 23:38:54 +00:00
|
|
|
virtual int32_t ParseRtpPacket(WebRtcRTPHeader* rtp_header,
|
|
|
|
|
const PayloadUnion& specific_payload,
|
2013-09-06 13:40:11 +00:00
|
|
|
const uint8_t* payload,
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t payload_length,
|
2017-09-26 14:05:05 +02:00
|
|
|
int64_t timestamp_ms) = 0;
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2012-12-18 15:40:53 +00:00
|
|
|
protected:
|
2013-08-15 23:38:54 +00:00
|
|
|
// The data callback is where we should send received payload data.
|
|
|
|
|
// See ParseRtpPacket. This class does not claim ownership of the callback.
|
|
|
|
|
// Implementations must NOT hold any critical sections while calling the
|
|
|
|
|
// callback.
|
|
|
|
|
//
|
|
|
|
|
// Note: Implementations may call the callback for other reasons than calls
|
|
|
|
|
// to ParseRtpPacket, for instance if the implementation somehow recovers a
|
|
|
|
|
// packet.
|
2015-12-15 02:54:47 -08:00
|
|
|
explicit RTPReceiverStrategy(RtpData* data_callback);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CriticalSection crit_sect_;
|
2013-01-14 10:01:55 +00:00
|
|
|
RtpData* data_callback_;
|
2012-12-18 15:40:53 +00:00
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_
|