OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 } | 775 } |
776 } | 776 } |
777 uint16_t length = static_cast<uint16_t>(2 + 2 * numBoundingSet); | 777 uint16_t length = static_cast<uint16_t>(2 + 2 * numBoundingSet); |
778 ctx->buffer[posLength++] = static_cast<uint8_t>(length >> 8); | 778 ctx->buffer[posLength++] = static_cast<uint8_t>(length >> 8); |
779 ctx->buffer[posLength] = static_cast<uint8_t>(length); | 779 ctx->buffer[posLength] = static_cast<uint8_t>(length); |
780 | 780 |
781 return BuildResult::kSuccess; | 781 return BuildResult::kSuccess; |
782 } | 782 } |
783 | 783 |
784 RTCPSender::BuildResult RTCPSender::BuildAPP(RtcpContext* ctx) { | 784 RTCPSender::BuildResult RTCPSender::BuildAPP(RtcpContext* ctx) { |
785 // sanity | 785 // sanity |
åsapersson
2015/08/25 16:10:36
I think it is possible to send an app packet witho
sprang_webrtc
2015/08/31 12:52:38
OK. Removed check and added test case.
| |
786 if (app_data_ == NULL) { | 786 if (app_data_ == NULL) { |
787 LOG(LS_WARNING) << "Failed to build app specific."; | 787 LOG(LS_WARNING) << "Failed to build app specific."; |
788 return BuildResult::kError; | 788 return BuildResult::kError; |
789 } | 789 } |
790 | |
791 rtcp::App app; | |
792 app.From(ssrc_); | |
793 app.WithSubType(app_sub_type_); | |
794 app.WithName(app_name_); | |
795 app.WithData(app_data_.get(), app_length_); | |
796 | |
790 if (ctx->position + 12 + app_length_ >= IP_PACKET_SIZE) { | 797 if (ctx->position + 12 + app_length_ >= IP_PACKET_SIZE) { |
åsapersson
2015/08/25 16:10:36
checked within the rtcp packet class
sprang_webrtc
2015/08/31 12:52:38
Done.
| |
791 LOG(LS_WARNING) << "Failed to build app specific."; | 798 LOG(LS_WARNING) << "Failed to build app specific."; |
792 return BuildResult::kTruncated; | 799 return BuildResult::kTruncated; |
793 } | 800 } |
794 *ctx->AllocateData(1) = 0x80 + app_sub_type_; | |
795 | 801 |
796 // Add APP ID | 802 PacketBuiltCallback callback(ctx); |
797 *ctx->AllocateData(1) = 204; | 803 if (!callback.BuildPacket(app)) |
798 | 804 return BuildResult::kTruncated; |
799 uint16_t length = (app_length_ >> 2) + 2; // include SSRC and name | |
800 *ctx->AllocateData(1) = static_cast<uint8_t>(length >> 8); | |
801 *ctx->AllocateData(1) = static_cast<uint8_t>(length); | |
802 | |
803 // Add our own SSRC | |
804 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_); | |
805 | |
806 // Add our application name | |
807 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), app_name_); | |
808 | |
809 // Add the data | |
810 memcpy(ctx->AllocateData(app_length_), app_data_.get(), app_length_); | |
811 | 805 |
812 return BuildResult::kSuccess; | 806 return BuildResult::kSuccess; |
813 } | 807 } |
814 | 808 |
815 RTCPSender::BuildResult RTCPSender::BuildNACK(RtcpContext* ctx) { | 809 RTCPSender::BuildResult RTCPSender::BuildNACK(RtcpContext* ctx) { |
816 // sanity | 810 // sanity |
817 if (ctx->position + 16 >= IP_PACKET_SIZE) { | 811 if (ctx->position + 16 >= IP_PACKET_SIZE) { |
818 LOG(LS_WARNING) << "Failed to build NACK."; | 812 LOG(LS_WARNING) << "Failed to build NACK."; |
819 return BuildResult::kTruncated; | 813 return BuildResult::kTruncated; |
820 } | 814 } |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1348 | 1342 |
1349 bool RTCPSender::AllVolatileFlagsConsumed() const { | 1343 bool RTCPSender::AllVolatileFlagsConsumed() const { |
1350 for (const ReportFlag& flag : report_flags_) { | 1344 for (const ReportFlag& flag : report_flags_) { |
1351 if (flag.is_volatile) | 1345 if (flag.is_volatile) |
1352 return false; | 1346 return false; |
1353 } | 1347 } |
1354 return true; | 1348 return true; |
1355 } | 1349 } |
1356 | 1350 |
1357 } // namespace webrtc | 1351 } // namespace webrtc |
OLD | NEW |