receiver.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2011 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_VIDEO_CODING_RECEIVER_H_
  11. #define MODULES_VIDEO_CODING_RECEIVER_H_
  12. #include <memory>
  13. #include <vector>
  14. #include "modules/video_coding/event_wrapper.h"
  15. #include "modules/video_coding/include/video_coding.h"
  16. #include "modules/video_coding/include/video_coding_defines.h"
  17. #include "modules/video_coding/jitter_buffer.h"
  18. #include "modules/video_coding/packet.h"
  19. #include "modules/video_coding/timing.h"
  20. #include "rtc_base/critical_section.h"
  21. namespace webrtc {
  22. class Clock;
  23. class VCMEncodedFrame;
  24. class VCMReceiver {
  25. public:
  26. VCMReceiver(VCMTiming* timing, Clock* clock);
  27. // Using this constructor, you can specify a different event implemetation for
  28. // the jitter buffer. Useful for unit tests when you want to simulate incoming
  29. // packets, in which case the jitter buffer's wait event is different from
  30. // that of VCMReceiver itself.
  31. VCMReceiver(VCMTiming* timing,
  32. Clock* clock,
  33. std::unique_ptr<EventWrapper> receiver_event,
  34. std::unique_ptr<EventWrapper> jitter_buffer_event);
  35. ~VCMReceiver();
  36. int32_t InsertPacket(const VCMPacket& packet);
  37. VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
  38. bool prefer_late_decoding);
  39. void ReleaseFrame(VCMEncodedFrame* frame);
  40. // NACK.
  41. void SetNackSettings(size_t max_nack_list_size,
  42. int max_packet_age_to_nack,
  43. int max_incomplete_time_ms);
  44. std::vector<uint16_t> NackList(bool* request_key_frame);
  45. private:
  46. Clock* const clock_;
  47. VCMJitterBuffer jitter_buffer_;
  48. VCMTiming* timing_;
  49. std::unique_ptr<EventWrapper> render_wait_event_;
  50. int max_video_delay_ms_;
  51. };
  52. } // namespace webrtc
  53. #endif // MODULES_VIDEO_CODING_RECEIVER_H_