Skip to content

Commit

Permalink
Merge pull request #711 from matthuisman/leia_backports
Browse files Browse the repository at this point in the history
[Leia] Backports
  • Loading branch information
glennguy authored Jul 12, 2021
2 parents 6742307 + d013940 commit fad3726
Show file tree
Hide file tree
Showing 15 changed files with 302 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build artifacts
./build/
build/
debian/changelog
debian/files
debian/kodi-inputstream-mpd-dbg.debhelper.log
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# inputstream.adaptive (2.4.7)
# inputstream.adaptive (2.4.8)

This is an adaptive file addon for kodi's new InputStream Interface.

Expand Down Expand Up @@ -38,17 +38,13 @@ If your display resolution is 720p, you will not be able to watch 1080p videos i
##### TODO's:
- Adaptive bitrate switching is prepared but currently not yet activated
- Automatic / fixed video stream selection depending on max. visible display rect (some work has to be done at the inputstream interface).
- DASH implementation of periods (currently only the first period is considered)
- There will be many dash mpd, smoothstream or hls manifest types currently not supported - must be extended.
- There will be many dash mpd, smoothstream or hls manifest types currently not supported - must be extended.

##### Notes:
- This addon uses threads to download segments. The memory consumption is the sum of single segment from each stream currently playing. Refering to known streams it is < 10MB for 720p videos.

##### Credits:
[@fernetmenta](github.com/fernetmenta) Best support I ever got regarding streams / codecs and kodi internals.
[@notspiff](https:/notspiff) Thanks for your ideas / tipps regarding kodi file system
[bento4 library](https://www.bento4.com/) For me the best library choice for mp4 streams. Well written and extensible!

##### Continuous integration:
[Travis CI build state:](https://travis-ci.org/peak3d) ![alt tag](https://travis-ci.org/peak3d/inputstream.adaptive.svg?branch=master)
[Appveyor:](https://ci.appveyor.com/project/peak3d) ![alt tag](https://ci.appveyor.com/api/projects/status/ah9s8usgxhangq7o?svg=true)
[@peak3d](https:/peak3d) Original author / creator. Superstar!
[@fernetmenta](https:/fernetmenta) Best support regarding streams / codecs and kodi internals.
[@notspiff](https:/notspiff) Ideas / tips regarding kodi file system.
[bento4 library](https://www.bento4.com/) Great library for mp4 streams. Well written and extensible!
14 changes: 13 additions & 1 deletion inputstream.adaptive/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="inputstream.adaptive"
version="2.4.7"
version="2.4.8"
name="InputStream Adaptive"
provider-name="peak3d">
<requires>@ADDON_DEPENDS@</requires>
Expand All @@ -19,6 +19,18 @@
<description lang="es">Cliente InputStream para flujo de datos adaptativos</description>
<platform>@PLATFORM@</platform>
<news>
v2.4.8 (2021-07-11)
- [DASH] time and number placeholders can be used simultaneously
- License renewal for widevine
- [DASH] fix for minimumUpdatePeriod=0
- [HLS] support webvtt subtitle extensions
- [DASH] manifest_update_parameter property defaults to 'full' for SegmentTimeline
- Fix decode failures on some Widevine content
- [DASH] fix segmentTemplate calculation
- [HLS] EXT-X-DISCONTINUITY-SEQUENCE support
- Fix seeking into separate chapters/resume time
- Fix kodi freeze by session close

v2.4.7 (2021-04-10)
- [Dash] Fix missing audio languages
- [Dash] Correctly set timeshift_buffer (live)
Expand Down
18 changes: 0 additions & 18 deletions inputstream.adaptive/changelog.txt

This file was deleted.

4 changes: 2 additions & 2 deletions src/common/AdaptiveStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ bool AdaptiveStream::start_stream(const uint32_t seg_offset,
bool play_timeshift_buffer)
{
if (!play_timeshift_buffer && !~seg_offset && tree_.has_timeshift_buffer_ &&
current_rep_->segments_.data.size() > 1)
current_rep_->segments_.data.size() > 1 && tree_.periods_.size() == 1)
{
std::int32_t pos;
if (tree_.has_timeshift_buffer_ || tree_.available_time_ >= tree_.stream_start_)
Expand Down Expand Up @@ -400,7 +400,7 @@ bool AdaptiveStream::ensureSegment()
ResetSegment();
thread_data_->signal_dl_.notify_one();
}
else if (tree_.HasUpdateThread())
else if (tree_.HasUpdateThread() && current_period_ == tree_.periods_.back())
{
current_rep_->flags_ |= AdaptiveTree::Representation::WAITFORSEGMENT;
Log(LOGLEVEL_DEBUG, "Begin WaitForSegment stream %s", current_rep_->id.c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/common/AdaptiveTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ namespace adaptive
delete *bp;
}

void AdaptiveTree::FreeSegments(Representation *rep)
void AdaptiveTree::FreeSegments(Period* period, Representation* rep)
{
for (std::vector<Segment>::iterator bs(rep->segments_.data.begin()), es(rep->segments_.data.end()); bs != es; ++bs)
{
--current_period_->psshSets_[bs->pssh_set_].use_count_;
--period->psshSets_[bs->pssh_set_].use_count_;
if (rep->flags_ & Representation::URLSEGMENTS)
delete[] bs->url;
}
Expand Down
6 changes: 4 additions & 2 deletions src/common/AdaptiveTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class AdaptiveTree
std::string codecs_;
std::string codec_private_data_;
std::string source_url_;
std::string base_url_;
uint32_t bandwidth_;
uint32_t samplingRate_;
uint16_t width_, height_;
Expand Down Expand Up @@ -398,7 +399,7 @@ class AdaptiveTree

std::vector<AdaptationSet*> adaptationSets_;
std::string base_url_, id_;
uint32_t timescale_ = 1000, startNumber_ = 1;
uint32_t timescale_ = 1000, startNumber_ = 1, sequence_ = 0;
uint64_t start_ = 0;
uint64_t startPTS_ = 0;
uint64_t duration_ = 0;
Expand All @@ -422,6 +423,7 @@ class AdaptiveTree
XML_Parser parser_;
uint32_t currentNode_;
uint32_t segcount_;
uint32_t initial_sequence_ = ~0UL;
uint64_t overallSeconds_, stream_start_, available_time_, base_time_;
uint64_t minPresentationOffset;
bool has_timeshift_buffer_, has_overall_seconds_;
Expand Down Expand Up @@ -464,7 +466,7 @@ class AdaptiveTree
StreamType type){};

bool has_type(StreamType t);
void FreeSegments(Representation *rep);
void FreeSegments(Period* period, Representation* rep);
uint32_t estimate_segcount(uint64_t duration, uint32_t timescale);
double get_download_speed() const { return download_speed_; };
double get_average_download_speed() const { return average_download_speed_; };
Expand Down
Loading

0 comments on commit fad3726

Please sign in to comment.