Size Android publisher buffers for the signed batch format
This commit is contained in:
1 parent
6a5bb84d71
commit
f15c97d11a
2 files changed
+5
-4
No files matched your search
@@ -161,7 +161,8 @@ static void media_close(struct android_media_session *s, int kind) {
|
||||
/* Сформировать ограниченную пачку: аудио целиком, видео с продолжениями и несколькими началами. */
|
||||
static int media_publish(void) {
|
||||
struct stream_media_block block = {.format = publisher.format};
|
||||
uint8_t wire[7080]; size_t capacity = stream_publish_capacity(publisher.handle), used = STREAM_MEDIA_HEADER_SIZE;
|
||||
uint8_t wire[STREAM_DEFAULT_INPUT_CAPACITY];
|
||||
size_t capacity = stream_publish_capacity(publisher.handle), used = STREAM_MEDIA_HEADER_SIZE;
|
||||
if (capacity > sizeof(wire) || capacity < 256) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "Android publisher invalid capacity=%zu", capacity); return STREAM_ERR_STATE;
|
||||
}
|
||||
@@ -263,7 +264,7 @@ static void media_process(void *arg) {
|
||||
size_t pending = video_queue.bytes + audio_queue.bytes - (video_queue.head ? video_queue.head->offset : 0);
|
||||
uint64_t oldest = video_queue.head ? video_queue.head->created : audio_queue.head->created;
|
||||
if (audio_queue.head && audio_queue.head->created < oldest) oldest = audio_queue.head->created;
|
||||
if (!publisher.stopping && pending + STREAM_MEDIA_HEADER_SIZE + STREAM_MEDIA_VIDEO_SIZE < 7080
|
||||
if (!publisher.stopping && pending + STREAM_MEDIA_HEADER_SIZE + STREAM_MEDIA_VIDEO_SIZE < stream_publish_capacity(publisher.handle)
|
||||
&& now - oldest < 20000) break;
|
||||
int result = media_publish();
|
||||
if (result < 0) { DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "Android media publish failed result=%d", result); media_close(&publisher, 6); break; }
|
||||
|
||||
Reference in new issue
Block a user