Enable warnings and warnings-as-errors
The warnings and warnings-as-errors are enabled by set chromium_code to 1. Chromium build disables warnings and warnings-as-errors by default on external contents. And fix the errors with them enabled. Mostly defined but not used, sign-unsign comparison, unsigned string formatting, and return value not used etc. Change-Id: I305b63924955a84172e98e0ebfe5aba0f11bdb37
This commit is contained in:
parent
0c2d7cfa33
commit
25b1038f5d
|
@ -36,9 +36,9 @@ const char kUsage[] =
|
|||
namespace media {
|
||||
|
||||
void DumpStreamInfo(const std::vector<MediaStream*>& streams) {
|
||||
printf("Found %d stream(s).\n", streams.size());
|
||||
printf("Found %zu stream(s).\n", streams.size());
|
||||
for (size_t i = 0; i < streams.size(); ++i)
|
||||
printf("Stream [%d] %s\n", i, streams[i]->info()->ToString().c_str());
|
||||
printf("Stream [%zu] %s\n", i, streams[i]->info()->ToString().c_str());
|
||||
}
|
||||
|
||||
// Create and initialize encryptor source.
|
||||
|
|
|
@ -109,7 +109,7 @@ void AesCtrEncryptor::UpdateIv() {
|
|||
counter_ = iv_;
|
||||
counter_.resize(AES_BLOCK_SIZE, 0);
|
||||
} else {
|
||||
DCHECK_EQ(16, iv_.size());
|
||||
DCHECK_EQ(16u, iv_.size());
|
||||
// Even though the block counter portion of the counter (bytes 8 to 15) is
|
||||
// treated as a 64-bit number, it is recommended that the initialization
|
||||
// vector is treated as a 128-bit number when calculating the next
|
||||
|
|
|
@ -98,7 +98,7 @@ TEST_F(BufferWriterTest, AppendNBytes) {
|
|||
TEST_F(BufferWriterTest, AppendEmptyVector) {
|
||||
std::vector<uint8> v;
|
||||
writer_->AppendVector(v);
|
||||
ASSERT_EQ(0, writer_->Size());
|
||||
ASSERT_EQ(0u, writer_->Size());
|
||||
}
|
||||
|
||||
TEST_F(BufferWriterTest, AppendVector) {
|
||||
|
@ -157,7 +157,7 @@ TEST_F(BufferWriterTest, Clear) {
|
|||
writer_->AppendInt(kuint32);
|
||||
ASSERT_EQ(sizeof(kuint32), writer_->Size());
|
||||
writer_->Clear();
|
||||
ASSERT_EQ(0, writer_->Size());
|
||||
ASSERT_EQ(0u, writer_->Size());
|
||||
}
|
||||
|
||||
TEST_F(BufferWriterTest, WriteToFile) {
|
||||
|
@ -170,15 +170,16 @@ TEST_F(BufferWriterTest, WriteToFile) {
|
|||
writer_->AppendArray(kuint8Array, sizeof(kuint8Array));
|
||||
ASSERT_EQ(sizeof(kuint8Array), writer_->Size());
|
||||
ASSERT_OK(writer_->WriteToFile(output_file));
|
||||
ASSERT_EQ(0, writer_->Size());
|
||||
ASSERT_EQ(0u, writer_->Size());
|
||||
ASSERT_TRUE(output_file->Close());
|
||||
|
||||
// Read the file and verify.
|
||||
File* const input_file = File::Open(path.value().c_str(), "r");
|
||||
ASSERT_TRUE(input_file != NULL);
|
||||
std::vector<uint8> data_read(sizeof(kuint8Array), 0);
|
||||
EXPECT_EQ(sizeof(kuint8Array),
|
||||
input_file->Read(&data_read[0], data_read.size()));
|
||||
EXPECT_EQ(
|
||||
sizeof(kuint8Array),
|
||||
static_cast<size_t>(input_file->Read(&data_read[0], data_read.size())));
|
||||
ASSERT_TRUE(input_file->Close());
|
||||
|
||||
for (size_t i = 0; i < sizeof(kuint8Array); ++i)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "media/mp4/mp4_media_parser.h"
|
||||
|
||||
namespace {
|
||||
const int kBufSize = 0x40000; // 256KB.
|
||||
const size_t kBufSize = 0x40000; // 256KB.
|
||||
}
|
||||
|
||||
namespace media {
|
||||
|
|
|
@ -23,7 +23,7 @@ int FakeBytes(uint8* buf, int num) {
|
|||
DCHECK(buf);
|
||||
DCHECK(g_rand_source_fp);
|
||||
|
||||
if (fread(buf, 1, num, g_rand_source_fp) < num) {
|
||||
if (fread(buf, 1, num, g_rand_source_fp) < static_cast<size_t>(num)) {
|
||||
LOG(ERROR) << "Ran out of fake PRNG data";
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "media/base/status_test_util.h"
|
||||
|
||||
namespace {
|
||||
const int kHttpOK = 200;
|
||||
const int kHttpNotFound = 404;
|
||||
|
||||
const char kTestUrl[] = "http://packager-test.appspot.com/http_test";
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'../..',
|
||||
|
|
|
@ -80,7 +80,7 @@ Status MediaStream::Start(MediaStreamOperation operation) {
|
|||
} else {
|
||||
// We need to disconnect all its peer streams which are not connected
|
||||
// to a muxer.
|
||||
for (int i = 0; i < demuxer_->streams().size(); ++i) {
|
||||
for (size_t i = 0; i < demuxer_->streams().size(); ++i) {
|
||||
Status status = demuxer_->streams()[i]->Start(operation);
|
||||
if (!status.ok())
|
||||
return status;
|
||||
|
|
|
@ -36,7 +36,7 @@ StreamInfo::~StreamInfo() {}
|
|||
|
||||
std::string StreamInfo::ToString() const {
|
||||
return base::StringPrintf(
|
||||
"type: %s\n codec_string: %s\n time_scale: %d\n duration: %d "
|
||||
"type: %s\n codec_string: %s\n time_scale: %d\n duration: %lu "
|
||||
"(%.1f seconds)\n language: %s\n is_encrypted: %s\n",
|
||||
(stream_type_ == kStreamAudio ? "Audio" : "Video"),
|
||||
codec_string_.c_str(),
|
||||
|
|
|
@ -39,7 +39,7 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
|
|||
virtual std::string ToString() const;
|
||||
|
||||
StreamType stream_type() const { return stream_type_; }
|
||||
int track_id() const { return track_id_; }
|
||||
uint32 track_id() const { return track_id_; }
|
||||
uint32 time_scale() const { return time_scale_; }
|
||||
uint64 duration() const { return duration_; }
|
||||
const std::string& codec_string() const { return codec_string_; }
|
||||
|
@ -58,7 +58,7 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
|
|||
private:
|
||||
// Whether the stream is Audio or Video.
|
||||
StreamType stream_type_;
|
||||
int track_id_;
|
||||
uint32 track_id_;
|
||||
// The actual time is calculated as time / time_scale_ in seconds.
|
||||
uint32 time_scale_;
|
||||
// Duration base on time_scale.
|
||||
|
|
|
@ -72,7 +72,7 @@ bool GetPssh(const base::DictionaryValue& track_dict,
|
|||
RCHECK(track_dict.GetList("pssh", &pssh_list));
|
||||
// Invariant check. We don't want to crash in release mode if possible.
|
||||
// The following code handles it gracefully if GetSize() does not return 1.
|
||||
DCHECK_EQ(1, pssh_list->GetSize());
|
||||
DCHECK_EQ(1u, pssh_list->GetSize());
|
||||
|
||||
const base::DictionaryValue* pssh_dict;
|
||||
RCHECK(pssh_list->GetDictionary(0, &pssh_dict));
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'../..',
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
namespace media {
|
||||
|
||||
class MuxerOptions;
|
||||
class StreamInfo;
|
||||
struct MuxerOptions;
|
||||
|
||||
namespace event {
|
||||
|
||||
|
|
|
@ -24,16 +24,6 @@ namespace {
|
|||
const char kEncryptedMp4Uri[] = "urn:mpeg:dash:mp4protection:2011";
|
||||
const char kEncryptedMp4Value[] = "cenc";
|
||||
|
||||
bool IsAnyStreamEncrypted(const std::vector<StreamInfo*>& stream_infos) {
|
||||
typedef std::vector<StreamInfo*>::const_iterator Iterator;
|
||||
for (Iterator it = stream_infos.begin(); it != stream_infos.end(); ++it) {
|
||||
if ((*it)->is_encrypted())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// |user_scheme_id_uri| is the user specified schemeIdUri for ContentProtection.
|
||||
// This adds a default ContentProtection element if the container is MP4.
|
||||
// Returns true if a ContentProtectionXml is added to |media_info|, otherwise
|
||||
|
|
|
@ -88,7 +88,7 @@ void SetMediaInfoCommonInfo(float duration_seconds,
|
|||
MuxerListener::ContainerType container_type,
|
||||
MediaInfo* media_info) {
|
||||
DCHECK(media_info);
|
||||
DCHECK_GT(file_size, 0);
|
||||
DCHECK_GT(file_size, 0u);
|
||||
DCHECK_GT(duration_seconds, 0.0f);
|
||||
|
||||
media_info->set_media_duration_seconds(duration_seconds);
|
||||
|
|
|
@ -18,8 +18,8 @@ class MediaInfo;
|
|||
|
||||
namespace media {
|
||||
|
||||
class MuxerOptions;
|
||||
class StreamInfo;
|
||||
struct MuxerOptions;
|
||||
|
||||
namespace event {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'../..',
|
||||
|
|
|
@ -138,7 +138,7 @@ uint32 AACAudioSpecificConfig::GetOutputSamplesPerSecond(bool sbr_in_mimetype)
|
|||
// The following code is written according to ISO 14496 Part 3 Table 1.11 and
|
||||
// Table 1.22. (Table 1.11 refers to the capping to 48000, Table 1.22 refers
|
||||
// to SBR doubling the AAC sample rate.)
|
||||
DCHECK_GT(frequency_, 0);
|
||||
DCHECK_GT(frequency_, 0u);
|
||||
return std::min(2 * frequency_, 48000u);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ TEST(AACAudioSpecificConfigTest, BasicProfileTest) {
|
|||
data.assign(buffer, buffer + sizeof(buffer));
|
||||
|
||||
EXPECT_TRUE(aac_audio_specific_config.Parse(data));
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(false), 44100);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(false), 2);
|
||||
EXPECT_EQ(44100u, aac_audio_specific_config.GetOutputSamplesPerSecond(false));
|
||||
EXPECT_EQ(2u, aac_audio_specific_config.GetNumChannels(false));
|
||||
}
|
||||
|
||||
TEST(AACAudioSpecificConfigTest, ExtensionTest) {
|
||||
|
@ -29,9 +29,9 @@ TEST(AACAudioSpecificConfigTest, ExtensionTest) {
|
|||
data.assign(buffer, buffer + sizeof(buffer));
|
||||
|
||||
EXPECT_TRUE(aac_audio_specific_config.Parse(data));
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(false), 48000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(true), 48000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(false), 2);
|
||||
EXPECT_EQ(48000u, aac_audio_specific_config.GetOutputSamplesPerSecond(false));
|
||||
EXPECT_EQ(48000u, aac_audio_specific_config.GetOutputSamplesPerSecond(true));
|
||||
EXPECT_EQ(2u, aac_audio_specific_config.GetNumChannels(false));
|
||||
}
|
||||
|
||||
// Test implicit SBR with mono channel config.
|
||||
|
@ -48,12 +48,12 @@ TEST(AACAudioSpecificConfigTest, ImplicitSBR_ChannelConfig0) {
|
|||
EXPECT_TRUE(aac_audio_specific_config.Parse(data));
|
||||
|
||||
// Test w/o implict SBR.
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(false), 24000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(false), 1);
|
||||
EXPECT_EQ(24000u, aac_audio_specific_config.GetOutputSamplesPerSecond(false));
|
||||
EXPECT_EQ(1u, aac_audio_specific_config.GetNumChannels(false));
|
||||
|
||||
// Test implicit SBR.
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(true), 48000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(true), 2);
|
||||
EXPECT_EQ(48000u, aac_audio_specific_config.GetOutputSamplesPerSecond(true));
|
||||
EXPECT_EQ(2u, aac_audio_specific_config.GetNumChannels(true));
|
||||
}
|
||||
|
||||
// Tests implicit SBR with a stereo channel config.
|
||||
|
@ -67,12 +67,12 @@ TEST(AACAudioSpecificConfigTest, ImplicitSBR_ChannelConfig1) {
|
|||
EXPECT_TRUE(aac_audio_specific_config.Parse(data));
|
||||
|
||||
// Test w/o implict SBR.
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(false), 24000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(false), 2);
|
||||
EXPECT_EQ(24000u, aac_audio_specific_config.GetOutputSamplesPerSecond(false));
|
||||
EXPECT_EQ(2u, aac_audio_specific_config.GetNumChannels(false));
|
||||
|
||||
// Test implicit SBR.
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(true), 48000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(true), 2);
|
||||
EXPECT_EQ(48000u, aac_audio_specific_config.GetOutputSamplesPerSecond(true));
|
||||
EXPECT_EQ(2u, aac_audio_specific_config.GetNumChannels(true));
|
||||
}
|
||||
|
||||
TEST(AACAudioSpecificConfigTest, SixChannelTest) {
|
||||
|
@ -83,8 +83,8 @@ TEST(AACAudioSpecificConfigTest, SixChannelTest) {
|
|||
data.assign(buffer, buffer + sizeof(buffer));
|
||||
|
||||
EXPECT_TRUE(aac_audio_specific_config.Parse(data));
|
||||
EXPECT_EQ(aac_audio_specific_config.GetOutputSamplesPerSecond(false), 48000);
|
||||
EXPECT_EQ(aac_audio_specific_config.GetNumChannels(false), 6);
|
||||
EXPECT_EQ(48000u, aac_audio_specific_config.GetOutputSamplesPerSecond(false));
|
||||
EXPECT_EQ(6u, aac_audio_specific_config.GetNumChannels(false));
|
||||
}
|
||||
|
||||
TEST(AACAudioSpecificConfigTest, DataTooShortTest) {
|
||||
|
|
|
@ -144,7 +144,7 @@ class BoxBuffer {
|
|||
if (reader_)
|
||||
return reader_->ReadChild(box);
|
||||
// The box is mandatory, i.e. the box size should not be 0.
|
||||
DCHECK_NE(0, box->atom_size);
|
||||
DCHECK_NE(0u, box->atom_size);
|
||||
CHECK(box->ReadWrite(this));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ bool SampleDescription::ReadWrite(BoxBuffer* buffer) {
|
|||
RCHECK(audio_entries.size() == count);
|
||||
}
|
||||
} else {
|
||||
DCHECK_LT(0, count);
|
||||
DCHECK_LT(0u, count);
|
||||
if (type == kVideo) {
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
RCHECK(video_entries[i].ReadWrite(buffer));
|
||||
|
@ -548,8 +548,8 @@ bool CompactSampleSize::ReadWrite(BoxBuffer* buffer) {
|
|||
sizes[i] = size >> 4;
|
||||
sizes[i + 1] = size & 0x0F;
|
||||
} else {
|
||||
DCHECK_LT(sizes[i], 16);
|
||||
DCHECK_LT(sizes[i + 1], 16);
|
||||
DCHECK_LT(sizes[i], 16u);
|
||||
DCHECK_LT(sizes[i + 1], 16u);
|
||||
uint8 size = (sizes[i] << 4) | sizes[i + 1];
|
||||
RCHECK(buffer->ReadWriteUInt8(&size));
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ HandlerReference::~HandlerReference() {}
|
|||
FourCC HandlerReference::BoxType() const { return FOURCC_HDLR; }
|
||||
|
||||
bool HandlerReference::ReadWrite(BoxBuffer* buffer) {
|
||||
FourCC hdlr_type;
|
||||
FourCC hdlr_type = FOURCC_NULL;
|
||||
std::vector<uint8> handler_name;
|
||||
if (!buffer->Reading()) {
|
||||
if (type == kVideo) {
|
||||
|
@ -791,6 +791,7 @@ bool HandlerReference::ReadWrite(BoxBuffer* buffer) {
|
|||
kAudioHandlerName + arraysize(kAudioHandlerName));
|
||||
} else {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
RCHECK(FullBox::ReadWrite(buffer) &&
|
||||
|
|
|
@ -787,9 +787,9 @@ TYPED_TEST(BoxDefinitionsTestGeneral, Empty) {
|
|||
TypeParam box;
|
||||
LOG(INFO) << "Processing " << FourCCToString(box.BoxType());
|
||||
if (this->IsOptional(&box)) {
|
||||
ASSERT_EQ(0, box.ComputeSize());
|
||||
ASSERT_EQ(0u, box.ComputeSize());
|
||||
} else {
|
||||
ASSERT_NE(0, box.ComputeSize());
|
||||
ASSERT_NE(0u, box.ComputeSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -837,7 +837,7 @@ TEST_F(BoxDefinitionsTest, TrackFragmentHeader_NoSampleSize) {
|
|||
|
||||
TrackFragmentHeader tfhd_readback;
|
||||
ASSERT_TRUE(ReadBack(&tfhd_readback));
|
||||
EXPECT_EQ(0, tfhd_readback.default_sample_size);
|
||||
EXPECT_EQ(0u, tfhd_readback.default_sample_size);
|
||||
tfhd.default_sample_size = 0;
|
||||
ASSERT_EQ(tfhd, tfhd_readback);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace mp4 {
|
|||
BoxReader::BoxReader(const uint8* buf, size_t size)
|
||||
: BufferReader(buf, size), type_(FOURCC_NULL), scanned_(false) {
|
||||
DCHECK(buf);
|
||||
DCHECK_LT(0, size);
|
||||
DCHECK_LT(0u, size);
|
||||
}
|
||||
|
||||
BoxReader::~BoxReader() {
|
||||
|
@ -29,7 +29,7 @@ BoxReader::~BoxReader() {
|
|||
|
||||
// static
|
||||
BoxReader* BoxReader::ReadTopLevelBox(const uint8* buf,
|
||||
const int buf_size,
|
||||
const size_t buf_size,
|
||||
bool* err) {
|
||||
scoped_ptr<BoxReader> reader(new BoxReader(buf, buf_size));
|
||||
if (!reader->ReadHeader(err))
|
||||
|
@ -52,7 +52,7 @@ BoxReader* BoxReader::ReadTopLevelBox(const uint8* buf,
|
|||
|
||||
// static
|
||||
bool BoxReader::StartTopLevelBox(const uint8* buf,
|
||||
const int buf_size,
|
||||
const size_t buf_size,
|
||||
FourCC* type,
|
||||
int* box_size,
|
||||
bool* err) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
namespace media {
|
||||
namespace mp4 {
|
||||
|
||||
class Box;
|
||||
struct Box;
|
||||
|
||||
/// Class for reading MP4 boxes.
|
||||
class BoxReader : public BufferReader {
|
||||
|
@ -35,7 +35,7 @@ class BoxReader : public BufferReader {
|
|||
/// available in the buffer. For MDAT box only, a BoxReader object is
|
||||
/// returned as long as the box header is available.
|
||||
static BoxReader* ReadTopLevelBox(const uint8* buf,
|
||||
const int buf_size,
|
||||
const size_t buf_size,
|
||||
bool* err);
|
||||
|
||||
/// Read the box header from the current buffer.
|
||||
|
@ -48,7 +48,7 @@ class BoxReader : public BufferReader {
|
|||
/// @return true if there is enough data to read the header and the header is
|
||||
/// sane, which does not imply that the entire box is in the buffer.
|
||||
static bool StartTopLevelBox(const uint8* buf,
|
||||
const int buf_size,
|
||||
const size_t buf_size,
|
||||
FourCC* type,
|
||||
int* box_size,
|
||||
bool* err) WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -59,7 +59,7 @@ TEST_F(ChunkInfoIteratorTest, EmptyChunkInfo) {
|
|||
SampleToChunk sample_to_chunk;
|
||||
ChunkInfoIterator iterator(sample_to_chunk);
|
||||
EXPECT_FALSE(iterator.IsValid());
|
||||
EXPECT_EQ(0, iterator.LastFirstChunk());
|
||||
EXPECT_EQ(0u, iterator.LastFirstChunk());
|
||||
}
|
||||
|
||||
TEST_F(ChunkInfoIteratorTest, LastFirstChunk) {
|
||||
|
|
|
@ -34,7 +34,7 @@ bool CompositionOffsetIterator::IsValid() const {
|
|||
sample_index_ < iterator_->sample_count;
|
||||
}
|
||||
|
||||
uint32 CompositionOffsetIterator::SampleOffset(uint32 sample) const {
|
||||
int32 CompositionOffsetIterator::SampleOffset(uint32 sample) const {
|
||||
uint32 current_sample = 0;
|
||||
std::vector<CompositionOffset>::const_iterator it =
|
||||
composition_offset_table_.begin();
|
||||
|
|
|
@ -33,10 +33,10 @@ class CompositionOffsetIterator {
|
|||
bool IsValid() const;
|
||||
|
||||
/// @return Sample offset for current sample.
|
||||
uint32 sample_offset() const { return iterator_->sample_offset; }
|
||||
int32 sample_offset() const { return iterator_->sample_offset; }
|
||||
|
||||
/// @return Sample offset @a sample, 1-based.
|
||||
uint32 SampleOffset(uint32 sample) const;
|
||||
int32 SampleOffset(uint32 sample) const;
|
||||
|
||||
/// @return Total number of samples.
|
||||
uint32 NumSamples() const;
|
||||
|
|
|
@ -13,13 +13,12 @@ namespace media {
|
|||
namespace mp4 {
|
||||
|
||||
const CompositionOffset kCompositionOffsets[] =
|
||||
{{10, 8}, {9, 5}, {25, 7}, {48, 63}, {8, 2}};
|
||||
{{10, -8}, {9, 5}, {25, 7}, {48, 63}, {8, 2}};
|
||||
|
||||
class CompositionOffsetIteratorTest : public testing::Test {
|
||||
public:
|
||||
CompositionOffsetIteratorTest() {
|
||||
// Build composition offset table from kCompositionOffsets.
|
||||
uint32 composition_offset = 0;
|
||||
uint32 length = sizeof(kCompositionOffsets) / sizeof(CompositionOffset);
|
||||
for (uint32 i = 0; i < length; ++i) {
|
||||
for (uint32 j = 0; j < kCompositionOffsets[i].sample_count; ++j) {
|
||||
|
@ -35,7 +34,7 @@ class CompositionOffsetIteratorTest : public testing::Test {
|
|||
}
|
||||
|
||||
protected:
|
||||
std::vector<uint32> composition_offset_table_;
|
||||
std::vector<int32> composition_offset_table_;
|
||||
CompositionTimeToSample composition_time_to_sample_;
|
||||
scoped_ptr<CompositionOffsetIterator> composition_offset_iterator_;
|
||||
|
||||
|
@ -47,7 +46,7 @@ TEST_F(CompositionOffsetIteratorTest, EmptyCompositionTime) {
|
|||
CompositionTimeToSample composition_time_to_sample;
|
||||
CompositionOffsetIterator iterator(composition_time_to_sample);
|
||||
EXPECT_FALSE(iterator.IsValid());
|
||||
EXPECT_EQ(0, iterator.NumSamples());
|
||||
EXPECT_EQ(0u, iterator.NumSamples());
|
||||
}
|
||||
|
||||
TEST_F(CompositionOffsetIteratorTest, NumSamples) {
|
||||
|
|
|
@ -47,7 +47,7 @@ TEST_F(DecodingTimeIteratorTest, EmptyDecodingTime) {
|
|||
DecodingTimeToSample decoding_time_to_sample;
|
||||
DecodingTimeIterator iterator(decoding_time_to_sample);
|
||||
EXPECT_FALSE(iterator.IsValid());
|
||||
EXPECT_EQ(0, iterator.NumSamples());
|
||||
EXPECT_EQ(0u, iterator.NumSamples());
|
||||
}
|
||||
|
||||
TEST_F(DecodingTimeIteratorTest, NumSamples) {
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'../..',
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "media/mp4/cenc.h"
|
||||
|
||||
namespace {
|
||||
const uint64 kInvalidTime = kuint64max;
|
||||
const int64 kInvalidTime = kint64max;
|
||||
|
||||
// Optimize sample entries table. If all values in |entries| are identical,
|
||||
// then |entries| is cleared and the value is assigned to |default_value|;
|
||||
|
|
|
@ -21,8 +21,8 @@ class MediaSample;
|
|||
|
||||
namespace mp4 {
|
||||
|
||||
class SegmentReference;
|
||||
class TrackFragment;
|
||||
struct SegmentReference;
|
||||
struct TrackFragment;
|
||||
|
||||
/// MP4Fragmenter is responsible for the generation of MP4 fragments, i.e. traf
|
||||
/// box and corresponding mdat box. The samples are also encrypted if encryption
|
||||
|
@ -46,7 +46,7 @@ class MP4Fragmenter {
|
|||
~MP4Fragmenter();
|
||||
|
||||
/// Add a sample to the fragmenter.
|
||||
virtual Status AddSample(scoped_refptr<MediaSample> sample);
|
||||
Status AddSample(scoped_refptr<MediaSample> sample);
|
||||
|
||||
/// Initialize the fragment with default data.
|
||||
void InitializeFragment();
|
||||
|
@ -91,8 +91,8 @@ class MP4Fragmenter {
|
|||
uint64 fragment_duration_;
|
||||
bool normalize_presentation_timestamp_;
|
||||
int64 presentation_start_time_;
|
||||
uint64 earliest_presentation_time_;
|
||||
uint64 first_sap_time_;
|
||||
int64 earliest_presentation_time_;
|
||||
int64 first_sap_time_;
|
||||
int64 clear_time_;
|
||||
scoped_ptr<BufferWriter> data_;
|
||||
scoped_ptr<BufferWriter> aux_data_;
|
||||
|
|
|
@ -20,10 +20,10 @@ namespace media {
|
|||
|
||||
namespace mp4 {
|
||||
|
||||
struct Movie;
|
||||
class BoxReader;
|
||||
class ProtectionSystemSpecificHeader;
|
||||
class TrackRunIterator;
|
||||
struct Movie;
|
||||
struct ProtectionSystemSpecificHeader;
|
||||
|
||||
class MP4MediaParser : public MediaParser {
|
||||
public:
|
||||
|
|
|
@ -31,10 +31,10 @@ MP4Segmenter::MP4Segmenter(const MuxerOptions& options,
|
|||
scoped_ptr<FileType> ftyp,
|
||||
scoped_ptr<Movie> moov)
|
||||
: options_(options),
|
||||
fragment_buffer_(new BufferWriter()),
|
||||
ftyp_(ftyp.Pass()),
|
||||
moov_(moov.Pass()),
|
||||
moof_(new MovieFragment()),
|
||||
fragment_buffer_(new BufferWriter()),
|
||||
sidx_(new SegmentIndex()),
|
||||
segment_initialized_(false),
|
||||
end_of_segment_(false) {}
|
||||
|
@ -44,7 +44,7 @@ MP4Segmenter::~MP4Segmenter() { STLDeleteElements(&fragmenters_); }
|
|||
Status MP4Segmenter::Initialize(EncryptorSource* encryptor_source,
|
||||
double clear_lead_in_seconds,
|
||||
const std::vector<MediaStream*>& streams) {
|
||||
DCHECK_LT(0, streams.size());
|
||||
DCHECK_LT(0u, streams.size());
|
||||
moof_->header.sequence_number = 0;
|
||||
|
||||
moof_->tracks.resize(streams.size());
|
||||
|
|
|
@ -172,7 +172,6 @@ bool TrackRunIterator::Init() {
|
|||
trak->media.information.sample_table.chunk_large_offset.offsets;
|
||||
|
||||
int64 run_start_dts = 0;
|
||||
int64 run_data_offset = 0;
|
||||
|
||||
uint32 num_samples = sample_size.sample_count;
|
||||
uint32 num_chunks = chunk_offset_vector.size();
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'../..',
|
||||
|
|
|
@ -206,7 +206,7 @@ TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentEncrypted) {
|
|||
// Expect the output to be encrypted.
|
||||
Demuxer demuxer(GetFullPath(kOutputVideo), decryptor_source_);
|
||||
ASSERT_OK(demuxer.Initialize());
|
||||
ASSERT_EQ(1, demuxer.streams().size());
|
||||
ASSERT_EQ(1u, demuxer.streams().size());
|
||||
EXPECT_TRUE(demuxer.streams()[0]->info()->is_encrypted());
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ TEST_P(PackagerTest, MP4MuxerMultipleSegmentsUnencrypted) {
|
|||
ASSERT_TRUE(base::ReadFileToString(segment_path, &segment_content));
|
||||
int bytes_written = file_util::AppendToFile(
|
||||
output_path, segment_content.data(), segment_content.size());
|
||||
ASSERT_EQ(segment_content.size(), bytes_written);
|
||||
ASSERT_EQ(segment_content.size(), static_cast<size_t>(bytes_written));
|
||||
|
||||
++segment_index;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ TEST_F(StaticMpdBuilderTest, Video) {
|
|||
|
||||
Representation* video_representation =
|
||||
video_adaptation_set->AddRepresentation(video_media_info);
|
||||
ASSERT_TRUE(video_adaptation_set);
|
||||
ASSERT_TRUE(video_representation);
|
||||
|
||||
EXPECT_NO_FATAL_FAILURE(CheckMpd(kFileNameExpectedMpdOutputVideo1));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ TEST_F(StaticMpdBuilderTest, VideoAndAudio) {
|
|||
|
||||
Representation* video_representation =
|
||||
video_adaptation_set->AddRepresentation(video_media_info);
|
||||
ASSERT_TRUE(video_adaptation_set);
|
||||
ASSERT_TRUE(video_representation);
|
||||
|
||||
EXPECT_NO_FATAL_FAILURE(CheckMpd(kFileNameExpectedMpdOutputAudio1AndVideo1));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace dash_packager {
|
||||
|
||||
class ContentProtectionElement;
|
||||
struct ContentProtectionElement;
|
||||
|
||||
bool HasVODOnlyFields(const MediaInfo& media_info);
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ bool XmlNode::AddChild(ScopedXmlPtr<xmlNode>::type child) {
|
|||
|
||||
// Reaching here means the ownership of |child| transfered to |node_|.
|
||||
// Release the pointer so that it doesn't get destructed in this scope.
|
||||
child.release();
|
||||
ignore_result(child.release());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
# GYP file for any MPD generation targets.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'..',
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Compile as chromium code to enable warnings and warnings-as-errors.
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'target_defaults': {
|
||||
'include_dirs': [
|
||||
'.',
|
||||
|
|
Loading…
Reference in New Issue