ulpfec_receiver_impl.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifndef MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
  11. #define MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
  12. #include <stddef.h>
  13. #include <stdint.h>
  14. #include <memory>
  15. #include <vector>
  16. #include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
  17. #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
  18. #include "modules/rtp_rtcp/include/ulpfec_receiver.h"
  19. #include "modules/rtp_rtcp/source/forward_error_correction.h"
  20. #include "modules/rtp_rtcp/source/rtp_packet_received.h"
  21. #include "rtc_base/synchronization/mutex.h"
  22. namespace webrtc {
  23. class UlpfecReceiverImpl : public UlpfecReceiver {
  24. public:
  25. explicit UlpfecReceiverImpl(uint32_t ssrc,
  26. RecoveredPacketReceiver* callback,
  27. rtc::ArrayView<const RtpExtension> extensions);
  28. ~UlpfecReceiverImpl() override;
  29. bool AddReceivedRedPacket(const RtpPacketReceived& rtp_packet,
  30. uint8_t ulpfec_payload_type) override;
  31. int32_t ProcessReceivedFec() override;
  32. FecPacketCounter GetPacketCounter() const override;
  33. private:
  34. const uint32_t ssrc_;
  35. const RtpHeaderExtensionMap extensions_;
  36. mutable Mutex mutex_;
  37. RecoveredPacketReceiver* recovered_packet_callback_;
  38. std::unique_ptr<ForwardErrorCorrection> fec_;
  39. // TODO(nisse): The AddReceivedRedPacket method adds one or two packets to
  40. // this list at a time, after which it is emptied by ProcessReceivedFec. It
  41. // will make things simpler to merge AddReceivedRedPacket and
  42. // ProcessReceivedFec into a single method, and we can then delete this list.
  43. std::vector<std::unique_ptr<ForwardErrorCorrection::ReceivedPacket>>
  44. received_packets_;
  45. ForwardErrorCorrection::RecoveredPacketList recovered_packets_;
  46. FecPacketCounter packet_counter_;
  47. };
  48. } // namespace webrtc
  49. #endif // MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_