Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8d75422d21 |
@ -219,22 +219,13 @@ recorder_rescale_packet(struct recorder *recorder, AVPacket *packet) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
recorder_write(struct recorder *recorder, AVPacket *packet) {
|
recorder_write(struct recorder *recorder, AVPacket *packet) {
|
||||||
|
SDL_assert(packet->pts != AV_NOPTS_VALUE);
|
||||||
if (!recorder->header_written) {
|
if (!recorder->header_written) {
|
||||||
if (packet->pts != AV_NOPTS_VALUE) {
|
|
||||||
LOGE("The first packet is not a config packet");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool ok = recorder_write_header(recorder, packet);
|
bool ok = recorder_write_header(recorder, packet);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
recorder->header_written = true;
|
recorder->header_written = true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packet->pts == AV_NOPTS_VALUE) {
|
|
||||||
// ignore config packets
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
recorder_rescale_packet(recorder, packet);
|
recorder_rescale_packet(recorder, packet);
|
||||||
|
@ -69,15 +69,6 @@ notify_stopped(void) {
|
|||||||
SDL_PushEvent(&stop_event);
|
SDL_PushEvent(&stop_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
process_config_packet(struct stream *stream, AVPacket *packet) {
|
|
||||||
if (stream->recorder && !recorder_push(stream->recorder, packet)) {
|
|
||||||
LOGE("Could not send config packet to recorder");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
process_frame(struct stream *stream, AVPacket *packet) {
|
process_frame(struct stream *stream, AVPacket *packet) {
|
||||||
if (stream->decoder && !decoder_push(stream->decoder, packet)) {
|
if (stream->decoder && !decoder_push(stream->decoder, packet)) {
|
||||||
@ -157,13 +148,7 @@ stream_push_packet(struct stream *stream, AVPacket *packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_config) {
|
if (!is_config) {
|
||||||
// config packet
|
|
||||||
bool ok = process_config_packet(stream, packet);
|
|
||||||
if (!ok) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// data packet
|
// data packet
|
||||||
bool ok = stream_parse(stream, packet);
|
bool ok = stream_parse(stream, packet);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user