Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:08:27+00:00 2026-06-17T16:08:27+00:00

I am building a project to view a video feed from an IP camera

  • 0

I am building a project to view a video feed from an IP camera in Android using FFmpeg 1.1.

I’m attempting to use swresample in an Android project and getting a floating point exception when calling swr_convert. I stepped through the swresample code and found one line in libswresample/swresample.c function swri_realloc_audio where the variables a->bps and a->ch_count are zero causing the FPE.

int swri_realloc_audio(AudioData *a, int count){
    int i, countb;
    AudioData old;

    LOGD("in swri_realloc_audio - bps[%d], ch_count[%d]", a->bps, a->ch_count);
    if(count < 0 || count > INT_MAX/2/a->bps/a->ch_count)
    return AVERROR(EINVAL);

01-21 17:29:09.612: D/swresample.c(18789): in swri_realloc_audio – bps[0], ch_count[0]

I found bug ticket #1834 in the FFmpeg project that sounds like the exact same issue, but it was resolved by calling swr_init. However, my code does call this function and still crashes. Here is my JNI code:

SwrContext* resampleCtx = swr_alloc_set_opts(NULL,
        AV_CH_LAYOUT_MONO, AV_SAMPLE_FMT_S16, pAudioCodecCtx->sample_rate,
        pAudioCodecCtx->channel_layout, pAudioCodecCtx->sample_fmt,
        pAudioCodecCtx->sample_rate, 0, 0);

swr_init(resampleCtx);
LOGD("Resample context initialized");

int dataSize = swr_convert(resampleCtx,
        &pAudioOutBuffer, AVCODEC_MAX_AUDIO_FRAME_SIZE / 2,
        (const uint8_t**) &(pFrame->data[0]), pFrame->nb_samples);
LOGD("Resample conversion complete");

swr_free(&resampleCtx);
LOGD("Obtained data size - dataSize[%d]", dataSize);

I’m confused because I don’t seem to have any control over the variable a in the swri_realloc_audio function. I stepped through the code and noticed that it is from the variable resampleCtx->postin. This variable is copied from resampleCtx->in in the swr_init function, but I don’t see where in is ever set to anything.

What am I doing wrong? Is it in my code or is there a problem in swresample?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:08:28+00:00Added an answer on June 17, 2026 at 4:08 pm

    The answer here is I made a mistake in the input. AV_SAMPLE_FMT_S16 is not supported by swr_convert and the function call to swr_init was failing. I just wasn’t checking the result to know this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to view the log when building an xcode (4.5) project from the
I am currently building my project locally using MVC. The user enters some search
I'm having problems building a project under the Android NDK. Most likely its due
I'm using qmake for building a project of mine. I have been trying to
I have a bit of a problem building my project. I'm getting the bellow
Hey guys, I'm building a project using Silverlight and the MVVM pattern, what I
It is my first time to use codeigniter in building my school project. Let
I am building a simple Android project in eclipse that uses the google-api-java-client .
I'm working on a Rails project at the moment, and I'm building a view
For a school project, I'm building an application using PreferenceScreen s as a framework.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.