I’m working on Android hard decoding recently. Various attempts have been made on the compatible implementation of soft decoding and hard decoding. Later, I suddenly found that it was unable to decode normally, and even failed to open codec appeared.
Use Because it was copied once at first, but later, if hard decoding was used, the coder was selected again. As a result, the newly applied avcodec context failed to copy the operation parameters from stream to context. When I was RET = avcodec_ Open2 (CTX, codec, nullptr)
the return value is – 1, and the error message is “operation not permitted”. It’s a headache for me. For Android development, permissions, alas AVStream* st = pFormatCtx->streams[streamIdx];
codec_context_ = avcodec_alloc_context3(pCodec);
if (!codec_context_) {
AVLOGE("Failed to allocate the codec context.");
return -1;
}
if (avcodec_parameters_to_context(codec_context_, st->codecpar) < 0) {
AVLOGE("Failed to copy codec parameters to decoder context.");
return -1;
}
if (enable_hw_decode_) {
if (codec_context_->codec_id == AV_CODEC_ID_H264) {
pCodec = avcodec_find_decoder_by_name("h264_mediacodec");
if (pCodec) {
avcodec_free_context(&codec_context_);
codec_context_ = avcodec_alloc_context3(pCodec);
using_hw_decode_ = true;
}
}
}
int ret = 0;
if ((ret = avcodec_open2(codec_context_, pCodec, nullptr)) < 0) {
AVLOGE("Failed to open codec. ret = %d, %s", ret, PAVUtils::get_error_string(ret));
return -1;
}
using_ hw_ decode_ = Add
avcodec before true
_ parameters_ to_ context(codec_ context_, st-> codecpar); Code> and it will work normally
it's strange why the relevant parameters are not copied, instead of returning invalid_ Par returns no instead_ What about permit?
Read More:
- npm ERR! Error: EPERM: operation not permitted, open ‘C:\Program Files\nodejs\node_ Solution to cache / xxx
- NPM install Error: EPERM: operation not permitted, mkdir solution
- NPM report error: eperm: operation not permitted, unlink… Solution and clear cache_ modules
- EPERM: operation not permitted, symlink ‘../../’
- ADB remount failed: operation not permitted
- Docker CentOS Failed to get D-Bus connection: Operation not permitted
- [Vue] install vuex, error: eperm: operation not permitted, rename
- npm ERR Error: EPERM:operation not permitted, rename
- java.net.SocketException: socket failed: EPERM (Operation not permitted)
- docker service Failed to get D-Bus connection: Operation not permitted
- “NPM err! Error: eperm: operation not permitted” problem solving
- linux docker Error Failed to get D-Bus connection: Operation not permitted
- After adb is connected to an android phone, remount failed: operation not permitted when adb remount is a roundabout solution
- AVD prompt Error:Could not Parse error string solution
- Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
- The solution of Hibernate query returning all null lists
- Android 9.0 error: net:ERR_ CLEARTEXT_ NOT_ Permitted solution
- The solution of comments are not permitted in JSON. (521) in vscode
- Solution to “550 create directory operation failed” in FTP operation file
- Error in the latest version of ffmpeg: ‘codec’_ FLAG_ GLOBAL_ Header ‘undeclared identifier solution