Skip to content

Transcoding error because of faulty ExactSize class #3

@niekvse

Description

@niekvse

We got the following exception while trying to transcode a video:

E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android. 
 android.media.MediaCodec$CodecException: Error 0xfffffc0e
 at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:1967)
        at android.media.MediaCodec.configure(MediaCodec.java:1896)
        at com.otaliastudios.transcoder.transcode.VideoTrackTranscoder.setup(VideoTrackTranscoder.java:88)
        at com.otaliastudios.transcoder.engine.MediaTranscoderEngine.setupTrackTranscoders(MediaTranscoderEngine.java:213)
        at com.otaliastudios.transcoder.engine.MediaTranscoderEngine.transcode(MediaTranscoderEngine.java:106)
        at com.otaliastudios.transcoder.MediaTranscoder$1.call(MediaTranscoder.java:123)
        at com.otaliastudios.transcoder.MediaTranscoder$1.call(MediaTranscoder.java:111)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:784)

After some debugging, and some confused staring at the code below, it quickly became obvious what the culprit was :)

package com.otaliastudios.transcoder.strategy.size;

/**
 * A special {@link Size} that knows about which dimension is width
 * and which is height.
 *
 * See comments in {@link Resizer}.
 */
public class ExactSize extends Size {

    private int mWidth;
    private int mHeight;

    public ExactSize(int width, int height) {
        super(width, height);
    }

    public int getWidth() {
        return mWidth;
    }

    public int getHeight() {
        return mHeight;
    }
}

Actually setting the private fields from the constructor fixed the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions