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

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: Test fix. 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..e4450a351f8927d2f7db6c6469b5affd0b577efa 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: {
@@ -83,7 +86,8 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
return kRequestKeyframe;
}
- auto sps = sps_data_.find(pps->second.sps_id);
+ sps_id = pps->second.sps_id;
+ auto sps = sps_data_.find(sps_id);
if (sps == sps_data_.end()) {
LOG(LS_WARNING) << "No SPS with id << "
<< pps_data_[nalu.pps_id].sps_id << " received";
@@ -177,6 +181,8 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
memcpy(insert_at, data, data_size);
}
+ packet->width = sps_data_[sps_id].width;
+ packet->height = sps_data_[sps_id].height;
packet->dataPtr = buffer;
packet->sizeBytes = required_size;
return kInsert;
@@ -222,6 +228,8 @@ void H264SpsPpsTracker::InsertSpsPpsNalus(const std::vector<uint8_t>& sps,
SpsInfo sps_info;
sps_info.size = sps.size();
+ sps_info.width = parsed_sps->width;
+ sps_info.height = parsed_sps->height;
uint8_t* sps_data = new uint8_t[sps_info.size];
memcpy(sps_data, sps.data(), sps_info.size);
sps_info.data.reset(sps_data);
« no previous file with comments | « webrtc/modules/video_coding/h264_sps_pps_tracker.h ('k') | webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698