Fixed ATTA and DETA

Cleanup some code
Testet GRAB funktions
This commit is contained in:
jojo61
2019-10-20 14:48:28 +02:00
parent 40115f4fc6
commit f80d757704
4 changed files with 309 additions and 533 deletions

View File

@@ -1035,8 +1035,7 @@ static snd_pcm_t *AlsaOpenPCM(int passthrough)
} }
// open none blocking; if device is already used, we don't want wait // open none blocking; if device is already used, we don't want wait
if ((err = if ((err =
snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)) < 0) {
SND_PCM_NONBLOCK)) < 0) {
Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err)); Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err));
return NULL; return NULL;
} }

12
codec.c
View File

@@ -439,17 +439,19 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
*/ */
void CodecVideoClose(VideoDecoder *video_decoder) void CodecVideoClose(VideoDecoder *video_decoder)
{ {
AVFrame *frame;
// FIXME: play buffered data // FIXME: play buffered data
// av_frame_free(&video_decoder->Frame); // callee does checks // av_frame_free(&video_decoder->Frame); // callee does checks
Debug(3,"CodecVideoClose\n"); Debug(3,"CodecVideoClose\n");
if (video_decoder->VideoCtx) { if (video_decoder->VideoCtx) {
pthread_mutex_lock(&CodecLockMutex); pthread_mutex_lock(&CodecLockMutex);
#if 1
// avcodec_send_packet(video_ctx, NULL); frame = av_frame_alloc();
// while (avcodec_receive_frame(video_ctx,video_decoder->Frame) >= 0); avcodec_send_packet(video_decoder->VideoCtx, NULL);
while (avcodec_receive_frame(video_decoder->VideoCtx,frame) >= 0);
av_frame_free(&frame);
#endif
avcodec_close(video_decoder->VideoCtx); avcodec_close(video_decoder->VideoCtx);
av_freep(&video_decoder->VideoCtx); av_freep(&video_decoder->VideoCtx);
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);

View File

@@ -1910,15 +1910,14 @@ int VideoDecodeInput(VideoStream * stream)
} }
#if 0 #if 0
// clearing for normal channel switch has no advantage // clearing for normal channel switch has no advantage
if (stream->ClearClose /*|| stream->ClosingStream */ ) { if (stream->ClearClose || stream->ClosingStream ) {
int f; int f;
// FIXME: during replay all packets are always checked // FIXME: during replay all packets are always checked
// flush buffers, if close is in the queue // flush buffers, if close is in the queue
for (f = 0; f < filled; ++f) { for (f = 0; f < filled; ++f) {
if (stream->CodecIDRb[(stream->PacketRead + f) % VIDEO_PACKET_MAX] if (stream->CodecIDRb[(stream->PacketRead + f) % VIDEO_PACKET_MAX] == AV_CODEC_ID_NONE) {
== AV_CODEC_ID_NONE) {
if (f) { if (f) {
Debug(3, "video: cleared upto close\n"); Debug(3, "video: cleared upto close\n");
atomic_sub(f, &stream->PacketsFilled); atomic_sub(f, &stream->PacketsFilled);

586
video.c

File diff suppressed because it is too large Load Diff