receiver.h 2.1 KB

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