LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source - rtp_receiver_strategy.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_
      12             : #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_
      13             : 
      14             : #include "webrtc/base/criticalsection.h"
      15             : #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
      16             : #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
      17             : #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
      18             : #include "webrtc/typedefs.h"
      19             : 
      20             : namespace webrtc {
      21             : 
      22             : struct CodecInst;
      23             : 
      24             : class TelephoneEventHandler;
      25             : 
      26             : // This strategy deals with media-specific RTP packet processing.
      27             : // This class is not thread-safe and must be protected by its caller.
      28             : class RTPReceiverStrategy {
      29             :  public:
      30             :   static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback);
      31             :   static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback);
      32             : 
      33           0 :   virtual ~RTPReceiverStrategy() {}
      34             : 
      35             :   // Parses the RTP packet and calls the data callback with the payload data.
      36             :   // Implementations are encouraged to use the provided packet buffer and RTP
      37             :   // header as arguments to the callback; implementations are also allowed to
      38             :   // make changes in the data as necessary. The specific_payload argument
      39             :   // provides audio or video-specific data. The is_first_packet argument is true
      40             :   // if this packet is either the first packet ever or the first in its frame.
      41             :   virtual int32_t ParseRtpPacket(WebRtcRTPHeader* rtp_header,
      42             :                                  const PayloadUnion& specific_payload,
      43             :                                  bool is_red,
      44             :                                  const uint8_t* payload,
      45             :                                  size_t payload_length,
      46             :                                  int64_t timestamp_ms,
      47             :                                  bool is_first_packet) = 0;
      48             : 
      49             :   virtual TelephoneEventHandler* GetTelephoneEventHandler() = 0;
      50             : 
      51             :   // Computes the current dead-or-alive state.
      52             :   virtual RTPAliveType ProcessDeadOrAlive(
      53             :       uint16_t last_payload_length) const = 0;
      54             : 
      55             :   // Returns true if we should report CSRC changes for this payload type.
      56             :   // TODO(phoglund): should move out of here along with other payload stuff.
      57             :   virtual bool ShouldReportCsrcChanges(uint8_t payload_type) const = 0;
      58             : 
      59             :   // Notifies the strategy that we have created a new non-RED audio payload type
      60             :   // in the payload registry.
      61             :   virtual int32_t OnNewPayloadTypeCreated(const CodecInst& audio_codec) = 0;
      62             : 
      63             :   // Invokes the OnInitializeDecoder callback in a media-specific way.
      64             :   virtual int32_t InvokeOnInitializeDecoder(
      65             :       RtpFeedback* callback,
      66             :       int8_t payload_type,
      67             :       const char payload_name[RTP_PAYLOAD_NAME_SIZE],
      68             :       const PayloadUnion& specific_payload) const = 0;
      69             : 
      70             :   // Checks if the payload type has changed, and returns whether we should
      71             :   // reset statistics and/or discard this packet.
      72             :   virtual void CheckPayloadChanged(int8_t payload_type,
      73             :                                    PayloadUnion* specific_payload,
      74             :                                    bool* should_discard_changes);
      75             : 
      76             :   virtual int Energy(uint8_t array_of_energy[kRtpCsrcSize]) const;
      77             : 
      78             :   // Stores / retrieves the last media specific payload for later reference.
      79             :   void GetLastMediaSpecificPayload(PayloadUnion* payload) const;
      80             :   void SetLastMediaSpecificPayload(const PayloadUnion& payload);
      81             : 
      82             :  protected:
      83             :   // The data callback is where we should send received payload data.
      84             :   // See ParseRtpPacket. This class does not claim ownership of the callback.
      85             :   // Implementations must NOT hold any critical sections while calling the
      86             :   // callback.
      87             :   //
      88             :   // Note: Implementations may call the callback for other reasons than calls
      89             :   // to ParseRtpPacket, for instance if the implementation somehow recovers a
      90             :   // packet.
      91             :   explicit RTPReceiverStrategy(RtpData* data_callback);
      92             : 
      93             :   rtc::CriticalSection crit_sect_;
      94             :   PayloadUnion last_payload_;
      95             :   RtpData* data_callback_;
      96             : };
      97             : }  // namespace webrtc
      98             : 
      99             : #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_

Generated by: LCOV version 1.13