Codec may not return encoded packet on every encode_mediapacket call, i.e. in case there's not enough data it may buffer data and encode on subsequent calls when enough data were provided. We need to make sure media packet is written only in case somethind was encoded so we don't send empty packets. --- android/hal-audio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/hal-audio.c b/android/hal-audio.c index 534620a..9807a5d 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -691,8 +691,12 @@ static bool write_data(struct a2dp_stream_out *out, const void *buffer, } } - /* in resync mode we'll just drop mediapackets */ - if (!ep->resync) { + /* we send data only in case codec encoded some data, i.e. some + * codecs do internal buffering and output data only if full + * frame can be encoded + * in resync mode we'll just drop mediapackets + */ + if (written > 0 && !ep->resync) { /* wait some time for socket to be ready for write, * but we'll just skip writing data if timeout occurs */ -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html