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

Unified Diff: media/filters/h264_parser.cc

Issue 1369673002: H264Decoder: Handle gaps in frame_num. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/h264_parser.cc
diff --git a/media/filters/h264_parser.cc b/media/filters/h264_parser.cc
index fe2a443e32845c77575fb101baa25a6101d56567..4f06aa59296fbd6a69ca18bbf2cf0afad0f3f1ff 100644
--- a/media/filters/h264_parser.cc
+++ b/media/filters/h264_parser.cc
@@ -160,11 +160,23 @@ void H264Parser::SetEncryptedStream(
}
const H264PPS* H264Parser::GetPPS(int pps_id) {
- return active_PPSes_[pps_id];
+ auto it = active_PPSes_.find(pps_id);
+ if (it == active_PPSes_.end()) {
+ DVLOG(1) << "Requested a nonexistent PPS id " << pps_id;
+ return nullptr;
+ }
+
+ return it->second;
}
const H264SPS* H264Parser::GetSPS(int sps_id) {
- return active_SPSes_[sps_id];
+ auto it = active_SPSes_.find(sps_id);
+ if (it == active_SPSes_.end()) {
+ DVLOG(1) << "Requested a nonexistent SPS id " << sps_id;
+ return nullptr;
+ }
+
+ return it->second;
}
static inline bool IsStartCode(const uint8* data) {
@@ -835,9 +847,6 @@ H264Parser::Result H264Parser::ParseSPS(int* sps_id) {
READ_UE_OR_RETURN(&sps->max_num_ref_frames);
READ_BOOL_OR_RETURN(&sps->gaps_in_frame_num_value_allowed_flag);
- if (sps->gaps_in_frame_num_value_allowed_flag)
- return kUnsupportedStream;
-
READ_UE_OR_RETURN(&sps->pic_width_in_mbs_minus1);
READ_UE_OR_RETURN(&sps->pic_height_in_map_units_minus1);
@@ -884,6 +893,11 @@ H264Parser::Result H264Parser::ParsePPS(int* pps_id) {
READ_UE_OR_RETURN(&pps->seq_parameter_set_id);
TRUE_OR_RETURN(pps->seq_parameter_set_id < 32);
+ if (active_SPSes_.find(pps->seq_parameter_set_id) == active_SPSes_.end()) {
+ DVLOG(1) << "Invalid stream, no SPS id: " << pps->seq_parameter_set_id;
+ return kInvalidStream;
+ }
+
sps = GetSPS(pps->seq_parameter_set_id);
TRUE_OR_RETURN(sps);

Powered by Google App Engine
This is Rietveld 408576698