[APU] Fix ffmpeg upgrade related logspam
This commit is contained in:
@@ -26,6 +26,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#include "third_party/FFmpeg/libavcodec/avcodec.h"
|
#include "third_party/FFmpeg/libavcodec/avcodec.h"
|
||||||
#include "third_party/FFmpeg/libavutil/channel_layout.h"
|
#include "third_party/FFmpeg/libavutil/channel_layout.h"
|
||||||
|
#include "third_party/FFmpeg/libavutil/error.h"
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
@@ -577,16 +578,15 @@ void XmaContextMaster::Decode(XMA_CONTEXT_DATA* data) {
|
|||||||
assert_always();
|
assert_always();
|
||||||
}
|
}
|
||||||
ret = avcodec_receive_frame(av_context_, av_frame_);
|
ret = avcodec_receive_frame(av_context_, av_frame_);
|
||||||
/*
|
if (ret == AVERROR(EAGAIN)) {
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
return;
|
||||||
// TODO AVERROR_EOF???
|
}
|
||||||
break;
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
XELOGE("XmaContext {}: Error during decoding", id());
|
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
||||||
assert_always();
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||||
return; // TODO bail out
|
XELOGE("XmaContext {}: Error during decoding: {} ({})", id(), errbuf,
|
||||||
|
ret);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
assert_true(ret == 0);
|
assert_true(ret == 0);
|
||||||
|
|
||||||
@@ -831,6 +831,7 @@ int XmaContextMaster::PrepareDecoder(uint8_t* packet, int sample_rate,
|
|||||||
|
|
||||||
av_context_->sample_rate = sample_rate;
|
av_context_->sample_rate = sample_rate;
|
||||||
av_channel_layout_default(&av_context_->ch_layout, channels);
|
av_channel_layout_default(&av_context_->ch_layout, channels);
|
||||||
|
av_context_->flags2 |= AV_CODEC_FLAG2_SKIP_MANUAL;
|
||||||
|
|
||||||
if (avcodec_open2(av_context_, av_codec_, NULL) < 0) {
|
if (avcodec_open2(av_context_, av_codec_, NULL) < 0) {
|
||||||
XELOGE("XmaContext: Failed to reopen FFmpeg context");
|
XELOGE("XmaContext: Failed to reopen FFmpeg context");
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#include "third_party/FFmpeg/libavcodec/avcodec.h"
|
#include "third_party/FFmpeg/libavcodec/avcodec.h"
|
||||||
#include "third_party/FFmpeg/libavutil/channel_layout.h"
|
#include "third_party/FFmpeg/libavutil/channel_layout.h"
|
||||||
|
#include "third_party/FFmpeg/libavutil/error.h"
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
@@ -827,6 +828,7 @@ int XmaContextNew::PrepareDecoder(int sample_rate, bool is_two_channel) {
|
|||||||
|
|
||||||
av_context_->sample_rate = sample_rate;
|
av_context_->sample_rate = sample_rate;
|
||||||
av_channel_layout_default(&av_context_->ch_layout, channels);
|
av_channel_layout_default(&av_context_->ch_layout, channels);
|
||||||
|
av_context_->flags2 |= AV_CODEC_FLAG2_SKIP_MANUAL;
|
||||||
|
|
||||||
if (avcodec_open2(av_context_, av_codec_, NULL) < 0) {
|
if (avcodec_open2(av_context_, av_codec_, NULL) < 0) {
|
||||||
XELOGE("XmaContext: Failed to reopen FFmpeg context");
|
XELOGE("XmaContext: Failed to reopen FFmpeg context");
|
||||||
@@ -853,19 +855,22 @@ bool XmaContextNew::DecodePacket(AVCodecContext* av_context,
|
|||||||
const AVPacket* av_packet, AVFrame* av_frame) {
|
const AVPacket* av_packet, AVFrame* av_frame) {
|
||||||
auto ret = avcodec_send_packet(av_context, av_packet);
|
auto ret = avcodec_send_packet(av_context, av_packet);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
XELOGE("XmaContext {}: Error sending packet for decoding", id());
|
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
||||||
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||||
|
XELOGE("XmaContext {}: Error sending packet for decoding: {} ({})", id(),
|
||||||
|
errbuf, ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ret = avcodec_receive_frame(av_context, av_frame);
|
ret = avcodec_receive_frame(av_context, av_frame);
|
||||||
|
|
||||||
if (ret == AVERROR(EAGAIN)) {
|
if (ret == AVERROR(EAGAIN)) {
|
||||||
// Codec needs more input before producing output (e.g. first frame warmup).
|
// Codec needs more input before producing output (e.g. first frame warmup).
|
||||||
XELOGAPU("XmaContext {}: EAGAIN - codec needs more input (warmup frame)",
|
|
||||||
id());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
XELOGE("XmaContext {}: Error during decoding", id());
|
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
||||||
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||||
|
XELOGE("XmaContext {}: Error during decoding: {} ({})", id(), errbuf, ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#include "third_party/FFmpeg/libavcodec/avcodec.h"
|
#include "third_party/FFmpeg/libavcodec/avcodec.h"
|
||||||
#include "third_party/FFmpeg/libavutil/channel_layout.h"
|
#include "third_party/FFmpeg/libavutil/channel_layout.h"
|
||||||
|
#include "third_party/FFmpeg/libavutil/error.h"
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
@@ -635,19 +636,17 @@ void XmaContextOld::Decode(XMA_CONTEXT_DATA* data) {
|
|||||||
assert_always();
|
assert_always();
|
||||||
}
|
}
|
||||||
ret = avcodec_receive_frame(av_context_, av_frame_);
|
ret = avcodec_receive_frame(av_context_, av_frame_);
|
||||||
/*
|
if (ret == AVERROR(EAGAIN)) {
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
return;
|
||||||
// TODO AVERROR_EOF???
|
}
|
||||||
break;
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
XELOGE("XmaContext {}: Error - Decoding failed", id());
|
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
||||||
data->parser_error_status = 4; // TODO(Gliniak): Find all parsing errors
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||||
// and create enumerator from them
|
XELOGE("XmaContext {}: Error - Decoding failed: {} ({})", id(), errbuf,
|
||||||
|
ret);
|
||||||
|
data->parser_error_status = 4;
|
||||||
SwapInputBuffer(data);
|
SwapInputBuffer(data);
|
||||||
assert_always();
|
return;
|
||||||
return; // TODO bail out
|
|
||||||
}
|
}
|
||||||
assert_true(ret == 0);
|
assert_true(ret == 0);
|
||||||
|
|
||||||
@@ -935,6 +934,7 @@ int XmaContextOld::PrepareDecoder(uint8_t* packet, int sample_rate,
|
|||||||
|
|
||||||
av_context_->sample_rate = sample_rate;
|
av_context_->sample_rate = sample_rate;
|
||||||
av_channel_layout_default(&av_context_->ch_layout, channels);
|
av_channel_layout_default(&av_context_->ch_layout, channels);
|
||||||
|
av_context_->flags2 |= AV_CODEC_FLAG2_SKIP_MANUAL;
|
||||||
|
|
||||||
if (avcodec_open2(av_context_, av_codec_, NULL) < 0) {
|
if (avcodec_open2(av_context_, av_codec_, NULL) < 0) {
|
||||||
XELOGE("XmaContext: Failed to reopen FFmpeg context");
|
XELOGE("XmaContext: Failed to reopen FFmpeg context");
|
||||||
|
|||||||
Reference in New Issue
Block a user