Skip to content

Commit ef00005

Browse files
committed
for ExoPlayer, remove duration for live.
1 parent 50a7b9c commit ef00005

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ Remark:
336336

337337
## History
338338

339+
* v2.0, 2015-10-28, for [ExoPlayer #828][exo #828], remove duration for live.
339340
* v2.0, 2015-10-28, for [ExoPlayer #828][exo #828], add av tag in flv header. 2.0.197
340341
* v2.0, 2015-10-27, for [#512][bug #512] partical hotfix the hls pure audio. 2.0.196
341342
* <strong>v2.0, 2015-10-08, [2.0 alpha2(2.0.195)][r2.0a2] released. 89358 lines.</strong>

trunk/src/app/srs_app_source.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,11 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata
14001400

14011401
SrsAmf0Any* prop = NULL;
14021402

1403+
// when exists the duration, remove it to make ExoPlayer happy.
1404+
if (metadata->metadata->get_property("duration") != NULL) {
1405+
metadata->metadata->remove("duration");
1406+
}
1407+
14031408
// generate metadata info to print
14041409
std::stringstream ss;
14051410
if ((prop = metadata->metadata->ensure_property_number("width")) != NULL) {

trunk/src/protocol/srs_rtmp_amf0.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,24 @@ SrsAmf0Any* SrsUnSortedHashtable::ensure_property_number(string name)
513513
return prop;
514514
}
515515

516+
void SrsUnSortedHashtable::remove(string name)
517+
{
518+
std::vector<SrsAmf0ObjectPropertyType>::iterator it;
519+
520+
for (it = properties.begin(); it != properties.end();) {
521+
std::string key = it->first;
522+
SrsAmf0Any* any = it->second;
523+
524+
if (key == name) {
525+
srs_freep(any);
526+
527+
it = properties.erase(it);
528+
} else {
529+
++it;
530+
}
531+
}
532+
}
533+
516534
void SrsUnSortedHashtable::copy(SrsUnSortedHashtable* src)
517535
{
518536
std::vector<SrsAmf0ObjectPropertyType>::iterator it;
@@ -787,6 +805,11 @@ SrsAmf0Any* SrsAmf0Object::ensure_property_number(string name)
787805
return properties->ensure_property_number(name);
788806
}
789807

808+
void SrsAmf0Object::remove(string name)
809+
{
810+
properties->remove(name);
811+
}
812+
790813
SrsAmf0EcmaArray::SrsAmf0EcmaArray()
791814
{
792815
_count = 0;

trunk/src/protocol/srs_rtmp_amf0.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ class SrsAmf0Object : public SrsAmf0Any
405405
* @remark user should never free the returned value, copy it if needed.
406406
*/
407407
virtual SrsAmf0Any* ensure_property_number(std::string name);
408+
/**
409+
* remove the property specified by name.
410+
*/
411+
virtual void remove(std::string name);
408412
};
409413

410414
/**
@@ -803,6 +807,7 @@ namespace _srs_internal
803807
virtual SrsAmf0Any* get_property(std::string name);
804808
virtual SrsAmf0Any* ensure_property_string(std::string name);
805809
virtual SrsAmf0Any* ensure_property_number(std::string name);
810+
virtual void remove(std::string name);
806811
public:
807812
virtual void copy(SrsUnSortedHashtable* src);
808813
};

0 commit comments

Comments
 (0)