Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 39e3528

Browse files
authored
Fix HEVC depacketizer issues. (#185)
- Incorrect VPS ID. - FindFrames doesn't return packets.
1 parent 6624f1a commit 39e3528

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

common_video/h265/h265_pps_parser.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ absl::optional<H265PpsParser::PpsState> H265PpsParser::ParseInternal(
202202
// slice_segment_header_extension_present_flag: u(1)
203203
reader.ConsumeBits(1);
204204

205+
if (!reader.Ok()) {
206+
return absl::nullopt;
207+
}
208+
205209
return pps;
206210
}
207211

common_video/h265/h265_sps_parser.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ absl::optional<H265SpsParser::SpsState> H265SpsParser::ParseSpsInternal(
395395
sps.height -= sub_height_c * (conf_win_top_offset + conf_win_bottom_offset);
396396
}
397397

398+
if (!reader.Ok()) {
399+
return absl::nullopt;
400+
}
401+
398402
return OptionalSps(sps);
399403
}
400404

common_video/h265/h265_vps_parser.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ absl::optional<H265VpsParser::VpsState> H265VpsParser::ParseInternal(
4343
VpsState vps;
4444

4545
// vps_video_parameter_set_id: u(4)
46-
vps.id = reader.Read<uint32_t>();
46+
vps.id = reader.ReadBits(4);
47+
48+
if (!reader.Ok()) {
49+
return absl::nullopt;
50+
}
4751

4852
return vps;
4953
}

modules/video_coding/packet_buffer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ std::vector<std::unique_ptr<PacketBuffer::Packet>> PacketBuffer::FindFrames(
447447
}
448448
}
449449
#endif
450-
if (is_h264 || full_frame_found) {
450+
if (is_h264 || is_h265 || full_frame_found) {
451451
const uint16_t end_seq_num = seq_num + 1;
452452
// Use uint16_t type to handle sequence number wrap around case.
453453
uint16_t num_packets = end_seq_num - start_seq_num;

0 commit comments

Comments
 (0)