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

Unified Diff: webrtc/modules/video_coding/h264_sps_pps_tracker.cc

Issue 2750633003: Save width/height of SPS nalus and restore them on the first packet of an IDR. (Closed)
Patch Set: More testing. Created 3 years, 9 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: webrtc/modules/video_coding/h264_sps_pps_tracker.cc
diff --git a/webrtc/modules/video_coding/h264_sps_pps_tracker.cc b/webrtc/modules/video_coding/h264_sps_pps_tracker.cc
index 5dfdb49146a5f6874feef864074a8ffa72854166..72ffad6824262f0bb86e761e47f867daa0e1c0dc 100644
--- a/webrtc/modules/video_coding/h264_sps_pps_tracker.cc
+++ b/webrtc/modules/video_coding/h264_sps_pps_tracker.cc
@@ -45,6 +45,7 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
bool insert_packet = codec_header.nalus_length == 0 ? true : false;
int pps_id = -1;
+ int sps_id = -1;
size_t required_size = 0;
for (size_t i = 0; i < codec_header.nalus_length; ++i) {
const NaluInfo& nalu = codec_header.nalus[i];
@@ -55,6 +56,8 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
sps_data_[nalu.sps_id].data.reset(new uint8_t[nalu.size]);
memcpy(sps_data_[nalu.sps_id].data.get(), data + nalu.offset,
nalu.size);
+ sps_data_[nalu.sps_id].width = packet->width;
+ sps_data_[nalu.sps_id].height = packet->height;
break;
}
case H264::NaluType::kPps: {
@@ -90,6 +93,7 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
return kRequestKeyframe;
}
+ sps_id = pps->second.sps_id;
pps_id = nalu.pps_id;
required_size += pps->second.size + sizeof(start_code_h264);
required_size += sps->second.size + sizeof(start_code_h264);
@@ -177,6 +181,11 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
memcpy(insert_at, data, data_size);
}
+ if (sps_data_[sps_id].width > 0 && sps_data_[sps_id].height) {
stefan-webrtc 2017/03/14 10:32:20 height > 0 Or, if you anyway initialize width/hei
philipel 2017/03/14 11:51:12 The problem is that I can't be certain that the SP
stefan-webrtc 2017/03/14 12:06:36 I'm fairly sure width/height is required in the sp
philipel 2017/03/14 13:52:41 I looked at the code and we only know the width/he
+ packet->width = sps_data_[sps_id].width;
+ packet->height = sps_data_[sps_id].height;
+ }
+
packet->dataPtr = buffer;
packet->sizeBytes = required_size;
return kInsert;

Powered by Google App Engine
This is Rietveld 408576698