Fix various errors discovered during integration
Change-Id: I927ba02bbe99bf6e6c9877968a4554ad949cf07f
This commit is contained in:
parent
6a1805129d
commit
8ffb41df76
|
@ -10,6 +10,7 @@
|
|||
#include "packager/base/strings/stringprintf.h"
|
||||
#include "packager/mpd/util/mpd_writer.h"
|
||||
|
||||
namespace edash_packager {
|
||||
namespace {
|
||||
const char kUsage[] =
|
||||
"MPD generation driver program.\n"
|
||||
|
@ -53,7 +54,6 @@ ExitStatus RunMpdGenerator() {
|
|||
|
||||
base::SplitString(FLAGS_input, ',', &input_files);
|
||||
|
||||
|
||||
if (!FLAGS_base_urls.empty()) {
|
||||
base::SplitString(FLAGS_base_urls, ',', &base_urls);
|
||||
}
|
||||
|
@ -76,9 +76,7 @@ ExitStatus RunMpdGenerator() {
|
|||
return kSuccess;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int MpdMain(int argc, char** argv) {
|
||||
google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
|
@ -90,3 +88,10 @@ int main(int argc, char** argv) {
|
|||
|
||||
return RunMpdGenerator();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace edash_packager
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return edash_packager::MpdMain(argc, argv);
|
||||
}
|
||||
|
|
|
@ -281,10 +281,7 @@ bool RunPackager(const StreamDescriptorList& stream_descriptors) {
|
|||
return true;
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
} // namespace edash_packager
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int PackagerMain(int argc, char** argv) {
|
||||
google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
if (argc < 2) {
|
||||
|
@ -298,10 +295,17 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
// TODO(tinskip): Make InsertStreamDescriptor a member of
|
||||
// StreamDescriptorList.
|
||||
edash_packager::media::StreamDescriptorList stream_descriptors;
|
||||
StreamDescriptorList stream_descriptors;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!InsertStreamDescriptor(argv[i], &stream_descriptors))
|
||||
return 1;
|
||||
}
|
||||
return edash_packager::media::RunPackager(stream_descriptors) ? 0 : 1;
|
||||
return RunPackager(stream_descriptors) ? 0 : 1;
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
} // namespace edash_packager
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return edash_packager::media::PackagerMain(argc, argv);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,9 @@ TEST_F(ClosureThreadTest, NotJoined) {
|
|||
}
|
||||
|
||||
// Expect death if the thread is destroyed without being started.
|
||||
TEST_F(ClosureThreadTest, NotStarted) {
|
||||
// Note: This test is disabled since it causes memory leak in Debug mode as the
|
||||
// thread object cannot be cleaned up due to the expected death.
|
||||
TEST_F(ClosureThreadTest, DISABLED_NotStarted) {
|
||||
ASSERT_FALSE(thread_->HasBeenStarted());
|
||||
ClosureThread* thread = thread_.release();
|
||||
EXPECT_DEBUG_DEATH(delete thread, ".*Check failed: HasBeenStarted.*");
|
||||
|
|
|
@ -112,6 +112,7 @@ void TestFile(MediaContainerName expected, const base::FilePath& filename) {
|
|||
if (base::GetFileSize(filename, &actual_size) && actual_size < read_size)
|
||||
read_size = actual_size;
|
||||
int read = base::ReadFile(filename, buffer, read_size);
|
||||
ASSERT_GT(read, 0) << filename.value();
|
||||
|
||||
// Now verify the type.
|
||||
EXPECT_EQ(expected,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "packager/media/base/producer_consumer_queue.h"
|
||||
#include "packager/media/base/status_test_util.h"
|
||||
|
||||
namespace edash_packager {
|
||||
namespace {
|
||||
const size_t kCapacity = 10u;
|
||||
const int64_t kTimeout = 100; // 0.1s.
|
||||
|
@ -26,7 +27,6 @@ bool CheckTimeApproxEqual(int64_t time_in_milliseconds,
|
|||
|
||||
} // namespace
|
||||
|
||||
namespace edash_packager {
|
||||
namespace media {
|
||||
|
||||
TEST(ProducerConsumerQueueTest, CheckEmpty) {
|
||||
|
|
|
@ -162,6 +162,7 @@ WidevineKeySource::~WidevineKeySource() {
|
|||
start_key_production_.Signal();
|
||||
key_production_thread_.Join();
|
||||
}
|
||||
STLDeleteValues(&encryption_key_map_);
|
||||
}
|
||||
|
||||
Status WidevineKeySource::FetchKeys(const std::vector<uint8_t>& content_id,
|
||||
|
|
|
@ -15,6 +15,14 @@
|
|||
#include "packager/media/base/status_test_util.h"
|
||||
#include "packager/media/base/widevine_key_source.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::DoAll;
|
||||
using ::testing::InSequence;
|
||||
using ::testing::Return;
|
||||
using ::testing::SetArgPointee;
|
||||
using ::testing::StrEq;
|
||||
|
||||
namespace edash_packager {
|
||||
namespace {
|
||||
const char kServerUrl[] = "http://www.foo.com/getcontentkey";
|
||||
const char kContentId[] = "ContentFoo";
|
||||
|
@ -106,13 +114,6 @@ std::string GetPsshDataFromPsshBox(const std::string& pssh_box) {
|
|||
|
||||
} // namespace
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::DoAll;
|
||||
using ::testing::InSequence;
|
||||
using ::testing::Return;
|
||||
using ::testing::SetArgPointee;
|
||||
|
||||
namespace edash_packager {
|
||||
namespace media {
|
||||
|
||||
class MockRequestSigner : public RequestSigner {
|
||||
|
@ -223,7 +224,8 @@ TEST_F(WidevineKeySourceTest, HttpPostFailure) {
|
|||
Base64Encode(kMockSignature).c_str(),
|
||||
kSignerName);
|
||||
const Status kMockStatus = Status::UNKNOWN;
|
||||
EXPECT_CALL(*mock_http_fetcher_, Post(kServerUrl, expected_post_data, _))
|
||||
EXPECT_CALL(*mock_http_fetcher_,
|
||||
Post(StrEq(kServerUrl), expected_post_data, _))
|
||||
.WillOnce(Return(kMockStatus));
|
||||
|
||||
CreateWidevineKeySource();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
# Depends on full protobuf to read/write with TextFormat.
|
||||
'../../third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use',
|
||||
'../base/media_base.gyp:base',
|
||||
'../file/file.gyp:file',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -41,7 +42,6 @@
|
|||
'../../testing/gtest.gyp:gtest_main',
|
||||
# Depends on full protobuf to read/write with TextFormat.
|
||||
'../../third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use',
|
||||
'../file/file.gyp:file',
|
||||
'media_event',
|
||||
],
|
||||
},
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "packager/media/filters/h264_parser.h"
|
||||
|
||||
#include "packager/base/logging.h"
|
||||
#include "packager/base/memory/scoped_ptr.h"
|
||||
#include "packager/base/stl_util.h"
|
||||
|
||||
#include "packager/media/filters/h264_parser.h"
|
||||
|
||||
namespace edash_packager {
|
||||
namespace media {
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/base/compiler_specific.h"
|
||||
#include "packager/base/logging.h"
|
||||
#include "packager/base/strings/string_number_conversions.h"
|
||||
#include "packager/media/formats/mp2t/adts_header.h"
|
||||
|
|
|
@ -48,14 +48,14 @@ class BoxDefinitionsTestGeneral : public testing::Test {
|
|||
}
|
||||
|
||||
bool ReadBack(Box* box) {
|
||||
BoxReader* reader = CreateReader();
|
||||
scoped_ptr<BoxReader> reader(CreateReader());
|
||||
RCHECK(reader->ScanChildren() && reader->ReadChild(box));
|
||||
return true;
|
||||
}
|
||||
|
||||
// FourCC for VideoSampleEntry is not a constant, e.g. could be avc1, or encv.
|
||||
bool ReadBack(VideoSampleEntry* video) {
|
||||
BoxReader* reader = CreateReader();
|
||||
scoped_ptr<BoxReader> reader(CreateReader());
|
||||
std::vector<VideoSampleEntry> video_entries;
|
||||
RCHECK(reader->ReadAllChildren(&video_entries));
|
||||
RCHECK(video_entries.size() == 1);
|
||||
|
@ -65,7 +65,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
|
|||
|
||||
// FourCC for AudioSampleEntry is not a constant, e.g. could be mp4a, or enca.
|
||||
bool ReadBack(AudioSampleEntry* audio) {
|
||||
BoxReader* reader = CreateReader();
|
||||
scoped_ptr<BoxReader> reader(CreateReader());
|
||||
std::vector<AudioSampleEntry> audio_entries;
|
||||
RCHECK(reader->ReadAllChildren(&audio_entries));
|
||||
RCHECK(audio_entries.size() == 1);
|
||||
|
@ -77,7 +77,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
|
|||
// be preset before scanning the box.
|
||||
bool ReadBack(SampleDescription* stsd) {
|
||||
stsd->type = kSampleDescriptionTrackType;
|
||||
BoxReader* reader = CreateReader();
|
||||
scoped_ptr<BoxReader> reader(CreateReader());
|
||||
RCHECK(reader->ScanChildren() && reader->ReadChild(stsd));
|
||||
return true;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
|
|||
// SampleTable contains SampleDescription, which cannot parse on its own.
|
||||
bool ReadBack(SampleTable* stbl) {
|
||||
stbl->description.type = kSampleDescriptionTrackType;
|
||||
BoxReader* reader = CreateReader();
|
||||
scoped_ptr<BoxReader> reader(CreateReader());
|
||||
RCHECK(reader->ScanChildren() && reader->ReadChild(stbl));
|
||||
return true;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
|
|||
// MediaInformation contains SampleDescription, which cannot parse on its own.
|
||||
bool ReadBack(MediaInformation* minf) {
|
||||
minf->sample_table.description.type = kSampleDescriptionTrackType;
|
||||
BoxReader* reader = CreateReader();
|
||||
scoped_ptr<BoxReader> reader(CreateReader());
|
||||
RCHECK(reader->ScanChildren() && reader->ReadChild(minf));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
'box_definitions.h',
|
||||
'box_reader.cc',
|
||||
'box_reader.h',
|
||||
'box_writer.h',
|
||||
'cenc.cc',
|
||||
'cenc.h',
|
||||
'chunk_info_iterator.cc',
|
||||
|
|
|
@ -97,11 +97,9 @@ WvmMediaParser::WvmMediaParser() : is_initialized_(false),
|
|||
pts_(0),
|
||||
dts_(0),
|
||||
index_program_id_(0),
|
||||
sha_context_(new SHA256_CTX()),
|
||||
media_sample_(NULL),
|
||||
stream_id_count_(0),
|
||||
decryption_key_source_(NULL) {
|
||||
SHA256_Init(sha_context_);
|
||||
}
|
||||
|
||||
WvmMediaParser::~WvmMediaParser() {}
|
||||
|
@ -540,11 +538,6 @@ bool WvmMediaParser::ParseIndexEntry() {
|
|||
if (index_data_.size() < kIndexVersion4HeaderSize) {
|
||||
return false;
|
||||
}
|
||||
if (sha_context_ != NULL) {
|
||||
if (SHA256_Update(sha_context_, &index_data_[0], index_data_.size()) != 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t* read_ptr_index = &index_data_[0];
|
||||
if (ntohlFromBuffer(read_ptr_index) != kIndexMagic) {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#ifndef MEDIA_FORMATS_WVM_WVM_MEDIA_PARSER_H_
|
||||
#define MEDIA_FORMATS_WVM_WVM_MEDIA_PARSER_H_
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -237,7 +235,6 @@ class WvmMediaParser : public MediaParser {
|
|||
uint64_t pts_;
|
||||
uint64_t dts_;
|
||||
uint8_t index_program_id_;
|
||||
SHA256_CTX* sha_context_;
|
||||
scoped_refptr<MediaSample> media_sample_;
|
||||
PrevSampleData prev_media_sample_data_;
|
||||
H264ByteToUnitStreamConverter byte_to_unit_stream_converter_;
|
||||
|
|
|
@ -161,13 +161,13 @@ bool PopulateSegmentTimeline(const std::list<SegmentInfo>& segment_infos,
|
|||
for (std::list<SegmentInfo>::const_iterator it = segment_infos.begin();
|
||||
it != segment_infos.end();
|
||||
++it) {
|
||||
XmlNode* s_element = new XmlNode("S");
|
||||
s_element->SetIntegerAttribute("t", it->start_time);
|
||||
s_element->SetIntegerAttribute("d", it->duration);
|
||||
XmlNode s_element("S");
|
||||
s_element.SetIntegerAttribute("t", it->start_time);
|
||||
s_element.SetIntegerAttribute("d", it->duration);
|
||||
if (it->repeat > 0)
|
||||
s_element->SetIntegerAttribute("r", it->repeat);
|
||||
s_element.SetIntegerAttribute("r", it->repeat);
|
||||
|
||||
CHECK(segment_timeline->AddChild(s_element->PassScopedPtr()));
|
||||
CHECK(segment_timeline->AddChild(s_element.PassScopedPtr()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
'targets': [
|
||||
{
|
||||
'target_name': 'media_info_proto',
|
||||
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'base/media_info.proto',
|
||||
|
|
|
@ -45,7 +45,7 @@ base::FilePath GetSchemaPath() {
|
|||
std::string GetPathContent(const base::FilePath& file_path) {
|
||||
std::string content;
|
||||
bool file_read_to_string = base::ReadFileToString(file_path, &content);
|
||||
DCHECK(file_read_to_string);
|
||||
DCHECK(file_read_to_string) << file_path.value();
|
||||
return content;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
}
|
||||
#include "packager/base/files/file_path.h"
|
||||
|
||||
namespace edash_packager {
|
||||
|
||||
|
|
Loading…
Reference in New Issue