Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 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 | |
| 12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ | |
| 13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ | |
| 14 | |
| 15 #include <vector> | |
| 16 | |
| 17 #include "webrtc/base/basictypes.h" | |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h" | |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | |
| 20 | |
| 21 namespace webrtc { | |
| 22 namespace rtcp { | |
| 23 | |
| 24 // Slice loss indication (SLI) (RFC 4585). | |
| 25 class Sli : public Psfb { | |
| 26 public: | |
| 27 static const uint8_t kFeedbackMessageType = 2; | |
| 28 class Macroblocks { | |
|
åsapersson
2016/01/11 12:13:54
maybe Item?
danilchap
2016/01/11 15:36:32
Item is too generic name.
In case of SLI packet th
| |
| 29 public: | |
| 30 static const size_t kLength = 4; | |
| 31 Macroblocks() : item_(0) {} | |
| 32 Macroblocks(uint8_t picture_id, uint16_t first, uint16_t number); | |
| 33 ~Macroblocks() {} | |
| 34 | |
| 35 void Parse(const uint8_t* buffer); | |
| 36 void Create(uint8_t* buffer) const; | |
| 37 | |
| 38 uint16_t first() const { return item_ >> 19; } | |
| 39 uint16_t number() const { return (item_ >> 6) & 0x1fff; } | |
| 40 uint8_t picture_id() const { return (item_ & 0x3f); } | |
| 41 | |
| 42 private: | |
| 43 uint32_t item_; | |
| 44 }; | |
| 45 | |
| 46 Sli() {} | |
| 47 virtual ~Sli() {} | |
| 48 | |
| 49 // Parse assumes header is already parsed and validated. | |
| 50 bool Parse(const RTCPUtility::RtcpCommonHeader& header, | |
| 51 const uint8_t* payload); // Size of the payload is in the header. | |
| 52 | |
| 53 void WithMacroblocks(Macroblocks macroblocks) { | |
|
åsapersson
2016/01/11 12:13:54
not used, remove?
danilchap
2016/01/11 15:36:32
Done, likely will not be used.
| |
| 54 macroblocks_.push_back(macroblocks); | |
| 55 } | |
| 56 void WithMacroblocks(uint8_t picture_id, uint16_t first_mb, uint16_t count) { | |
|
åsapersson
2016/01/11 12:13:54
maybe WithItem?
danilchap
2016/01/11 15:36:32
WithItem sounds too generic, maybe restore origina
| |
| 57 macroblocks_.push_back(Macroblocks(picture_id, first_mb, count)); | |
| 58 } | |
| 59 | |
| 60 const std::vector<Macroblocks>& macroblocks() const { return macroblocks_; } | |
| 61 | |
| 62 protected: | |
| 63 bool Create(uint8_t* packet, | |
| 64 size_t* index, | |
| 65 size_t max_length, | |
| 66 RtcpPacket::PacketReadyCallback* callback) const override; | |
| 67 | |
| 68 private: | |
| 69 size_t BlockLength() const override { | |
| 70 return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength + | |
| 71 macroblocks_.size() * Macroblocks::kLength; | |
| 72 } | |
| 73 | |
| 74 std::vector<Macroblocks> macroblocks_; | |
|
åsapersson
2016/01/11 12:13:54
maybe call items_?
danilchap
2016/01/11 15:36:32
Done. Internally they are treated as items in the
| |
| 75 | |
| 76 RTC_DISALLOW_COPY_AND_ASSIGN(Sli); | |
| 77 }; | |
| 78 | |
| 79 } // namespace rtcp | |
| 80 } // namespace webrtc | |
| 81 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ | |
| OLD | NEW |