OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 */ | 10 */ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 private: | 42 private: |
43 uint32_t item_; | 43 uint32_t item_; |
44 }; | 44 }; |
45 | 45 |
46 Sli() {} | 46 Sli() {} |
47 ~Sli() override {} | 47 ~Sli() override {} |
48 | 48 |
49 // Parse assumes header is already parsed and validated. | 49 // Parse assumes header is already parsed and validated. |
50 bool Parse(const CommonHeader& packet); | 50 bool Parse(const CommonHeader& packet); |
51 | 51 |
52 void AddPictureId(uint8_t picture_id) { | 52 void WithPictureId(uint8_t picture_id, |
53 items_.emplace_back(picture_id, 0, 0x1fff); | 53 uint16_t first_macroblock = 0, |
54 } | 54 uint16_t number_macroblocks = 0x1fff) { |
55 void AddPictureId(uint8_t picture_id, | 55 items_.push_back( |
56 uint16_t first_macroblock, | 56 Macroblocks(picture_id, first_macroblock, number_macroblocks)); |
57 uint16_t number_macroblocks) { | |
58 items_.emplace_back(picture_id, first_macroblock, number_macroblocks); | |
59 } | 57 } |
60 | 58 |
61 const std::vector<Macroblocks>& macroblocks() const { return items_; } | 59 const std::vector<Macroblocks>& macroblocks() const { return items_; } |
62 | 60 |
63 protected: | 61 protected: |
64 bool Create(uint8_t* packet, | 62 bool Create(uint8_t* packet, |
65 size_t* index, | 63 size_t* index, |
66 size_t max_length, | 64 size_t max_length, |
67 RtcpPacket::PacketReadyCallback* callback) const override; | 65 RtcpPacket::PacketReadyCallback* callback) const override; |
68 | 66 |
69 private: | 67 private: |
70 size_t BlockLength() const override { | 68 size_t BlockLength() const override { |
71 return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength + | 69 return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength + |
72 items_.size() * Macroblocks::kLength; | 70 items_.size() * Macroblocks::kLength; |
73 } | 71 } |
74 | 72 |
75 std::vector<Macroblocks> items_; | 73 std::vector<Macroblocks> items_; |
76 | 74 |
77 RTC_DISALLOW_COPY_AND_ASSIGN(Sli); | 75 RTC_DISALLOW_COPY_AND_ASSIGN(Sli); |
78 }; | 76 }; |
79 | 77 |
80 } // namespace rtcp | 78 } // namespace rtcp |
81 } // namespace webrtc | 79 } // namespace webrtc |
82 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ | 80 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ |
OLD | NEW |