forked from opdenkamp/xbmc
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AE: improve sync by using pause bursts
- Loading branch information
1 parent
0ad4065
commit 565bd35
Showing
5 changed files
with
50 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -868,6 +868,11 @@ void CActiveAESink::OpenSink() | |
m_sampleOfSilence.pkt->nb_samples = m_sampleOfSilence.pkt->max_nb_samples; | ||
if (!passthrough) | ||
GenerateNoise(); | ||
else | ||
{ | ||
m_sampleOfSilence.pkt->nb_samples = 0; | ||
m_sampleOfSilence.pkt->pause_burst_ms = m_sinkFormat.m_frames * 1000 / m_sinkFormat.m_sampleRate; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
fritsch
|
||
} | ||
|
||
m_swapState = CHECK_SWAP; | ||
} | ||
|
@@ -898,30 +903,48 @@ unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples) | |
std::unique_ptr<uint8_t[]> mergebuffer; | ||
uint8_t* p_mergebuffer = NULL; | ||
|
||
if (m_requestedFormat.m_dataFormat == AE_FMT_RAW && frames > 0 && samples->pool) | ||
if (m_requestedFormat.m_dataFormat == AE_FMT_RAW) | ||
{ | ||
if (m_needIecPack) | ||
{ | ||
if (m_sinkFormat.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD && frames == 61440) | ||
if (frames > 0) | ||
{ | ||
int offset; | ||
int len; | ||
m_packer->GetBuffer(); | ||
for (int i=0; i<24; i++) | ||
if (m_sinkFormat.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD && frames == 61440) | ||
{ | ||
offset = i*2560; | ||
len = (*(buffer[0] + offset+2560-2) << 8) + *(buffer[0] + offset+2560-1); | ||
m_packer->Pack(m_sinkFormat.m_streamInfo, buffer[0] + offset, len); | ||
int offset; | ||
int len; | ||
m_packer->GetBuffer(); | ||
for (int i=0; i<24; i++) | ||
{ | ||
offset = i*2560; | ||
len = (*(buffer[0] + offset+2560-2) << 8) + *(buffer[0] + offset+2560-1); | ||
m_packer->Pack(m_sinkFormat.m_streamInfo, buffer[0] + offset, len); | ||
} | ||
} | ||
else | ||
m_packer->Pack(m_sinkFormat.m_streamInfo, buffer[0], frames); | ||
} | ||
else if (samples->pkt->pause_burst_ms > 0) | ||
{ | ||
// construct a pause burst | ||
uint8_t payload[4]; | ||
m_packer->Pack(m_sinkFormat.m_streamInfo, payload, 4); | ||
uint16_t* buf = (uint16_t*)m_packer->GetBuffer(); | ||
buf[3] = 3; // Pc, burst type | ||
buf[4] = 32; // length-code | ||
buf[5] = samples->pkt->pause_burst_ms * m_sinkFormat.m_sampleRate / 1000; | ||
buf[6] = 0; | ||
} | ||
else | ||
m_packer->Pack(m_sinkFormat.m_streamInfo, buffer[0], frames); | ||
|
||
unsigned int size = m_packer->GetSize(); | ||
packBuffer = m_packer->GetBuffer(); | ||
buffer = &packBuffer; | ||
totalFrames = size / m_sinkFormat.m_frameSize; | ||
if (frames > 0) | ||
totalFrames = size / m_sinkFormat.m_frameSize; | ||
else if (samples->pkt->pause_burst_ms > 0) | ||
totalFrames = samples->pkt->pause_burst_ms * m_sinkFormat.m_sampleRate / 1000; | ||
frames = totalFrames; | ||
|
||
switch(m_swapState) | ||
{ | ||
case SKIP_SWAP: | ||
|
@@ -1005,8 +1028,8 @@ unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples) | |
m_stats->UpdateSinkDelay(status, samples->pool ? written : 0); | ||
} | ||
|
||
if (m_requestedFormat.m_dataFormat == AE_FMT_RAW && samples->pool) | ||
m_stats->UpdateSinkDelay(status, 1); | ||
if (m_requestedFormat.m_dataFormat == AE_FMT_RAW) | ||
m_stats->UpdateSinkDelay(status, samples->pool ? 1 : 0); | ||
|
||
return status.delay * 1000; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m_frames = 1881
m_sampleRate= 48000
Integer-Division (!) -> 0 always.