mediacodec

Android MediaCodec API - Music Plays on Emulator, Not on the Device

那年仲夏 提交于 2019-12-25 08:12:03
问题 The code given below works fine on the emulator, but not the device. I found the following lines that looked suspicious to me: V/MediaExtractor(5030): Autodetected media content as 'audio/mpeg' with confidence 0.20 V/ChromiumHTTPDataSource(5030): mContentSize is undefined or network might be disconnected V/ChromiumHTTPDataSource(5030): mContentSize is undefined or network might be disconnected D/com.example.mediacodectest(5030): MIME TYPE: audio/mpeg I am looking for hints/suggestions. Thanks

audio codec dequeueInputBuffer returns -1 on device

隐身守侯 提交于 2019-12-25 05:27:40
问题 I'm trying to play some audio taken from an MPEG2 transport (.ts) file. I'm getting the audio stream via MediaExtractor, using readSampleData to copy samples to MediaCodec input buffers, then writing the MediaCodec output buffer to an AudioTrack. MediaExtractor indicates the audio MIME type as "audio/mp4a-latm". All this works wonderfully on a Nexus 7 2013 tablet. But it does not work at all on an inexpensive Neutab x7 tablet. The problem is that after a few samples, dequeueInputBuffer

android libstreaming with MedicaCodec APi buffer size not big enough error

折月煮酒 提交于 2019-12-24 14:28:25
问题 I am using libstreaming library and trying to stream with the RtspClient and the MedicaCodec API. I am testing with a galaxy s3 with android 4.4. The problem is that no matter if I use buffer to buffer or surface to buffer I get this error : java.lang.IllegalStateException: The decoder input buffer is not big enough (nal=181322, capacity=65536). and java.lang.RuntimeException: The decoder did not decode anything. MediaRecorder api works fine but the quality is so low I can't tell if I have a

AMediaExtractor setDataSource AMEDIA_ERROR_UNSUPPORTED error on Android Q

无人久伴 提交于 2019-12-24 04:54:11
问题 I am working with AMediaCodec and AMediaExtractor , all works fine on all devices(I hope:), but if I check the same code on Android Q (in my case Pixel 2XL) I got such error AMEDIA_ERROR_UNSUPPORTED . What I do bool NativeCodec::createStreamingMediaPlayer(const std::string &filename) { AMediaExtractor *ex = AMediaExtractor_new(); media_status_t err = AMediaExtractor_setDataSource(ex, filename.c_str());; <-- Here media status I got AMEDIA_ERROR_UNSUPPORTED if (err != AMEDIA_OK) { __android_log

How do I handle first output ByteBuffers of Android MediaCodec decoder?

六眼飞鱼酱① 提交于 2019-12-24 01:54:14
问题 I am trying to write an audio resampler using Android's MediaCodec suite. I am currently feeding an MP3 stereo audio file into a MediaExtractor which is then decoded by a MediaCodec. The sample rate of the source audio is 48000. What I don't understand is the first four output buffers I receive from the decoder: size 0, time 0 size 0, time 24000 size 4312, time 48000 size 4608, time 72000 size 4608, time 96000 etc. From this answer, this answer, and this article, I believe the first two

RTSP Client implementation on Android

泄露秘密 提交于 2019-12-24 01:54:11
问题 I have seen many questions related to this. Nevertheless there is not an answer for mine I think. I would like to use an already coded RTSP Client on Android to use with MediaCodec in order to capture a RTSP stream in H264 to then decode and display it. I have used VideoView and MediaPlayer which are well-known to support RTSP streaming in the .setDataSource method (file or rtsp/http path) (unlike MediaExtractor which only supports file or http), but the latency is to high for my purposes. I

RTSP Client implementation on Android

那年仲夏 提交于 2019-12-24 01:54:03
问题 I have seen many questions related to this. Nevertheless there is not an answer for mine I think. I would like to use an already coded RTSP Client on Android to use with MediaCodec in order to capture a RTSP stream in H264 to then decode and display it. I have used VideoView and MediaPlayer which are well-known to support RTSP streaming in the .setDataSource method (file or rtsp/http path) (unlike MediaExtractor which only supports file or http), but the latency is to high for my purposes. I

How do I handle first output ByteBuffers of Android MediaCodec decoder?

不想你离开。 提交于 2019-12-24 01:54:03
问题 I am trying to write an audio resampler using Android's MediaCodec suite. I am currently feeding an MP3 stereo audio file into a MediaExtractor which is then decoded by a MediaCodec. The sample rate of the source audio is 48000. What I don't understand is the first four output buffers I receive from the decoder: size 0, time 0 size 0, time 24000 size 4312, time 48000 size 4608, time 72000 size 4608, time 96000 etc. From this answer, this answer, and this article, I believe the first two

MediaCodec does not return buffers when Traceview Method Profiling is running

百般思念 提交于 2019-12-24 01:43:00
问题 It seems like MediaCodec does not return input or output buffers when Traceview Method Profiling is enabled. Steps to reproduce: In Eclipse, run Grafika. In Grafika, select "Play Video (TextureView)" and tap "Start". In Eclipse DDMS, click "Start Method Profiling" and leave the dialog box open. In Grafika, tap "Play" and quickly go back to Eclipse and click "OK". Once you click "OK", Grafika will appear to hang (it does not draw any more frames). Grafika verbose logs show that no input or

How to detect Android H.264 hardware acceleration capability

只谈情不闲聊 提交于 2019-12-23 21:18:47
问题 A large number, though not all, of Android devices support hardware acceleration of the H.264 video codec but not the VP8/VP9 codecs. To provide a higher quality user experience, we would like to select the codec that is hardware accelerated when possible. Hence, would like runtime detection of whether the specific device has H.264 hardware acceleration support or not and based on this will set the particular codecs that is used in the SDP for session negotiation of the webRTC peerconnection.