roll libwebm snapshot
git log --no-merges --oneline 9732ae9..a97c484 9096786 mkvparser: fix float conversion warning 84e8257 disable -Wdeprecated-declarations in legacy code a98f495 AddGenericFrame: fix memory leak on failure da131dd AddCuePoint: fix memory leak on failure b0cea9c Add(Audio|Video)Track: fix memory leak on failure 5261a67 webm_info: check vp9 ParseUncompressedHeader return 85f7e2e webm_info,PrintVP9Info: validate alt ref sizes 9b97ca1 vp9_header_parser_tests: check parser return 300d6d8 CuePoint::Find: check Track pointer 50c44bb webm_info,OutputCues: fix indexing of tracks a0d27f0 mkvparser,Block::Parse: remove incorrect assert 784fc1b vttdemux,CloseFiles: check file pointer before closing b4522c1 .gitattributes: force mkv/webm to be treated as binary a118f3d Add test for projection parse failures. d398479 Add test for primary chromaticity parse failures. 9bbec4c Fix permissions on test file. 2cef4d5 mkvparser:Parse: s/FLT_MIN/-FLT_MAX/ 35a3c88 mkvmuxer: Turn off estimate_file_duration_ by default 5a41830 mkvparser: Avoid double free when Chromaticity parse fails. 67e3ffa mkvparser: Avoid casts of values too large for float in Projection elements. 87bcddf vttdemux::ChapterAtomParser: check for NULL display string a534a24 Update .gitignore a0d67d0 mkvmuxer: Fix hard-coded data size in EbmlElementSize c36112c mkvparser: #include sys/type.h 686664e Fix cmake generation warnings on Windows. 2b2c196 cmake: Fix required flag check. 166e40f Cmake refactor. 9fb774a Add missing include in webm2pes.cc. 4956b2d mkvmuxer: Force new clusters when audio queue gets too long. 54f1559 cmake: Cache results of CXX flag tests. 81c73fc mkvparser: Avoid alloc failures in SeekHead::Parse. Change-Id: Ib81b1772ec81e7af3852dcfef2d312416f6db53d
This commit is contained in:
parent
ec4afbf74a
commit
f749905d0a
2
third_party/libwebm/README.libvpx
vendored
2
third_party/libwebm/README.libvpx
vendored
@ -1,5 +1,5 @@
|
||||
URL: https://chromium.googlesource.com/webm/libwebm
|
||||
Version: 9732ae991efb71aced4267d4794918279e362d99
|
||||
Version: a97c484bfd6b5de4b1b61efe33089b55d810b412
|
||||
License: BSD
|
||||
License File: LICENSE.txt
|
||||
|
||||
|
8
third_party/libwebm/common/hdr_util.h
vendored
8
third_party/libwebm/common/hdr_util.h
vendored
@ -47,7 +47,15 @@ struct Vp9CodecFeatures {
|
||||
int chroma_subsampling;
|
||||
};
|
||||
|
||||
// disable deprecation warnings for auto_ptr
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
typedef std::auto_ptr<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr;
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc,
|
||||
PrimaryChromaticityPtr* muxer_pc);
|
||||
|
46
third_party/libwebm/mkvmuxer/mkvmuxer.cc
vendored
46
third_party/libwebm/mkvmuxer/mkvmuxer.cc
vendored
@ -24,6 +24,11 @@
|
||||
#include "mkvmuxer/mkvwriter.h"
|
||||
#include "mkvparser/mkvparser.h"
|
||||
|
||||
// disable deprecation warnings for auto_ptr
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
namespace mkvmuxer {
|
||||
|
||||
const float PrimaryChromaticity::kChromaticityMin = 0.0f;
|
||||
@ -3053,7 +3058,7 @@ Segment::Segment()
|
||||
output_cues_(true),
|
||||
accurate_cluster_duration_(false),
|
||||
fixed_size_cluster_timecode_(false),
|
||||
estimate_file_duration_(true),
|
||||
estimate_file_duration_(false),
|
||||
payload_pos_(0),
|
||||
size_position_(0),
|
||||
doc_type_version_(kDefaultDocTypeVersion),
|
||||
@ -3361,7 +3366,10 @@ uint64_t Segment::AddVideoTrack(int32_t width, int32_t height, int32_t number) {
|
||||
track->set_width(width);
|
||||
track->set_height(height);
|
||||
|
||||
tracks_.AddTrack(track, number);
|
||||
if (!tracks_.AddTrack(track, number)) {
|
||||
delete track;
|
||||
return 0;
|
||||
}
|
||||
has_video_ = true;
|
||||
|
||||
return track->number();
|
||||
@ -3383,8 +3391,10 @@ bool Segment::AddCuePoint(uint64_t timestamp, uint64_t track) {
|
||||
cue->set_block_number(cluster->blocks_added());
|
||||
cue->set_cluster_pos(cluster->position_for_cues());
|
||||
cue->set_track(track);
|
||||
if (!cues_.AddCue(cue))
|
||||
if (!cues_.AddCue(cue)) {
|
||||
delete cue;
|
||||
return false;
|
||||
}
|
||||
|
||||
new_cuepoint_ = false;
|
||||
return true;
|
||||
@ -3401,7 +3411,10 @@ uint64_t Segment::AddAudioTrack(int32_t sample_rate, int32_t channels,
|
||||
track->set_sample_rate(sample_rate);
|
||||
track->set_channels(channels);
|
||||
|
||||
tracks_.AddTrack(track, number);
|
||||
if (!tracks_.AddTrack(track, number)) {
|
||||
delete track;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return track->number();
|
||||
}
|
||||
@ -3490,16 +3503,33 @@ bool Segment::AddGenericFrame(const Frame* frame) {
|
||||
if (frame->discard_padding() != 0)
|
||||
doc_type_version_ = 4;
|
||||
|
||||
if (cluster_list_size_ > 0) {
|
||||
const uint64_t timecode_scale = segment_info_.timecode_scale();
|
||||
const uint64_t frame_timecode = frame->timestamp() / timecode_scale;
|
||||
|
||||
const Cluster* const last_cluster = cluster_list_[cluster_list_size_ - 1];
|
||||
const uint64_t last_cluster_timecode = last_cluster->timecode();
|
||||
|
||||
const uint64_t rel_timecode = frame_timecode - last_cluster_timecode;
|
||||
if (rel_timecode > kMaxBlockTimecode) {
|
||||
force_new_cluster_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If the segment has a video track hold onto audio frames to make sure the
|
||||
// audio that is associated with the start time of a video key-frame is
|
||||
// muxed into the same cluster.
|
||||
if (has_video_ && tracks_.TrackIsAudio(frame->track_number()) &&
|
||||
!force_new_cluster_) {
|
||||
Frame* const new_frame = new (std::nothrow) Frame();
|
||||
if (!new_frame || !new_frame->CopyFrom(*frame))
|
||||
if (!new_frame || !new_frame->CopyFrom(*frame)) {
|
||||
delete new_frame;
|
||||
return false;
|
||||
if (!QueueFrame(new_frame))
|
||||
}
|
||||
if (!QueueFrame(new_frame)) {
|
||||
delete new_frame;
|
||||
return false;
|
||||
}
|
||||
track_frames_written_[frame->track_number() - 1]++;
|
||||
return true;
|
||||
}
|
||||
@ -3522,8 +3552,10 @@ bool Segment::AddGenericFrame(const Frame* frame) {
|
||||
if (!frame->CanBeSimpleBlock() && !frame->is_key() &&
|
||||
!frame->reference_block_timestamp_set()) {
|
||||
Frame* const new_frame = new (std::nothrow) Frame();
|
||||
if (!new_frame->CopyFrom(*frame))
|
||||
if (!new_frame || !new_frame->CopyFrom(*frame)) {
|
||||
delete new_frame;
|
||||
return false;
|
||||
}
|
||||
new_frame->set_reference_block_timestamp(
|
||||
last_track_timestamp_[frame->track_number() - 1]);
|
||||
frame = new_frame;
|
||||
|
2
third_party/libwebm/mkvmuxer/mkvmuxerutil.cc
vendored
2
third_party/libwebm/mkvmuxer/mkvmuxerutil.cc
vendored
@ -288,7 +288,7 @@ uint64 EbmlElementSize(uint64 type, const char* value) {
|
||||
ebml_size += strlen(value);
|
||||
|
||||
// Size of Datasize
|
||||
ebml_size++;
|
||||
ebml_size += GetCodedUIntSize(strlen(value));
|
||||
|
||||
return ebml_size;
|
||||
}
|
||||
|
2
third_party/libwebm/mkvmuxer/mkvwriter.cc
vendored
2
third_party/libwebm/mkvmuxer/mkvwriter.cc
vendored
@ -8,6 +8,8 @@
|
||||
|
||||
#include "mkvmuxer/mkvwriter.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <share.h> // for _SH_DENYWR
|
||||
#endif
|
||||
|
62
third_party/libwebm/mkvparser/mkvparser.cc
vendored
62
third_party/libwebm/mkvparser/mkvparser.cc
vendored
@ -22,6 +22,11 @@
|
||||
|
||||
#include "common/webmids.h"
|
||||
|
||||
// disable deprecation warnings for auto_ptr
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
namespace mkvparser {
|
||||
const float MasteringMetadata::kValueNotPresent = FLT_MAX;
|
||||
const long long Colour::kValueNotPresent = LLONG_MAX;
|
||||
@ -1528,15 +1533,19 @@ long SeekHead::Parse() {
|
||||
if (pos != stop)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
m_entries = new (std::nothrow) Entry[entry_count];
|
||||
if (entry_count > 0) {
|
||||
m_entries = new (std::nothrow) Entry[entry_count];
|
||||
|
||||
if (m_entries == NULL)
|
||||
return -1;
|
||||
if (m_entries == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_void_elements = new (std::nothrow) VoidElement[void_element_count];
|
||||
if (void_element_count > 0) {
|
||||
m_void_elements = new (std::nothrow) VoidElement[void_element_count];
|
||||
|
||||
if (m_void_elements == NULL)
|
||||
return -1;
|
||||
if (m_void_elements == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// now parse the entries and void elements
|
||||
|
||||
@ -1555,14 +1564,14 @@ long SeekHead::Parse() {
|
||||
if (status < 0) // error
|
||||
return status;
|
||||
|
||||
if (id == libwebm::kMkvSeek) {
|
||||
if (id == libwebm::kMkvSeek && entry_count > 0) {
|
||||
if (ParseEntry(pReader, pos, size, pEntry)) {
|
||||
Entry& e = *pEntry++;
|
||||
|
||||
e.element_start = idpos;
|
||||
e.element_size = (pos + size) - idpos;
|
||||
}
|
||||
} else if (id == libwebm::kMkvVoid) {
|
||||
} else if (id == libwebm::kMkvVoid && void_element_count > 0) {
|
||||
VoidElement& e = *pVoidElement++;
|
||||
|
||||
e.element_start = idpos;
|
||||
@ -2426,7 +2435,9 @@ bool CuePoint::TrackPosition::Parse(IMkvReader* pReader, long long start_,
|
||||
}
|
||||
|
||||
const CuePoint::TrackPosition* CuePoint::Find(const Track* pTrack) const {
|
||||
assert(pTrack);
|
||||
if (pTrack == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const long long n = pTrack->GetNumber();
|
||||
|
||||
@ -4026,7 +4037,7 @@ long SegmentInfo::Parse() {
|
||||
}
|
||||
|
||||
const double rollover_check = m_duration * m_timecodeScale;
|
||||
if (rollover_check > LLONG_MAX)
|
||||
if (rollover_check > static_cast<double>(LLONG_MAX))
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
if (pos != stop)
|
||||
@ -4975,29 +4986,27 @@ bool PrimaryChromaticity::Parse(IMkvReader* reader, long long read_pos,
|
||||
if (!reader)
|
||||
return false;
|
||||
|
||||
std::auto_ptr<PrimaryChromaticity> chromaticity_ptr;
|
||||
if (!*chromaticity)
|
||||
*chromaticity = new PrimaryChromaticity();
|
||||
|
||||
if (!*chromaticity) {
|
||||
chromaticity_ptr.reset(new PrimaryChromaticity());
|
||||
} else {
|
||||
chromaticity_ptr.reset(*chromaticity);
|
||||
}
|
||||
|
||||
if (!chromaticity_ptr.get())
|
||||
if (!*chromaticity)
|
||||
return false;
|
||||
|
||||
float* value = is_x ? &chromaticity_ptr->x : &chromaticity_ptr->y;
|
||||
PrimaryChromaticity* pc = *chromaticity;
|
||||
float* value = is_x ? &pc->x : &pc->y;
|
||||
|
||||
double parser_value = 0;
|
||||
const long long value_parse_status =
|
||||
const long long parse_status =
|
||||
UnserializeFloat(reader, read_pos, value_size, parser_value);
|
||||
|
||||
// Valid range is [0, 1]. Make sure the double is representable as a float
|
||||
// before casting.
|
||||
if (parse_status < 0 || parser_value < 0.0 || parser_value > 1.0 ||
|
||||
(parser_value > 0.0 && parser_value < FLT_MIN))
|
||||
return false;
|
||||
|
||||
*value = static_cast<float>(parser_value);
|
||||
|
||||
if (value_parse_status < 0 || *value < 0.0 || *value > 1.0)
|
||||
return false;
|
||||
|
||||
*chromaticity = chromaticity_ptr.release();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -5228,7 +5237,9 @@ bool Projection::Parse(IMkvReader* reader, long long start, long long size,
|
||||
double value = 0;
|
||||
const long long value_parse_status =
|
||||
UnserializeFloat(reader, read_pos, child_size, value);
|
||||
if (value_parse_status < 0) {
|
||||
// Make sure value is representable as a float before casting.
|
||||
if (value_parse_status < 0 || value < -FLT_MAX || value > FLT_MAX ||
|
||||
(value > 0.0 && value < FLT_MIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -7932,7 +7943,6 @@ long Block::Parse(const Cluster* pCluster) {
|
||||
pf = m_frames;
|
||||
while (pf != pf_end) {
|
||||
Frame& f = *pf++;
|
||||
assert((pos + f.len) <= stop);
|
||||
if ((pos + f.len) > stop)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
|
2
third_party/libwebm/mkvparser/mkvreader.cc
vendored
2
third_party/libwebm/mkvparser/mkvreader.cc
vendored
@ -7,6 +7,8 @@
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
#include "mkvparser/mkvreader.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace mkvparser {
|
||||
|
Loading…
Reference in New Issue
Block a user