Fix for audio and video track size calculation.
- There was a bug where the calculation for the audio and video track size where the code would calculate the size of the track elements minus the size of the audio or video elements. If the coded size of the track elements was one byte smaller than with the audio or video elements then the muxer would return an error. - Fixed another issue that the track's virtual Size function was calling the Track's PayloadSize function where it should have been calling the virtual PayloadSize function. Change-Id: Ie6d66d6d720334180a11e06926a3bd8c7788a1f1
This commit is contained in:
parent
359b3654ad
commit
28d54555a7
25
mkvmuxer.cpp
25
mkvmuxer.cpp
@ -473,9 +473,8 @@ uint64 Track::PayloadSize() const {
|
||||
}
|
||||
|
||||
uint64 Track::Size() const {
|
||||
uint64 size = Track::PayloadSize();
|
||||
uint64 size = PayloadSize();
|
||||
size += EbmlMasterElementSize(kMkvTrackEntry, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -688,15 +687,6 @@ uint64 VideoTrack::PayloadSize() const {
|
||||
return parent_size + size;
|
||||
}
|
||||
|
||||
uint64 VideoTrack::Size() const {
|
||||
const uint64 parent_size = Track::Size();
|
||||
|
||||
uint64 size = VideoPayloadSize();
|
||||
size += EbmlMasterElementSize(kMkvVideo, size);
|
||||
|
||||
return parent_size + size;
|
||||
}
|
||||
|
||||
bool VideoTrack::Write(IMkvWriter* writer) const {
|
||||
if (!Track::Write(writer))
|
||||
return false;
|
||||
@ -778,19 +768,6 @@ uint64 AudioTrack::PayloadSize() const {
|
||||
return parent_size + size;
|
||||
}
|
||||
|
||||
uint64 AudioTrack::Size() const {
|
||||
const uint64 parent_size = Track::Size();
|
||||
|
||||
uint64 size = EbmlElementSize(kMkvSamplingFrequency,
|
||||
static_cast<float>(sample_rate_));
|
||||
size += EbmlElementSize(kMkvChannels, channels_);
|
||||
if (bit_depth_ > 0)
|
||||
size += EbmlElementSize(kMkvBitDepth, bit_depth_);
|
||||
size += EbmlMasterElementSize(kMkvAudio, size);
|
||||
|
||||
return parent_size + size;
|
||||
}
|
||||
|
||||
bool AudioTrack::Write(IMkvWriter* writer) const {
|
||||
if (!Track::Write(writer))
|
||||
return false;
|
||||
|
@ -320,10 +320,6 @@ class VideoTrack : public Track {
|
||||
// video specific elements.
|
||||
virtual uint64 PayloadSize() const;
|
||||
|
||||
// Returns the size in bytes of the Track element plus the video specific
|
||||
// elements.
|
||||
virtual uint64 Size() const;
|
||||
|
||||
// Output the VideoTrack element to the writer. Returns true on success.
|
||||
virtual bool Write(IMkvWriter* writer) const;
|
||||
|
||||
@ -368,10 +364,6 @@ class AudioTrack : public Track {
|
||||
// audio specific elements.
|
||||
virtual uint64 PayloadSize() const;
|
||||
|
||||
// Returns the size in bytes of the Track element plus the audio specific
|
||||
// elements.
|
||||
virtual uint64 Size() const;
|
||||
|
||||
// Output the AudioTrack element to the writer. Returns true on success.
|
||||
virtual bool Write(IMkvWriter* writer) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user