Merge pull request #1265 from comex/aframe

obs-ffmpeg: fill in more fields on audio frames
master
Jim 2018-04-25 05:57:44 -07:00 committed by GitHub
commit 273482dbe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -132,6 +132,10 @@ static bool initialize_codec(struct enc_encoder *enc)
warn("Failed to open AAC codec: %s", av_err2str(ret)); warn("Failed to open AAC codec: %s", av_err2str(ret));
return false; return false;
} }
enc->aframe->format = enc->context->sample_fmt;
enc->aframe->channels = enc->context->channels;
enc->aframe->channel_layout = enc->context->channel_layout;
enc->aframe->sample_rate = enc->context->sample_rate;
enc->frame_size = enc->context->frame_size; enc->frame_size = enc->context->frame_size;
if (!enc->frame_size) if (!enc->frame_size)

View File

@ -290,6 +290,11 @@ static bool open_audio_codec(struct ffmpeg_data *data)
return false; return false;
} }
data->aframe->format = context->sample_fmt;
data->aframe->channels = context->channels;
data->aframe->channel_layout = context->channel_layout;
data->aframe->sample_rate = context->sample_rate;
context->strict_std_compliance = -2; context->strict_std_compliance = -2;
ret = avcodec_open2(context, data->acodec, NULL); ret = avcodec_open2(context, data->acodec, NULL);