Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc

Issue 2575073002: Guard against uninitialized packetization modes. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 offset += kLengthFieldSize + nalu_size; 74 offset += kLengthFieldSize + nalu_size;
75 } 75 }
76 return true; 76 return true;
77 } 77 }
78 78
79 } // namespace 79 } // namespace
80 80
81 RtpPacketizerH264::RtpPacketizerH264(size_t max_payload_len, 81 RtpPacketizerH264::RtpPacketizerH264(size_t max_payload_len,
82 H264PacketizationMode packetization_mode) 82 H264PacketizationMode packetization_mode)
83 : max_payload_len_(max_payload_len), 83 : max_payload_len_(max_payload_len),
84 packetization_mode_(packetization_mode) {} 84 packetization_mode_(packetization_mode) {
85 // Guard against uninitialized memory in packetization_mode.
86 RTC_CHECK(packetization_mode == H264PacketizationMode::NonInterleaved ||
87 packetization_mode == H264PacketizationMode::SingleNalUnit);
88 }
85 89
86 RtpPacketizerH264::~RtpPacketizerH264() { 90 RtpPacketizerH264::~RtpPacketizerH264() {
87 } 91 }
88 92
89 RtpPacketizerH264::Fragment::Fragment(const uint8_t* buffer, size_t length) 93 RtpPacketizerH264::Fragment::Fragment(const uint8_t* buffer, size_t length)
90 : buffer(buffer), length(length) {} 94 : buffer(buffer), length(length) {}
91 RtpPacketizerH264::Fragment::Fragment(const Fragment& fragment) 95 RtpPacketizerH264::Fragment::Fragment(const Fragment& fragment)
92 : buffer(fragment.buffer), length(fragment.length) {} 96 : buffer(fragment.buffer), length(fragment.length) {}
93 97
94 void RtpPacketizerH264::SetPayloadData( 98 void RtpPacketizerH264::SetPayloadData(
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 h264->packetization_type = kH264FuA; 619 h264->packetization_type = kH264FuA;
616 h264->nalu_type = original_nal_type; 620 h264->nalu_type = original_nal_type;
617 if (first_fragment) { 621 if (first_fragment) {
618 h264->nalus[h264->nalus_length] = nalu; 622 h264->nalus[h264->nalus_length] = nalu;
619 h264->nalus_length = 1; 623 h264->nalus_length = 1;
620 } 624 }
621 return true; 625 return true;
622 } 626 }
623 627
624 } // namespace webrtc 628 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698