mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	merge srs2
This commit is contained in:
		
						commit
						e9e202dbf1
					
				
					 3 changed files with 33 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1407,6 +1407,11 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata
 | 
			
		|||
 | 
			
		||||
    SrsAmf0Any* prop = NULL;
 | 
			
		||||
    
 | 
			
		||||
    // when exists the duration, remove it to make ExoPlayer happy.
 | 
			
		||||
    if (metadata->metadata->get_property("duration") != NULL) {
 | 
			
		||||
        metadata->metadata->remove("duration");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    // generate metadata info to print
 | 
			
		||||
    std::stringstream ss;
 | 
			
		||||
    if ((prop = metadata->metadata->ensure_property_number("width")) != NULL) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -561,6 +561,24 @@ SrsAmf0Any* SrsUnSortedHashtable::ensure_property_number(string name)
 | 
			
		|||
    return prop;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SrsUnSortedHashtable::remove(string name)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<SrsAmf0ObjectPropertyType>::iterator it;
 | 
			
		||||
    
 | 
			
		||||
    for (it = properties.begin(); it != properties.end();) {
 | 
			
		||||
        std::string key = it->first;
 | 
			
		||||
        SrsAmf0Any* any = it->second;
 | 
			
		||||
        
 | 
			
		||||
        if (key == name) {
 | 
			
		||||
            srs_freep(any);
 | 
			
		||||
            
 | 
			
		||||
            it = properties.erase(it);
 | 
			
		||||
        } else {
 | 
			
		||||
            ++it;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SrsUnSortedHashtable::copy(SrsUnSortedHashtable* src)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<SrsAmf0ObjectPropertyType>::iterator it;
 | 
			
		||||
| 
						 | 
				
			
			@ -849,6 +867,11 @@ SrsAmf0Any* SrsAmf0Object::ensure_property_number(string name)
 | 
			
		|||
    return properties->ensure_property_number(name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SrsAmf0Object::remove(string name)
 | 
			
		||||
{
 | 
			
		||||
    properties->remove(name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SrsAmf0EcmaArray::SrsAmf0EcmaArray()
 | 
			
		||||
{
 | 
			
		||||
    _count = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -414,6 +414,10 @@ public:
 | 
			
		|||
    * @remark user should never free the returned value, copy it if needed.
 | 
			
		||||
    */
 | 
			
		||||
    virtual SrsAmf0Any* ensure_property_number(std::string name);
 | 
			
		||||
    /**
 | 
			
		||||
     * remove the property specified by name.
 | 
			
		||||
     */
 | 
			
		||||
    virtual void remove(std::string name);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -820,6 +824,7 @@ namespace _srs_internal
 | 
			
		|||
        virtual SrsAmf0Any* get_property(std::string name);
 | 
			
		||||
        virtual SrsAmf0Any* ensure_property_string(std::string name);
 | 
			
		||||
        virtual SrsAmf0Any* ensure_property_number(std::string name);
 | 
			
		||||
        virtual void remove(std::string name);
 | 
			
		||||
    public:
 | 
			
		||||
        virtual void copy(SrsUnSortedHashtable* src);
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue