Added proper buffering of not-yet-accepted tracks.
This commit is contained in:
		
							parent
							
								
									7c89122a52
								
							
						
					
					
						commit
						a131557a43
					
				
					 2 changed files with 18 additions and 5 deletions
				
			
		
							
								
								
									
										21
									
								
								src/io.cpp
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								src/io.cpp
									
										
									
									
									
								
							|  | @ -408,10 +408,25 @@ namespace Mist { | |||
|     //If the track is declined, stop here
 | ||||
|     if (trackState[tid] == FILL_DEC) { | ||||
|       INFO_MSG("Track %lu Declined", tid); | ||||
|       preBuffer[tid].clear(); | ||||
|       return; | ||||
|     } | ||||
|     //Not accepted yet? Buffer.
 | ||||
|     if (trackState[tid] != FILL_ACC) { | ||||
|       preBuffer[tid].push_back(packet); | ||||
|     }else{ | ||||
|       while (preBuffer[tid].size()){ | ||||
|         bufferSinglePacket(preBuffer[tid].front(), myMeta); | ||||
|         preBuffer[tid].pop_front(); | ||||
|       } | ||||
|       bufferSinglePacket(packet, myMeta); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void negotiationProxy::bufferSinglePacket(DTSC::Packet & packet, DTSC::Meta & myMeta){ | ||||
|     //Store the trackid for easier access
 | ||||
|     unsigned long tid = packet.getTrackId(); | ||||
|     //This update needs to happen whether the track is accepted or not.
 | ||||
|     ///\todo Figure out how to act with declined track here
 | ||||
|     bool isKeyframe = false; | ||||
|     if (myMeta.tracks[tid].type == "video") { | ||||
|       if (packet.hasMember("keyframe") && packet.getFlag("keyframe")) { | ||||
|  | @ -462,10 +477,6 @@ namespace Mist { | |||
|     if (!pagesByTrack.count(tid) || pagesByTrack[tid].size() == 0){ | ||||
|       return; | ||||
|     } | ||||
|     //At this point we can stop parsing when the track is not accepted
 | ||||
|     if (trackState[tid] != FILL_ACC) { | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     //Check if the correct page is opened
 | ||||
|     if (!curPageNum.count(tid) || nextPageNum != curPageNum[tid]) { | ||||
|  |  | |||
							
								
								
									
										2
									
								
								src/io.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								src/io.h
									
										
									
									
									
								
							|  | @ -32,6 +32,7 @@ namespace Mist { | |||
|       void bufferNext(DTSC::Packet & pack, DTSC::Meta & myMeta); | ||||
|       void bufferFinalize(unsigned long tid, DTSC::Meta &myMeta); | ||||
|       void bufferLivePacket(DTSC::Packet & packet, DTSC::Meta & myMeta); | ||||
|       void bufferSinglePacket(DTSC::Packet & packet, DTSC::Meta & myMeta); | ||||
|       bool isBuffered(unsigned long tid, unsigned long keyNum); | ||||
|       unsigned long bufferedOnPage(unsigned long tid, unsigned long keyNum); | ||||
| 
 | ||||
|  | @ -47,6 +48,7 @@ namespace Mist { | |||
|       std::map<unsigned long, IPC::sharedPage> metaPages;///< For each track, holds the page that describes which dataPages are mapped
 | ||||
|       std::map<unsigned long, unsigned long> curPageNum;///< For each track, holds the number page that is currently being written.
 | ||||
|       std::map<unsigned long, IPC::sharedPage> curPage;///< For each track, holds the page that is currently being written.
 | ||||
|       std::map<unsigned long, std::deque<DTSC::Packet> > preBuffer;///< For each track, holds to-be-buffered packets.
 | ||||
| 
 | ||||
|       IPC::sharedClient userClient;///< Shared memory used for connection to Mixer process.
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma