Added proper buffering of not-yet-accepted tracks.
This commit is contained in:
parent
3c41142a57
commit
e6ff699ad8
2 changed files with 18 additions and 5 deletions
21
src/io.cpp
21
src/io.cpp
|
@ -472,10 +472,25 @@ namespace Mist {
|
||||||
//If the track is declined, stop here
|
//If the track is declined, stop here
|
||||||
if (trackState[tid] == FILL_DEC) {
|
if (trackState[tid] == FILL_DEC) {
|
||||||
INFO_MSG("Track %lu Declined", tid);
|
INFO_MSG("Track %lu Declined", tid);
|
||||||
|
preBuffer[tid].clear();
|
||||||
return;
|
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.
|
//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;
|
bool isKeyframe = false;
|
||||||
if (myMeta.tracks[tid].type == "video") {
|
if (myMeta.tracks[tid].type == "video") {
|
||||||
if (packet.hasMember("keyframe") && packet.getFlag("keyframe")) {
|
if (packet.hasMember("keyframe") && packet.getFlag("keyframe")) {
|
||||||
|
@ -526,10 +541,6 @@ namespace Mist {
|
||||||
if (!pagesByTrack.count(tid) || pagesByTrack[tid].size() == 0){
|
if (!pagesByTrack.count(tid) || pagesByTrack[tid].size() == 0){
|
||||||
return;
|
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
|
//Check if the correct page is opened
|
||||||
if (!curPageNum.count(tid) || nextPageNum != curPageNum[tid]) {
|
if (!curPageNum.count(tid) || nextPageNum != curPageNum[tid]) {
|
||||||
|
|
2
src/io.h
2
src/io.h
|
@ -34,6 +34,7 @@ namespace Mist {
|
||||||
void bufferNext(DTSC::Packet & pack, DTSC::Meta & myMeta);
|
void bufferNext(DTSC::Packet & pack, DTSC::Meta & myMeta);
|
||||||
void bufferFinalize(unsigned long tid, DTSC::Meta &myMeta);
|
void bufferFinalize(unsigned long tid, DTSC::Meta &myMeta);
|
||||||
void bufferLivePacket(DTSC::Packet & packet, 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);
|
bool isBuffered(unsigned long tid, unsigned long keyNum);
|
||||||
unsigned long bufferedOnPage(unsigned long tid, unsigned long keyNum);
|
unsigned long bufferedOnPage(unsigned long tid, unsigned long keyNum);
|
||||||
|
|
||||||
|
@ -49,6 +50,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, 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, 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, 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.
|
IPC::sharedClient userClient;///< Shared memory used for connection to Mixer process.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue