Use av_frame_free / Log when couldn't reopen context.
This commit is contained in:
parent
866a5af427
commit
4f8d8e62b3
|
@ -36,7 +36,7 @@ AudioDecoder::~AudioDecoder() {
|
||||||
av_free(context_);
|
av_free(context_);
|
||||||
}
|
}
|
||||||
if (decoded_frame_) {
|
if (decoded_frame_) {
|
||||||
avcodec_free_frame(&decoded_frame_);
|
av_frame_free(&decoded_frame_);
|
||||||
}
|
}
|
||||||
if (current_frame_) {
|
if (current_frame_) {
|
||||||
delete current_frame_;
|
delete current_frame_;
|
||||||
|
@ -131,7 +131,7 @@ int AudioDecoder::PreparePacket(uint8_t* input, size_t size,
|
||||||
// TODO: Find a better way.
|
// TODO: Find a better way.
|
||||||
avcodec_close(context_);
|
avcodec_close(context_);
|
||||||
if (avcodec_open2(context_, codec_, NULL) < 0) {
|
if (avcodec_open2(context_, codec_, NULL) < 0) {
|
||||||
// Shit.
|
XELOGE("Audio Decoder: Failed to reopen context.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue