Fix various misc build issues in Windows
This is part of the effort to get edash_packager builds on Windows. Change-Id: I1339f8f41a30ad3d5808ab19276d46ee902065e2
This commit is contained in:
parent
d3c3a5573b
commit
7cac9da421
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "packager/media/base/bit_reader.h"
|
#include "packager/media/base/bit_reader.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace edash_packager {
|
namespace edash_packager {
|
||||||
namespace media {
|
namespace media {
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,19 @@
|
||||||
'local_file.h',
|
'local_file.h',
|
||||||
'threaded_io_file.cc',
|
'threaded_io_file.cc',
|
||||||
'threaded_io_file.h',
|
'threaded_io_file.h',
|
||||||
'udp_file.cc',
|
|
||||||
'udp_file.h',
|
'udp_file.h',
|
||||||
],
|
],
|
||||||
|
'conditions': [
|
||||||
|
['OS == "win"', {
|
||||||
|
'sources': [
|
||||||
|
'udp_file_win.cc',
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
'sources': [
|
||||||
|
'udp_file_posix.cc',
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
],
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'../../base/base.gyp:base',
|
'../../base/base.gyp:base',
|
||||||
'../../third_party/gflags/gflags.gyp:gflags',
|
'../../third_party/gflags/gflags.gyp:gflags',
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
// Copyright 2015 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file or at
|
||||||
|
// https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
|
#include "packager/media/file/udp_file.h"
|
||||||
|
|
||||||
|
#include "packager/base/logging.h"
|
||||||
|
|
||||||
|
namespace edash_packager {
|
||||||
|
namespace media {
|
||||||
|
|
||||||
|
UdpFile::UdpFile(const char* file_name) : File(file_name), socket_(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
UdpFile::~UdpFile() {}
|
||||||
|
|
||||||
|
bool UdpFile::Close() {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
delete this;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t UdpFile::Read(void* buffer, uint64_t length) {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t UdpFile::Write(const void* buffer, uint64_t length) {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t UdpFile::Size() {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UdpFile::Flush() {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UdpFile::Open() {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace media
|
||||||
|
} // namespace edash_packager
|
|
@ -49,7 +49,7 @@ bool AdtsHeader::Parse(const uint8_t* adts_frame, size_t adts_frame_size) {
|
||||||
// Skip MPEG version and layer.
|
// Skip MPEG version and layer.
|
||||||
RCHECK(frame.SkipBits(3));
|
RCHECK(frame.SkipBits(3));
|
||||||
// Get "protection absent" flag.
|
// Get "protection absent" flag.
|
||||||
bool protection_absent;
|
uint8_t protection_absent;
|
||||||
RCHECK(frame.ReadBits(1, &protection_absent));
|
RCHECK(frame.ReadBits(1, &protection_absent));
|
||||||
// Get profile.
|
// Get profile.
|
||||||
RCHECK(frame.ReadBits(2, &profile_));
|
RCHECK(frame.ReadBits(2, &profile_));
|
||||||
|
|
|
@ -145,9 +145,8 @@ TEST_F(Mp2tMediaParserTest, TimestampWrapAround) {
|
||||||
ParseMpeg2TsFile("bear-1280x720_ptswraparound.ts", 512);
|
ParseMpeg2TsFile("bear-1280x720_ptswraparound.ts", 512);
|
||||||
parser_->Flush();
|
parser_->Flush();
|
||||||
EXPECT_EQ(video_frame_count_, 82);
|
EXPECT_EQ(video_frame_count_, 82);
|
||||||
EXPECT_GE(video_min_dts_, (95443 - 1) * kMpeg2Timescale);
|
EXPECT_GE(video_min_dts_, static_cast<int64_t>(95443 - 1) * kMpeg2Timescale);
|
||||||
EXPECT_LE(video_max_dts_,
|
EXPECT_LE(video_max_dts_, static_cast<int64_t>(95443 + 4) * kMpeg2Timescale);
|
||||||
static_cast<int64_t>((95443 + 4)) * kMpeg2Timescale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mp2t
|
} // namespace mp2t
|
||||||
|
|
|
@ -248,7 +248,7 @@ void MP4Muxer::FireOnMediaStartEvent() {
|
||||||
stream_info_vec,
|
stream_info_vec,
|
||||||
timescale,
|
timescale,
|
||||||
event::MuxerListener::kContainerMp4,
|
event::MuxerListener::kContainerMp4,
|
||||||
encryption_key_source());
|
encryption_key_source() != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MP4Muxer::FireOnMediaEndEvent() {
|
void MP4Muxer::FireOnMediaEndEvent() {
|
||||||
|
|
|
@ -336,7 +336,7 @@ Status Segmenter::FinalizeFragment(Fragmenter* fragmenter) {
|
||||||
// Fill in data offsets. Data offset base is moof size + mdat box size.
|
// Fill in data offsets. Data offset base is moof size + mdat box size.
|
||||||
// (mdat is still empty, mdat size is the same as mdat box size).
|
// (mdat is still empty, mdat size is the same as mdat box size).
|
||||||
uint64_t base = moof_->ComputeSize() + mdat.ComputeSize();
|
uint64_t base = moof_->ComputeSize() + mdat.ComputeSize();
|
||||||
for (uint i = 0; i < moof_->tracks.size(); ++i) {
|
for (size_t i = 0; i < moof_->tracks.size(); ++i) {
|
||||||
TrackFragment& traf = moof_->tracks[i];
|
TrackFragment& traf = moof_->tracks[i];
|
||||||
Fragmenter* fragmenter = fragmenters_[i];
|
Fragmenter* fragmenter = fragmenters_[i];
|
||||||
if (fragmenter->aux_data()->Size() > 0) {
|
if (fragmenter->aux_data()->Size() > 0) {
|
||||||
|
@ -356,7 +356,7 @@ Status Segmenter::FinalizeFragment(Fragmenter* fragmenter) {
|
||||||
// Write the fragment to buffer.
|
// Write the fragment to buffer.
|
||||||
moof_->Write(fragment_buffer_.get());
|
moof_->Write(fragment_buffer_.get());
|
||||||
|
|
||||||
for (uint i = 0; i < moof_->tracks.size(); ++i) {
|
for (size_t i = 0; i < moof_->tracks.size(); ++i) {
|
||||||
Fragmenter* fragmenter = fragmenters_[i];
|
Fragmenter* fragmenter = fragmenters_[i];
|
||||||
mdat.data_size =
|
mdat.data_size =
|
||||||
fragmenter->aux_data()->Size() + fragmenter->data()->Size();
|
fragmenter->aux_data()->Size() + fragmenter->data()->Size();
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
#include "packager/media/formats/mp4/single_segment_segmenter.h"
|
#include "packager/media/formats/mp4/single_segment_segmenter.h"
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/file_util.h"
|
||||||
#include "packager/base/strings/stringprintf.h"
|
#include "packager/base/strings/stringprintf.h"
|
||||||
|
#include "packager/base/threading/platform_thread.h"
|
||||||
#include "packager/base/time/time.h"
|
#include "packager/base/time/time.h"
|
||||||
#include "packager/media/base/buffer_writer.h"
|
#include "packager/media/base/buffer_writer.h"
|
||||||
#include "packager/media/base/media_stream.h"
|
#include "packager/media/base/media_stream.h"
|
||||||
|
@ -24,10 +27,14 @@ namespace mp4 {
|
||||||
namespace {
|
namespace {
|
||||||
// Create a temp file name using process/thread id and current time.
|
// Create a temp file name using process/thread id and current time.
|
||||||
std::string TempFileName() {
|
std::string TempFileName() {
|
||||||
int32_t tid = static_cast<int32_t>(pthread_self());
|
int32_t tid = static_cast<int32_t>(base::PlatformThread::CurrentId());
|
||||||
int32_t pid = static_cast<int32_t>(getpid());
|
int64_t rand = 0;
|
||||||
int64_t now = base::Time::Now().ToInternalValue();
|
if (RAND_bytes(reinterpret_cast<uint8_t*>(&rand), sizeof(rand)) != 1) {
|
||||||
return base::StringPrintf("packager-tempfile-%x-%d-%" PRIx64, tid, pid, now);
|
LOG(WARNING) << "RAND_bytes failed with error: "
|
||||||
|
<< ERR_error_string(ERR_get_error(), NULL);
|
||||||
|
rand = base::Time::Now().ToInternalValue();
|
||||||
|
}
|
||||||
|
return base::StringPrintf("packager-tempfile-%x-%" PRIx64, tid, rand);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue