Skip to content

Commit

Permalink
Fix #1548, Add edts in MP4 for Windows10. 3.0.154
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Dec 17, 2020
1 parent 721173e commit ab5ddd2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ For previous versions, please read:

## V3 changes

* v3.0, 2020-12-17, Fix [#1548][bug #1548], Add edts in MP4 for Windows10. 3.0.154
* <strong>v3.0, 2020-10-31, [3.0 release2(3.0.153)][r3.0r2] released. 122663 lines.</strong>
* v3.0, 2020-10-31, Fix [#509][bug #509], Always malloc stack on heap. 3.0.153
* v3.0, 2020-10-31, Remove some global elements for debugging. 3.0.152
Expand Down Expand Up @@ -1707,6 +1708,7 @@ Winlin
[bug #1629]: https://github.com/ossrs/srs/issues/1629
[bug #1780]: https://github.com/ossrs/srs/issues/1780
[bug #1987]: https://github.com/ossrs/srs/issues/1987
[bug #1548]: https://github.com/ossrs/srs/issues/1548
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy

[exo #828]: https://github.com/google/ExoPlayer/pull/828
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP

#define SRS_VERSION3_REVISION 153
#define SRS_VERSION3_REVISION 154

#endif
24 changes: 24 additions & 0 deletions trunk/src/kernel/srs_kernel_mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,12 @@ void SrsMp4TrackBox::set_tkhd(SrsMp4TrackHeaderBox* v)
boxes.insert(boxes.begin(), v);
}

void SrsMp4TrackBox::set_edts(SrsMp4EditBox* v)
{
remove(SrsMp4BoxTypeEDTS);
boxes.insert(boxes.begin(), v);
}

SrsMp4ChunkOffsetBox* SrsMp4TrackBox::stco()
{
SrsMp4SampleTableBox* box = stbl();
Expand Down Expand Up @@ -2022,6 +2028,12 @@ SrsMp4EditBox::~SrsMp4EditBox()
{
}

void SrsMp4EditBox::set_elst(SrsMp4EditListBox* v)
{
remove(SrsMp4BoxTypeELST);
boxes.insert(boxes.begin(), v);
}

SrsMp4ElstEntry::SrsMp4ElstEntry() : segment_duration(0), media_time(0), media_rate_integer(0)
{
media_rate_fraction = 0;
Expand Down Expand Up @@ -5773,6 +5785,18 @@ srs_error_t SrsMp4Encoder::flush()
if (nb_videos || !pavcc.empty()) {
SrsMp4TrackBox* trak = new SrsMp4TrackBox();
moov->add_trak(trak);

SrsMp4EditBox* edts = new SrsMp4EditBox();
trak->set_edts(edts);

SrsMp4EditListBox* elst = new SrsMp4EditListBox();
edts->set_elst(elst);
elst->version = 0;

SrsMp4ElstEntry entry;
entry.segment_duration = mvhd->duration_in_tbn;
entry.media_rate_integer = 1;
elst->entries.push_back(entry);

SrsMp4TrackHeaderBox* tkhd = new SrsMp4TrackHeaderBox();
trak->set_tkhd(tkhd);
Expand Down
6 changes: 6 additions & 0 deletions trunk/src/kernel/srs_kernel_mp4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class SrsMp4TrackFragmentBox;
class SrsMp4TrackFragmentHeaderBox;
class SrsMp4TrackFragmentDecodeTimeBox;
class SrsMp4TrackFragmentRunBox;
class SrsMp4EditBox;
class SrsMp4EditListBox;

// 4.2 Object Structure
// ISO_IEC_14496-12-base-format-2012.pdf, page 16
Expand Down Expand Up @@ -766,6 +768,8 @@ class SrsMp4TrackBox : public SrsMp4Box
// Get the track header box.
virtual SrsMp4TrackHeaderBox* tkhd();
virtual void set_tkhd(SrsMp4TrackHeaderBox* v);
// Set the EDTS box.
virtual void set_edts(SrsMp4EditBox* v);
public:
// Get the chunk offset box.
virtual SrsMp4ChunkOffsetBox* stco();
Expand Down Expand Up @@ -874,6 +878,8 @@ class SrsMp4EditBox : public SrsMp4Box
public:
SrsMp4EditBox();
virtual ~SrsMp4EditBox();
public:
virtual void set_elst(SrsMp4EditListBox* v);
};

// 8.6.6 Edit List Box
Expand Down

0 comments on commit ab5ddd2

Please sign in to comment.