mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-12 20:27:19 +00:00
allocate frame from session pool so it will not go out of scope
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12811 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
cb7e045c9b
commit
fc9cbb4db5
@ -1057,9 +1057,11 @@ FSMediaStream::FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaF
|
|||||||
, m_readRTP(0, 512)
|
, m_readRTP(0, 512)
|
||||||
, m_callOnStart(true)
|
, m_callOnStart(true)
|
||||||
{
|
{
|
||||||
memset(&m_readFrame, 0, sizeof(m_readFrame));
|
|
||||||
m_readFrame.codec = m_switchCodec;
|
m_readFrame = (switch_frame_t *) switch_core_session_alloc(m_fsSession, sizeof(*m_readFrame));
|
||||||
m_readFrame.flags = SFF_RAW_RTP;
|
|
||||||
|
m_readFrame->codec = m_switchCodec;
|
||||||
|
m_readFrame->flags = SFF_RAW_RTP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1116,7 +1118,7 @@ PBoolean FSMediaStream::Open()
|
|||||||
<< mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
|
<< mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
|
||||||
|
|
||||||
if (IsSink()) {
|
if (IsSink()) {
|
||||||
m_readFrame.rate = mediaFormat.GetClockRate();
|
m_readFrame->rate = mediaFormat.GetClockRate();
|
||||||
|
|
||||||
if (isAudio) {
|
if (isAudio) {
|
||||||
switch_core_session_set_read_codec(m_fsSession, m_switchCodec);
|
switch_core_session_set_read_codec(m_fsSession, m_switchCodec);
|
||||||
@ -1195,7 +1197,7 @@ switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag
|
|||||||
m_callOnStart = false;
|
m_callOnStart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_readFrame.flags = 0;
|
m_readFrame->flags = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
while (switch_channel_ready(m_fsChannel)) {
|
while (switch_channel_ready(m_fsChannel)) {
|
||||||
@ -1222,7 +1224,7 @@ switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
if (!m_readRTP.GetPayloadSize()) {
|
if (!m_readRTP.GetPayloadSize()) {
|
||||||
m_readFrame.flags = SFF_CNG;
|
m_readFrame->flags = SFF_CNG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1234,8 +1236,8 @@ switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag
|
|||||||
|
|
||||||
switch_core_timer_next(m_switchTimer);
|
switch_core_timer_next(m_switchTimer);
|
||||||
|
|
||||||
if (!(m_readFrame.datalen = m_readRTP.GetPayloadSize())) {
|
if (!(m_readFrame->datalen = m_readRTP.GetPayloadSize())) {
|
||||||
m_readFrame.flags = SFF_CNG;
|
m_readFrame->flags = SFF_CNG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,17 +1247,17 @@ switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag
|
|||||||
|
|
||||||
//switch_core_timer_step(&m_switchTimer);
|
//switch_core_timer_step(&m_switchTimer);
|
||||||
|
|
||||||
m_readFrame.buflen = m_readRTP.GetSize();
|
m_readFrame->buflen = m_readRTP.GetSize();
|
||||||
m_readFrame.data = m_readRTP.GetPayloadPtr();
|
m_readFrame->data = m_readRTP.GetPayloadPtr();
|
||||||
m_readFrame.packet = m_readRTP.GetPointer();
|
m_readFrame->packet = m_readRTP.GetPointer();
|
||||||
m_readFrame.packetlen = m_readRTP.GetHeaderSize() + m_readFrame.datalen;
|
m_readFrame->packetlen = m_readRTP.GetHeaderSize() + m_readFrame->datalen;
|
||||||
m_readFrame.payload = (switch_payload_t) m_readRTP.GetPayloadType();
|
m_readFrame->payload = (switch_payload_t) m_readRTP.GetPayloadType();
|
||||||
m_readFrame.timestamp = m_readRTP.GetTimestamp();
|
m_readFrame->timestamp = m_readRTP.GetTimestamp();
|
||||||
m_readFrame.m = (switch_bool_t) m_readRTP.GetMarker();
|
m_readFrame->m = (switch_bool_t) m_readRTP.GetMarker();
|
||||||
m_readFrame.seq = m_readRTP.GetSequenceNumber();
|
m_readFrame->seq = m_readRTP.GetSequenceNumber();
|
||||||
m_readFrame.ssrc = m_readRTP.GetSyncSource();
|
m_readFrame->ssrc = m_readRTP.GetSyncSource();
|
||||||
m_readFrame.codec = m_switchCodec;
|
m_readFrame->codec = m_switchCodec;
|
||||||
*frame = &m_readFrame;
|
*frame = m_readFrame;
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ class FSMediaStream:public OpalMediaStream {
|
|||||||
switch_channel_t *m_fsChannel;
|
switch_channel_t *m_fsChannel;
|
||||||
switch_timer_t *m_switchTimer;
|
switch_timer_t *m_switchTimer;
|
||||||
switch_codec_t *m_switchCodec;
|
switch_codec_t *m_switchCodec;
|
||||||
switch_frame_t m_readFrame;
|
switch_frame_t *m_readFrame;
|
||||||
RTP_DataFrame m_readRTP;
|
RTP_DataFrame m_readRTP;
|
||||||
bool m_callOnStart;
|
bool m_callOnStart;
|
||||||
uint32_t m_timeStamp;
|
uint32_t m_timeStamp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user