Skip to content

Commit

Permalink
[radio] fix broken spanish radio
Browse files Browse the repository at this point in the history
  • Loading branch information
dvb-adenin committed Nov 8, 2015
1 parent 867264b commit eec9c1d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dvb/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ int eTSMPEGDecoder::setState()
m_changed |= changeText | changeState;

const char *decoder_states[] = {"stop", "pause", "play", "decoderfastforward", "trickmode", "slowmotion"};
eDebug("decoder state: %s, vpid=%d, apid=%d", decoder_states[m_state], m_vpid, m_apid);
eDebug("decoder state: %s, vpid=%d, apid=%d, pcrpid=%d", decoder_states[m_state], m_vpid, m_apid, m_pcrpid);

int changed = m_changed;
if (m_changed & changePCR)
Expand Down
22 changes: 21 additions & 1 deletion lib/service/servicedvb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,22 @@ int eDVBServicePlay::selectAudioStream(int i)

m_current_audio_pid = apid;

pts_t a_pts, v_pts;
a_pts = v_pts = 0;
m_decoder->getPTS(2, a_pts);
m_decoder->getPTS(1, v_pts);
eDebug("a: %lld v: %lld %lld",a_pts, v_pts, a_pts-v_pts);
bool radio_workaround = false;
if(v_pts && a_pts && (abs(a_pts-v_pts) > 15000))
radio_workaround = true;

if(radio_workaround)
if (m_decoder->setAudioPID(-1, 0))
{
eDebug("set audio pid failed");
return -4;
}

if (m_decoder->setAudioPID(apid, apidtype))
{
eDebug("set audio pid failed");
Expand Down Expand Up @@ -2195,6 +2211,9 @@ int eDVBServicePlay::selectAudioStream(int i)
}
}

if(radio_workaround)
m_decoder->setSyncPCR(-1);

/* store new pid as default only when:
a.) we have an entry in the service db for the current service,
b.) we are not playing back something,
Expand Down Expand Up @@ -2869,13 +2888,14 @@ void eDVBServicePlay::updateDecoder(bool sendSeekableStateChanged)
m_decoder->setVideoPID(vpid, vpidtype);
m_have_video_pid = (vpid > 0 && vpid < 0x2000);

selectAudioStream();

if (!(m_is_pvr || m_is_stream || m_timeshift_active))
m_decoder->setSyncPCR(pcrpid);
else
m_decoder->setSyncPCR(-1);

selectAudioStream();

if (m_decoder_index == 0)
{
m_decoder->setTextPID(tpid);
Expand Down

0 comments on commit eec9c1d

Please sign in to comment.