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

Implement an FfmpegVideoRenderer #7132

Open
wants to merge 7 commits into
base: dev-v2
Choose a base branch
from

Conversation

haohaozaici
Copy link

For more information, see #7079

@ojw28 ojw28 self-requested a review March 23, 2020 17:49
@ojw28 ojw28 self-assigned this Mar 23, 2020
@ojw28
Copy link
Contributor

ojw28 commented Mar 30, 2020

Thanks for re-sending this! We will figure out a way to get it merged.

@hqzxzwb
Copy link

hqzxzwb commented Apr 20, 2020

Amazing work! We are longing for this feature.

@volser
Copy link

volser commented May 3, 2020

@haohaozaici I tried to build iand test it but no luck with build

[x86] SharedLibrary  : libffmpeg.so
ffmpeg_jni.cc:411: error: undefined reference to 'ANativeWindow_release'
ffmpeg_jni.cc:415: error: undefined reference to 'ANativeWindow_fromSurface'
ffmpeg_jni.cc:641: error: undefined reference to 'ANativeWindow_setBuffersGeometry'
ffmpeg_jni.cc:654: error: undefined reference to 'ANativeWindow_lock'
ffmpeg_jni.cc:722: error: undefined reference to 'ANativeWindow_unlockAndPost'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/usr/local/android-sdk-25.2.3/ndk-bundle/build/core/build-binary.mk:725: /ExoPlayer/extensions/ffmpeg/src/main/obj/local/x86/libffmpeg.so] Error 1
make: *** Waiting for unfinished jobs....
[armeabi-v7a] SharedLibrary  : libffmpeg.so
ffmpeg_jni.cc:641: error: undefined reference to 'ANativeWindow_setBuffersGeometry'
ffmpeg_jni.cc:654: error: undefined reference to 'ANativeWindow_lock'
ffmpeg_jni.cc:722: error: undefined reference to 'ANativeWindow_unlockAndPost'
ffmpeg_jni.cc:411: error: undefined reference to 'ANativeWindow_release'
ffmpeg_jni.cc:415: error: undefined reference to 'ANativeWindow_fromSurface'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/usr/local/android-sdk-25.2.3/ndk-bundle/build/core/build-binary.mk:725: 
...

do you have any ideas, thanks!

@haohaozaici
Copy link
Author

haohaozaici commented May 3, 2020

@volser You can add -landroid to the line LOCAL_LDLIBS to compile successfully.

LOCAL_LDLIBS := -Lffmpeg/android-libs/$(TARGET_ARCH_ABI) -landroid -llog

Because I am using cmake to develop and debug, you also need to modify com.google.android.exoplayer2.ext.ffmpeg.FfmpegLibrary#LOADER to load the so file correctly:

private static final LibraryLoader LOADER =
    new LibraryLoader("avutil", "swresample", "avcodec", "ffmpeg");

It should be noted that because of my personal reasons, this pull request is developing very slowly, and currently supported scenarios are very limited!

@ojw28
Copy link
Contributor

ojw28 commented May 6, 2020

I've been able to get adaptive playback working with this pull request by making some separate changes to DecoderVideoRenderer. I'll see if I can get those submitted into dev-v2 sometime soon!

@Exeu
Copy link

Exeu commented Aug 27, 2020

What is the Status here? Half year ago and no Update?

@Dimon70007
Copy link

Hi guys. When will this branch be merged? ffmpeg fallback should be a great feature

@ojw28
Copy link
Contributor

ojw28 commented Oct 11, 2020

See #2159 (comment).

void CopyPlane(const uint8_t *source, int source_stride, uint8_t *destination,
int destination_stride, int width, int height) {
while (height--) {
std::memcpy(destination, source, width);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if this is the wrong place to put this but,

It seems like CopyPlane needs to take the strides into account when copying data. Something like
std::memcpy(destination, source, std::min(std::min(width, source_stride), destination_stride));
prevents reading past the end of source or writing past the end of destination.

I'm pretty sure this is responsible for the issue reported here #9459

@FongMi
Copy link

FongMi commented Nov 15, 2022

Please fix conflicts

rabbitknight added a commit to rabbitknight/media that referenced this pull request Aug 2, 2024
rabbitknight added a commit to rabbitknight/media that referenced this pull request Aug 2, 2024
rabbitknight added a commit to rabbitknight/media that referenced this pull request Aug 4, 2024
rabbitknight added a commit to rabbitknight/media that referenced this pull request Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants