From 8ea5df820e4e6aa24ea01cd11cf36ca0fa03102f Mon Sep 17 00:00:00 2001 From: Rintaro Kuroiwa Date: Thu, 7 Apr 2016 11:33:23 -0700 Subject: [PATCH] Use list of raw pointers rather than scoped_ptr - Containers with scoped_ptrs break mac builds. Change-Id: Id4b9aa735511bf27c83aa8465f64a627fb7fa1d2 --- packager/media/formats/mp2t/pes_packet_generator.cc | 12 ++++++------ packager/media/formats/mp2t/pes_packet_generator.h | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packager/media/formats/mp2t/pes_packet_generator.cc b/packager/media/formats/mp2t/pes_packet_generator.cc index bd0fb03328..bdae56679b 100644 --- a/packager/media/formats/mp2t/pes_packet_generator.cc +++ b/packager/media/formats/mp2t/pes_packet_generator.cc @@ -23,11 +23,11 @@ const uint8_t kVideoStreamId = 0xe0; const uint8_t kAudioStreamId = 0xc0; } // namespace -PesPacketGenerator::PesPacketGenerator() {} +PesPacketGenerator::PesPacketGenerator() : pes_packets_deleter_(&pes_packets_) {} PesPacketGenerator::~PesPacketGenerator() {} bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) { - pes_packets_.clear(); + STLDeleteElements(&pes_packets_); stream_type_ = stream_info.stream_type(); if (stream_type_ == kStreamVideo) { @@ -76,7 +76,7 @@ bool PesPacketGenerator::PushSample(scoped_refptr sample) { return false; } current_processing_pes_->set_stream_id(kVideoStreamId); - pes_packets_.push_back(current_processing_pes_.Pass()); + pes_packets_.push_back(current_processing_pes_.release()); return true; } DCHECK_EQ(stream_type_, kStreamAudio); @@ -91,7 +91,7 @@ bool PesPacketGenerator::PushSample(scoped_refptr sample) { // packets. current_processing_pes_->mutable_data()->swap(aac_frame); current_processing_pes_->set_stream_id(kAudioStreamId); - pes_packets_.push_back(current_processing_pes_.Pass()); + pes_packets_.push_back(current_processing_pes_.release()); return true; } @@ -101,9 +101,9 @@ size_t PesPacketGenerator::NumberOfReadyPesPackets() { scoped_ptr PesPacketGenerator::GetNextPesPacket() { DCHECK(!pes_packets_.empty()); - scoped_ptr pes = pes_packets_.front().Pass(); + PesPacket* pes = pes_packets_.front(); pes_packets_.pop_front(); - return pes.Pass(); + return scoped_ptr(pes); } bool PesPacketGenerator::Flush() { diff --git a/packager/media/formats/mp2t/pes_packet_generator.h b/packager/media/formats/mp2t/pes_packet_generator.h index 00b673e560..91a8951f84 100644 --- a/packager/media/formats/mp2t/pes_packet_generator.h +++ b/packager/media/formats/mp2t/pes_packet_generator.h @@ -10,6 +10,7 @@ #include #include "packager/base/memory/scoped_ptr.h" +#include "packager/base/stl_util.h" #include "packager/media/base/media_sample.h" #include "packager/media/base/stream_info.h" @@ -77,7 +78,8 @@ class PesPacketGenerator { // This can be used to create a PES from multiple audio samples. scoped_ptr current_processing_pes_; - std::list> pes_packets_; + std::list pes_packets_; + STLElementDeleter pes_packets_deleter_; DISALLOW_COPY_AND_ASSIGN(PesPacketGenerator); };