From e7926e7ccbc180c2037a35871239e435d6e772a9 Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Tue, 29 Mar 2016 15:39:53 -0700 Subject: [PATCH] Fixed mac build for H.265 parser. Another feature that the mac build does not support. It incorrectly uses a copy-constructor when creating new values in a std::map. This is incorrect and should use an in-place constructor with C++11. Change-Id: I1e822747e97eb4ae01596d63ea05058cc383cb49 --- packager/media/filters/h265_parser.cc | 22 +++++++++++++--------- packager/media/filters/h265_parser.h | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packager/media/filters/h265_parser.cc b/packager/media/filters/h265_parser.cc index 1f32c72716..19b8f10389 100644 --- a/packager/media/filters/h265_parser.cc +++ b/packager/media/filters/h265_parser.cc @@ -10,6 +10,7 @@ #include #include "packager/base/logging.h" +#include "packager/base/stl_util.h" #include "packager/media/filters/nalu_reader.h" #define TRUE_OR_RETURN(a) \ @@ -86,7 +87,10 @@ H265SliceHeader::H265SliceHeader() {} H265SliceHeader::~H265SliceHeader() {} H265Parser::H265Parser() {} -H265Parser::~H265Parser() {} +H265Parser::~H265Parser() { + STLDeleteValues(&active_spses_); + STLDeleteValues(&active_ppses_); +} H265Parser::Result H265Parser::ParseSliceHeader(const Nalu& nalu, H265SliceHeader* slice_header) { @@ -406,10 +410,10 @@ H265Parser::Result H265Parser::ParsePps(const Nalu& nalu, int* pps_id) { // Ignore remaining extension data. - // This will replace any existing PPS instance. The scoped_ptr will delete - // the memory when it is overwritten. + // This will replace any existing PPS instance. *pps_id = pps->pic_parameter_set_id; - active_ppses_[*pps_id] = pps.Pass(); + delete active_ppses_[*pps_id]; + active_ppses_[*pps_id] = pps.release(); return kOk; } @@ -517,20 +521,20 @@ H265Parser::Result H265Parser::ParseSps(const Nalu& nalu, int* sps_id) { // Ignore remaining extension data. - // This will replace any existing SPS instance. The scoped_ptr will delete - // the memory when it is overwritten. + // This will replace any existing SPS instance. *sps_id = sps->seq_parameter_set_id; - active_spses_[*sps_id] = sps.Pass(); + delete active_spses_[*sps_id]; + active_spses_[*sps_id] = sps.release(); return kOk; } const H265Pps* H265Parser::GetPps(int pps_id) { - return active_ppses_[pps_id].get(); + return active_ppses_[pps_id]; } const H265Sps* H265Parser::GetSps(int sps_id) { - return active_spses_[sps_id].get(); + return active_spses_[sps_id]; } H265Parser::Result H265Parser::ParseReferencePictureSet( diff --git a/packager/media/filters/h265_parser.h b/packager/media/filters/h265_parser.h index e70cf1fdb0..615fc12fae 100644 --- a/packager/media/filters/h265_parser.h +++ b/packager/media/filters/h265_parser.h @@ -305,8 +305,8 @@ class H265Parser { Result SkipScalingListData(H26xBitReader* br); - typedef std::map> SpsById; - typedef std::map> PpsById; + typedef std::map SpsById; + typedef std::map PpsById; SpsById active_spses_; PpsById active_ppses_;