Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No matching function to call for max #34

Open
frederick-m-k opened this issue Nov 5, 2022 · 0 comments
Open

No matching function to call for max #34

frederick-m-k opened this issue Nov 5, 2022 · 0 comments

Comments

@frederick-m-k
Copy link

Hi guys,

I tried to setup and install RASR for the first time following the Beginners How To on https://www-i6.informatik.rwth-aachen.de/rwth-asr/manual/index.php/Beginner%27s_Howto
I executed the scripts/requirements.sh and this executed well.

Error

When running the Makefile, I got an error for Ffmpeg.cc:

compiling Ffmpeg.cc
Ffmpeg.cc:365:61: error: no matching function for call to 'max'
                u32        sample_offset = static_cast<u32>(std::max(0l, av_rescale_q(time_offset, internal_->fmt_ctx->streams[internal_->stream_idx]->time_base, sr_norm)));
                                                            ^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/max.h:39:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long' vs. 'long long')
max(const _Tp& __a, const _Tp& __b)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/max.h:50:1: note: candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'long'
max(initializer_list<_Tp> __t, _Compare __comp)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/max.h:59:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided
max(initializer_list<_Tp> __t)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/max.h:30:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
1 error generated.

It seems, that the datatype of the parameter for the max function is wrong.

Solution

When changing the datatype from long to long long inside the Ffmpeg.cc, the error resolves.

fmt = static_cast<AVSampleFormat>(out_frame->format);
if (buffer_ == nullptr) {
     buffer_ = alloc_buffer(fmt);
     require(buffer_ != nullptr);
}

s64        time          = av_frame_get_best_effort_timestamp(out_frame);
s64        time_offset   = lastSeekTime_ - time;
AVRational sr_norm       = av_make_q(1, av_frame_get_sample_rate(out_frame));
u32        sample_offset = static_cast<u32>(std::max(0ll, av_rescale_q(time_offset, internal_->fmt_ctx->streams[internal_->stream_idx]->time_base, sr_norm)));     <-----
buffer_size              = add_to_buffer(buffer_, out_frame, fmt, sample_offset);
}
if (out_frame != frame) {
    av_frame_free(&out_frame);
}

Simply set the first parameter of the max function from 0l to 0ll.

This could be a versioning issue. Here my version information:

  • MacOS Cataline 12.0.1
  • gcc 12.2.0

Maybe someone can reproduce this and check if the error occurs as well.

Regards,
Frederick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant