|
|
|
|
@ -21,7 +21,10 @@ static int media_validate(const struct stream_media_block *b, size_t *video_size
|
|
|
|
|
|| (!b->video_count && !b->audio_count) || b->format.video_codec != STREAM_MEDIA_H264 |
|
|
|
|
|| b->format.audio_codec > STREAM_MEDIA_OPUS || !b->format.width || b->format.width > 4096 |
|
|
|
|
|| !b->format.height || b->format.height > 4096 || b->format.rotation > 270 || b->format.rotation % 90) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "media format/count invalid"); return STREAM_ERR_FORMAT; |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "media format/count invalid present=%d video=%u audio=%u codecs=%u/%u dimensions=%ux%u rotation=%u", |
|
|
|
|
b != NULL, b ? b->video_count : 0, b ? b->audio_count : 0, b ? b->format.video_codec : 0, |
|
|
|
|
b ? b->format.audio_codec : 0, b ? b->format.width : 0, b ? b->format.height : 0, b ? b->format.rotation : 0); |
|
|
|
|
return STREAM_ERR_FORMAT; |
|
|
|
|
} |
|
|
|
|
*video_size = *audio_size = 0; *first = UINT32_MAX; |
|
|
|
|
for (unsigned i = 0; i < b->video_count; i++) { |
|
|
|
|
@ -40,7 +43,10 @@ static int media_validate(const struct stream_media_block *b, size_t *video_size
|
|
|
|
|
|| v->pts_us != p->pts_us || v->flags != p->flags)) |
|
|
|
|
|| (!same && (v->frame_id <= p->frame_id || v->offset || p->offset + p->length != p->frame_size |
|
|
|
|
|| v->pts_us <= p->pts_us))) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "media video order invalid entry=%u", i); return STREAM_ERR_FORMAT; |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "media video order invalid entry=%u frame=%llu/%llu offset=%u/%u pts=%llu/%llu", |
|
|
|
|
i, (unsigned long long)p->frame_id, (unsigned long long)v->frame_id, p->offset + p->length, v->offset, |
|
|
|
|
(unsigned long long)p->pts_us, (unsigned long long)v->pts_us); |
|
|
|
|
return STREAM_ERR_FORMAT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!v->offset && *first == UINT32_MAX) *first = (uint32_t)*video_size; |
|
|
|
|
@ -171,7 +177,9 @@ int stream_media_receiver_feed(struct stream_media_receiver *r, const uint8_t *d
|
|
|
|
|
if (result != STREAM_OK) { stream_media_receiver_gap(r); return result; } |
|
|
|
|
if (r->configured && (r->format.width != b.format.width || r->format.height != b.format.height |
|
|
|
|
|| r->format.rotation != b.format.rotation || r->format.audio_codec != b.format.audio_codec)) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "media format changed within source epoch"); |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "media format changed within source epoch dimensions=%ux%u/%ux%u rotation=%u/%u audio=%u/%u", |
|
|
|
|
r->format.width, r->format.height, b.format.width, b.format.height, |
|
|
|
|
r->format.rotation, b.format.rotation, r->format.audio_codec, b.format.audio_codec); |
|
|
|
|
stream_media_receiver_gap(r); return STREAM_ERR_CONFLICT; |
|
|
|
|
} |
|
|
|
|
r->format = b.format; r->configured = 1; |
|
|
|
|
|