Skip to content
Snippets Groups Projects
Commit 78ed2663 authored by Philippe Gorley's avatar Philippe Gorley
Browse files

media: update ffmpeg io read callbacks

In newer versions, AVIOContext's read_packet cb no longer considers 0
as being EOF. Changes the read callbacks for SDP and RTP to return
AVERROR_EOF instead of 0.

Change-Id: Ica5bdc95913b4475f1e954a1141700fc88638a59
parent 61be26fb
Branches
No related tags found
No related merge requests found
......@@ -17,6 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "libav_deps.h" // MUST BE INCLUDED FIRST
#include "audio_rtp_session.h"
#include "logger.h"
......@@ -340,7 +343,12 @@ AudioReceiveThread::readFunction(void* opaque, uint8_t* buf, int buf_size)
{
std::istream& is = static_cast<AudioReceiveThread*>(opaque)->stream_;
is.read(reinterpret_cast<char*>(buf), buf_size);
return is.gcount();
auto count = is.gcount();
if (count != 0)
return count;
else
return AVERROR_EOF;
}
// This callback is used by libav internally to break out of blocking calls
......
......@@ -429,7 +429,10 @@ SocketPair::readCallback(uint8_t* buf, int buf_size)
RING_WARN("decrypt error %d", err);
}
return len;
if (len != 0)
return len;
else
return AVERROR_EOF;
}
int
......
......@@ -151,7 +151,12 @@ int VideoReceiveThread::readFunction(void *opaque, uint8_t *buf, int buf_size)
{
std::istream &is = static_cast<VideoReceiveThread*>(opaque)->stream_;
is.read(reinterpret_cast<char*>(buf), buf_size);
return is.gcount();
auto count = is.gcount();
if (count != 0)
return count;
else
return AVERROR_EOF;
}
void VideoReceiveThread::addIOContext(SocketPair& socketPair)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment