I am trying to create a dog photo/video generator app using Flutter and Dart. It basically sends a get request to a website called random.Dog to get a url to show on my app. Sometimes the url is a video and sometimes it is a img. When it is a video my app just buffers and this console message keeps on coming:
E/flutter ( 4345): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception:
MissingPluginException(No implementation found for method init on channel better_player_channel)
E/flutter ( 4345): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
E/flutter ( 4345): <asynchronous suspension>
E/flutter ( 4345):
E/flutter ( 4345): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method create on channel better_player_channel)
E/flutter ( 4345): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
E/flutter ( 4345): <asynchronous suspension>
E/flutter ( 4345): #1 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:358:43)
E/flutter ( 4345): <asynchronous suspension>
E/flutter ( 4345): #2 MethodChannelVideoPlayer.create (package:better_player/src/video_player/method_channel_video_player.dart:38:9)
E/flutter ( 4345): <asynchronous suspension>
E/flutter ( 4345): #3 VideoPlayerController._create (package:better_player/src/video_player/video_player.dart:202:18)
E/flutter ( 4345): <asynchronous suspension>
E/flutter ( 4345):
I/flutter ( 4345): {"fileSizeBytes":3294982,"url":"https://random.dog/a922da9a-437c-4400-9d94-f36ec2e5452c.mp4"}
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 2)
D/BufferPoolAccessor2.0( 4345): bufferpool2 0xeac5e4a8 : 5(40960 size) total buffers - 5(40960 size) used buffers - 1/7 (recycle/alloc) - 6/45600 (fetch/transfer)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 0)
I/CCodecConfig( 4345): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 4345): c2 config diff is c2::i32 coding.drc.compression-mode.value = 3
W/Codec2Client( 4345): query -- param skipped: index = 1342179345.
W/Codec2Client( 4345): query -- param skipped: index = 2415921170.
W/Codec2Client( 4345): query -- param skipped: index = 1610614798.
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:Output[N]] popFromStashAndRegister: output format changed to AMessage(what = 0x00000000) = {
D/CCodecBuffers( 4345): int32_t aac-drc-album-mode = 0
D/CCodecBuffers( 4345): int32_t aac-drc-boost-level = 127
D/CCodecBuffers( 4345): int32_t aac-drc-cut-level = 127
D/CCodecBuffers( 4345): int32_t aac-drc-effect-type = 3
D/CCodecBuffers( 4345): int32_t aac-drc-heavy-compression = 3
D/CCodecBuffers( 4345): int32_t aac-drc-output-loudness = -1
D/CCodecBuffers( 4345): int32_t aac-encoded-target-level = -1
D/CCodecBuffers( 4345): int32_t aac-max-output-channel_count = 8
D/CCodecBuffers( 4345): int32_t aac-target-ref-level = 64
D/CCodecBuffers( 4345): int32_t channel-count = 1
D/CCodecBuffers( 4345): string mime = "audio/raw"
D/CCodecBuffers( 4345): int32_t sample-rate = 44100
D/CCodecBuffers( 4345): }
D/CCodecConfig( 4345): c2 config diff is c2::i32 coding.drc.compression-mode.value = 1
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:Output[N]] popFromStashAndRegister: output format changed to AMessage(what = 0x00000000) = {
D/CCodecBuffers( 4345): int32_t aac-drc-album-mode = 0
D/CCodecBuffers( 4345): int32_t aac-drc-boost-level = 127
D/CCodecBuffers( 4345): int32_t aac-drc-cut-level = 127
D/CCodecBuffers( 4345): int32_t aac-drc-effect-type = 3
D/CCodecBuffers( 4345): int32_t aac-drc-heavy-compression = 1
D/CCodecBuffers( 4345): int32_t aac-drc-output-loudness = -1
D/CCodecBuffers( 4345): int32_t aac-encoded-target-level = -1
D/CCodecBuffers( 4345): int32_t aac-max-output-channel_count = 8
D/CCodecBuffers( 4345): int32_t aac-target-ref-level = 64
D/CCodecBuffers( 4345): int32_t channel-count = 1
D/CCodecBuffers( 4345): string mime = "audio/raw"
D/CCodecBuffers( 4345): int32_t sample-rate = 44100
D/CCodecBuffers( 4345): }
D/BufferPoolAccessor2.0( 4345): bufferpool2 0xeac5e4a8 : 5(40960 size) total buffers - 5(40960 size) used buffers - 1/7 (recycle/alloc) - 6/45824 (fetch/transfer)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 1)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 0)
I/chatty ( 4345): uid=10154(com.example.randomdog) HwBinder:4345_1 identical 4 lines
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 0)
D/BufferPoolAccessor2.0( 4345): bufferpool2 0xeac5e4a8 : 5(40960 size) total buffers - 5(40960 size) used buffers - 1/7 (recycle/alloc) - 6/46039 (fetch/transfer)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 3)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 4)
D/BufferPoolAccessor2.0( 4345): bufferpool2 0xeac5e4a8 : 5(40960 size) total buffers - 5(40960 size) used buffers - 1/7 (recycle/alloc) - 6/46268 (fetch/transfer)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 2)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 0)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 1)
D/BufferPoolAccessor2.0( 4345): bufferpool2 0xeac5e4a8 : 5(40960 size) total buffers - 5(40960 size) used buffers - 1/7 (recycle/alloc) - 6/46498 (fetch/transfer)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 3)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 0)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 4)
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:1D-Input.Impl[N]] codec released a buffer owned by client (index 0)
I/CCodecConfig( 4345): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 4345): c2 config diff is c2::i32 coding.drc.compression-mode.value = 3
W/Codec2Client( 4345): query -- param skipped: index = 1342179345.
W/Codec2Client( 4345): query -- param skipped: index = 2415921170.
W/Codec2Client( 4345): query -- param skipped: index = 1610614798.
D/CCodecBuffers( 4345): [c2.android.aac.decoder#768:Output[N]] popFromStashAndRegister: output format changed to AMessage(what = 0x00000000) = {
And my video doenst show up on my emulator. What seems to be the problem and how do I fix it? My minimal code:
import 'package:better_player/better_player.dart';
void main() => runApp(MaterialApp(home: RandomDog()));
class RandomDog extends StatefulWidget {
#override
_RandomDogState createState() => _RandomDogState();
}
class _RandomDogState extends State<RandomDog> {
var headers = {'Content-Type': 'application/json'};
var body = {};
var video = false;
var img = false;
var message;
var loading = true;
var _controller;
#override
void initState() {
getDog();
super.initState();
}
getDog() async {
loading=true;
var response = await http.get(Uri.https('random.dog', '/woof.json'));
print(response.body);
message = jsonDecode(response.body);
if (message['url'].contains('gif') || message['url'].contains('png') ||
message['url'].contains('jpg') || message['url'].contains('jpeg')) {
video = false;
img = true;
} else {
video = true;
img = false;
}
loading = false;
setState(() {
});
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
. . .
body: Center(
child: loading == true ? CircularProgressIndicator() : Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Visibility(visible: img,
child: Image.network(message['url'], fit: BoxFit.scaleDown,)),
// Visibility(visible: video,child: VideoApp(url:message['url'])),
video == true? CircularProgressIndicator() :
Visibility(visible: video, child: BetterPlayer.network(message['url'],betterPlayerConfiguration: BetterPlayerConfiguration(autoPlay: true),)), //Chewie(controller: _controller,)
OutlinedButton(onPressed: () async {
getDog();
}, child: Text('GENERATE')),
],
),
),
);
}
}
Hope this solution work for you, Try to initialize your betterPlayer in your function getDog() by using :
BetterPlayerController _betterPlayerController; //declare first
BetterPlayerDataSource betterPlayerDataSource = BetterPlayerDataSource(
BetterPlayerDataSourceType.network,
"message[url]");
_betterPlayerController = BetterPlayerController(
BetterPlayerConfiguration(),
betterPlayerDataSource: betterPlayerDataSource);
after that in your widget after CircularProgressIndicator you add this :
BetterPlayer(
controller: _betterPlayerController, ),
Related
i am trying to implent test ads on my Flutter app. So far, what i notice is that 3 out of 4 times my test ad rewarded video are showing, but sometimes they are not. This is what i am getting when the video is not loading. Since the other times the video laods, i don't think that is a setup problem, but i am attaching my code.
This is the error: (Real device, Samsung Galaxy S10)
I/DynamiteModule( 9385): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:221908400
I/DynamiteModule( 9385): Selected remote version of com.google.android.gms.ads.dynamite, version >= 221908400
V/DynamiteModule( 9385): Dynamite loader version >= 2, using loadModule2NoCrashUtils
I/Ads ( 9385): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("57D8CCEE680443B3894B93AB5E6F61C8")) to get test ads on this device.
W/Ads ( 9385): Not retrying to fetch app settings
I/ViewRootImpl#563214[MainActivity]( 9385): ViewPostIme pointer 0
I/ViewRootImpl#563214[MainActivity]( 9385): ViewPostIme pointer 1
I/ExoPlayerImpl( 9385): Init ExoPlayerLib/2.4.2 [beyond1, SM-G973F, samsung, 31]
D/MetadataUtil( 9385): Skipped unknown metadata entry: gsst
D/MetadataUtil( 9385): Skipped unknown metadata entry: gstd
I/CCodec ( 9385): state->set(ALLOCATING)
I/CCodec ( 9385): allocate(c2.android.aac.decoder)
I/CCodec ( 9385): setting up 'default' as default (vendor) store
I/CCodec ( 9385): Created component [c2.android.aac.decoder]
I/CCodec ( 9385): state->set(ALLOCATED)
D/CCodecConfig( 9385): read media type: audio/mp4a-latm
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 9385): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig( 9385): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 9385): c2 config diff is Dict {
D/CCodecConfig( 9385): c2::u32 coded.aac-packaging.value = 0
D/CCodecConfig( 9385): c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 9385): c2::u32 coded.pl.level = 0
D/CCodecConfig( 9385): c2::u32 coded.pl.profile = 8192
D/CCodecConfig( 9385): c2::i32 coding.drc.album-mode.value = 0
D/CCodecConfig( 9385): c2::float coding.drc.attenuation-factor.value = 1
D/CCodecConfig( 9385): c2::float coding.drc.boost-factor.value = 1
D/CCodecConfig( 9385): c2::i32 coding.drc.compression-mode.value = 3
D/CCodecConfig( 9385): c2::i32 coding.drc.effect-type.value = 3
D/CCodecConfig( 9385): c2::float coding.drc.encoded-level.value = 0.25
D/CCodecConfig( 9385): c2::float coding.drc.reference-level.value = -16
D/CCodecConfig( 9385): c2::u32 input.buffers.max-size.value = 8192
D/CCodecConfig( 9385): c2::u32 input.delay.value = 0
D/CCodecConfig( 9385): string input.media-type.value = "audio/mp4a-latm"
D/CCodecConfig( 9385): c2::u32 output.delay.value = 2
D/CCodecConfig( 9385): c2::float output.drc.output-loudness.value = 0.25
D/CCodecConfig( 9385): string output.media-type.value = "audio/raw"
D/CCodecConfig( 9385): c2::u32 raw.channel-count.value = 1
D/CCodecConfig( 9385): c2::u32 raw.max-channel-count.value = 8
D/CCodecConfig( 9385): c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 9385): }
D/CCodec ( 9385): [c2.android.aac.decoder] buffers are bound to CCodec for this session
I/CCodec ( 9385): appPid(9385) width(0) height(0)
D/CCodecConfig( 9385): no c2 equivalents for language
D/CCodecConfig( 9385): no c2 equivalents for flags
D/CCodecConfig( 9385): config failed => CORRUPTED
D/CCodecConfig( 9385): c2 config diff is c2::u32 raw.channel-count.value = 2
W/Codec2Client( 9385): query -- param skipped: index = 1107298332.
D/CCodec ( 9385): client requested max input size 540, which is smaller than what component recommended (8192); overriding with component recommendation.
W/CCodec ( 9385): This behavior is subject to change. It is recommended that app developers double check whether the requested max input size is in reasonable range.
D/CCodec ( 9385): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec ( 9385): int32_t aac-drc-album-mode = 0
D/CCodec ( 9385): int32_t aac-drc-boost-level = 127
D/CCodec ( 9385): int32_t aac-drc-cut-level = 127
D/CCodec ( 9385): int32_t aac-drc-effect-type = 3
D/CCodec ( 9385): int32_t aac-encoded-target-level = -1
D/CCodec ( 9385): int32_t aac-max-output-channel_count = 8
D/CCodec ( 9385): int32_t aac-target-ref-level = 64
D/CCodec ( 9385): int32_t bitrate = 64000
D/CCodec ( 9385): int32_t channel-count = 2
D/CCodec ( 9385): int32_t level = 0
D/CCodec ( 9385): int32_t max-input-size = 8192
D/CCodec ( 9385): string mime = "audio/mp4a-latm"
D/CCodec ( 9385): int32_t profile = 2
D/CCodec ( 9385): int32_t sample-rate = 44100
D/CCodec ( 9385): int64_t durationUs = 0
D/CCodec ( 9385): }
D/CCodec ( 9385): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec ( 9385): int32_t aac-drc-album-mode = 0
D/CCodec ( 9385): int32_t aac-drc-boost-level = 127
D/CCodec ( 9385): int32_t aac-drc-cut-level = 127
D/CCodec ( 9385): int32_t aac-drc-effect-type = 3
D/CCodec ( 9385): int32_t aac-drc-output-loudness = -1
D/CCodec ( 9385): int32_t aac-encoded-target-level = -1
D/CCodec ( 9385): int32_t aac-max-output-channel_count = 8
D/CCodec ( 9385): int32_t aac-target-ref-level = 64
D/CCodec ( 9385): int32_t channel-count = 2
D/CCodec ( 9385): string mime = "audio/raw"
D/CCodec ( 9385): int32_t sample-rate = 44100
D/CCodec ( 9385): }
I/CCodecConfig( 9385): query failed after returning 19 values (BAD_INDEX)
I/CCodec ( 9385): state->set(STARTING)
W/Codec2Client( 9385): query -- param skipped: index = 1342179345.
W/Codec2Client( 9385): query -- param skipped: index = 2415921170.
W/Codec2Client( 9385): query -- param skipped: index = 1610614798.
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] Created input block pool with allocatorID 16 => poolID 48 - OK (0)
I/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] Created output block pool with allocatorID 16 => poolID 277 - OK
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] Configured output block pool ids 277 => OK
I/CCodec ( 9385): state->set(RUNNING)
I/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] 4 initial input buffers available
I/ACodec ( 9385): [] Now uninitialized
I/ACodec ( 9385): [] onAllocateComponent
I/OMXClient( 9385): IOmx service obtained
E/ACodec ( 9385): Unable to instantiate codec 'OMX.Exynos.avc.dec' with err 0xfffffff4.
E/ACodec ( 9385): signalError(omxError 0xfffffff4, internalError -12)
E/MediaCodec( 9385): Codec reported err 0xfffffff4, actionCode 0, while in state 1/INITIALIZING
W/MediaCodec-JNI( 9385): try to release MediaCodec from JMediaCodec::~JMediaCodec()...
W/MediaCodec-JNI( 9385): done releasing MediaCodec from JMediaCodec::~JMediaCodec().
E/ExoPlayerImplInternal( 9385): Renderer error.
E/ExoPlayerImplInternal( 9385): com.google.android.gms.ads.exoplayer3.c
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.N(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:20)
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.G(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:4)
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.video.h.G(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:1)
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.z(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:3)
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.n.handleMessage(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:42)
E/ExoPlayerImplInternal( 9385): at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal( 9385): at android.os.Looper.loopOnce(Looper.java:226)
E/ExoPlayerImplInternal( 9385): at android.os.Looper.loop(Looper.java:313)
E/ExoPlayerImplInternal( 9385): at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal( 9385): Caused by: com.google.android.gms.ads.exoplayer3.mediacodec.b: Decoder init failed: OMX.Exynos.avc.dec, Format(1, null, video/avc, -1, null, [1280, 720, -1.0], [-1, -1])
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.N(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:19)
E/ExoPlayerImplInternal( 9385): ... 8 more
E/ExoPlayerImplInternal( 9385): Caused by: android.media.MediaCodec$CodecException: Failed to initialize OMX.Exynos.avc.dec, error 0xfffffff4
E/ExoPlayerImplInternal( 9385): at android.media.MediaCodec.native_setup(Native Method)
E/ExoPlayerImplInternal( 9385): at android.media.MediaCodec.<init>(MediaCodec.java:1961)
E/ExoPlayerImplInternal( 9385): at android.media.MediaCodec.createByCodecName(MediaCodec.java:1938)
E/ExoPlayerImplInternal( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.N(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:9)
E/ExoPlayerImplInternal( 9385): ... 8 more
I/CCodec ( 9385): state->set(STOPPING)
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
W/Ads ( 9385): Precache error
W/Ads ( 9385): com.google.android.gms.ads.exoplayer3.c
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.N(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:20)
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.G(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:4)
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.video.h.G(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:1)
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.z(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:3)
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.n.handleMessage(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:42)
W/Ads ( 9385): at android.os.Handler.dispatchMessage(Handler.java:102)
W/Ads ( 9385): at android.os.Looper.loopOnce(Looper.java:226)
W/Ads ( 9385): at android.os.Looper.loop(Looper.java:313)
W/Ads ( 9385): at android.os.HandlerThread.run(HandlerThread.java:67)
W/Ads ( 9385): Caused by: com.google.android.gms.ads.exoplayer3.mediacodec.b: Decoder init failed: OMX.Exynos.avc.dec, Format(1, null, video/avc, -1, null, [1280, 720, -1.0], [-1, -1])
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.N(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:19)
W/Ads ( 9385): ... 8 more
W/Ads ( 9385): Caused by: android.media.MediaCodec$CodecException: Failed to initialize OMX.Exynos.avc.dec, error 0xfffffff4
W/Ads ( 9385): at android.media.MediaCodec.native_setup(Native Method)
W/Ads ( 9385): at android.media.MediaCodec.<init>(MediaCodec.java:1961)
W/Ads ( 9385): at android.media.MediaCodec.createByCodecName(MediaCodec.java:1938)
W/Ads ( 9385): at com.google.android.gms.ads.exoplayer3.mediacodec.c.N(:com.google.android.gms.policy_ads_fdr_dynamite#221908400#221908400057.447330857.447330857:9)
W/Ads ( 9385): ... 8 more
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
D/CCodecBufferChannel( 9385): [c2.android.aac.decoder#324] MediaCodec discarded an unknown buffer
I/CCodec ( 9385): state->set(ALLOCATED)
I/CCodec ( 9385): state->set(RELEASING)
I/CCodec ( 9385): [c2.android.aac.decoder] release(1)
I/CCodec ( 9385): state->set(RELEASED)
I/hw-BpHwBinder( 9385): onLastStrongRef automatically unlinking death recipients
I/MediaCodec( 9385): Codec shutdown complete
I/ViewRootImpl#563214[MainActivity]( 9385): ViewPostIme pointer 0
I/ViewRootImpl#563214[MainActivity]( 9385): ViewPostIme pointer 1
D/BufferPoolAccessor2.0( 9385): bufferpool2 0x777c2d7a08 : 0(0 size) total buffers - 0(0 size) used buffers - 1/6 (recycle/alloc) - 5/8 (fetch/transfer)
D/BufferPoolAccessor2.0( 9385): evictor expired: 1, evicted: 1
I/ViewRootImpl#563214[MainActivity]( 9385): ViewPostIme pointer 0
I/ViewRootImpl#563214[MainActivity]( 9385): ViewPostIme pointer 1
D/BufferPoolAccessor2.0( 9385): evictor expired: 1, evicted: 0
D/BufferPoolAccessor2.0( 9385): bufferpool2 0x777c3571a8 : 0(0 size) total buffers - 0(0 size) used buffers - 1/6 (recycle/alloc) - 5/8 (fetch/transfer)
D/BufferPoolAccessor2.0( 9385): evictor expired: 1, evicted: 1
I/pestini.essenc( 9385): Background concurrent copying GC freed 573699(23MB) AllocSpace objects, 4(80KB) LOS objects, 43% free, 30MB/54MB, paused 232us,136us total 120.237ms
I/Ads ( 9385): Ad failed to load : 0
I/flutter ( 9385): Failed to load a rewarded ad: Internal error.
W/Ads ( 9385): Failed to preload url gcache://video/media/8744318498482049952?url=https%3A%2F%2Frr1---sn-uxaxpu5ap5-apol.googlevideo.com%2Fvideoplayback%3Fexpire%3D1661099020%26ei%3DjOsBY_yGIor_gAehs6ow%26ip%3D79.21.162.29%26id%3D795a0f5850e653a0%26itag%3D22%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DLS%26mm%3D31%26mn%3Dsn-uxaxpu5ap5-apol%26ms%3Dau%26mv%3Dm%26mvi%3D1%26pl%3D24%26susc%3Dgvp%26acao%3Dyes%26ctier%3DL%26mime%3Dvideo%252Fmp4%26vprv%3D1%26dur%3D5.038%26lmt%3D1606000670604054%26mt%3D1661069832%26txp%3D1211222%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Csusc%252Cacao%252Cctier%252Cmime%252Cvprv%252Cdur%252Clmt%26sig%3DAOq0QJ8wRQIgGnvHqkqA7FF7lDY492LRjEjdWvBXmcPJ7xXW7TyqniICIQDPrVizMFRdNZ_sfM9-LixHUPOCGqZuFQiFX131KzmH4w%253D%253D%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%26lsig%3DAG3C_xAwRQIgVaTrgTmchNN6aeKKZ3jqu_Jn8ufCI8Rc0FS9eq4kMLMCIQDRyVb6NYdv4le9BEjPs4N8loanOFOPpM27bOZ22ZM2gQ%253D%253D%26cpn%3DnVl-a3BtlRhfCqIr%26ic%3Dgmasdk&tag.duration=5038&tag.check_url=https%3A%2F%2Frr1---sn-uxaxpu5ap5-apol.googlevideo.com%2Fvideoplayback%3Fexpire%3D1661099020%26ei%3DjOsBY_yGIor_gAehs6ow%26ip%3D79.21.162.29%26id%3D795a0f5850e653a0%26itag%3D22%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DLS%26mm%3D31%26mn%3Dsn-uxaxpu5ap5-apol%26ms%3Dau%26mv%3Dm%26mvi%3D1%26pl%3D24%26susc%3Dgvp%26acao%3Dyes%26ctier%3DL%26mime%3Dvideo%2Fmp4%26vprv%3D1%26dur%3D5.038%26lmt%3D1606000670604054%26mt%3D1661069832%26txp%3D1211222%26sparams%3Dexpire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Csusc%2Cacao%2Cctier%2Cmime%2Cvprv%2Cdur%2Clmt%26sig%3DAOq0QJ8wRQIgGnvHqkqA7FF7lDY492LRjEjdWvBXmcPJ7xXW7TyqniICIQDPrVizMFRdNZ_sfM9-LixHUPOCGqZuFQiFX131KzmH4w%3D%3D%26lsparams%3Dmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%26lsig%3DAG3C_xAwRQIgVaTrgTmchNN6aeKKZ3jqu_Jn8ufCI8Rc0FS9eq4kMLMCIQDRyVb6NYdv4le9BEjPs4N8loanOFOPpM27bOZ22ZM2gQ%3D%3D%26cpn%3DnVl-a3BtlRhfCqIr Exception: ExoPlayer was released during preloading.
W/Ads ( 9385): #004 The webview is destroyed. Ignoring action.
W/Ads ( 9385): Failed to preload url gcache://video/media/-438303185308675417?url=https%3A%2F%2Frr2---sn-uxaxpu5ap5-apol.googlevideo.com%2Fvideoplayback%3Fexpire%3D1661098796%26ei%3DrOoBY-STOoXix_APlPi-sAI%26ip%3D79.21.162.29%26id%3Df9ead5933fc112a7%26itag%3D22%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DEA%26mm%3D31%26mn%3Dsn-uxaxpu5ap5-apol%26ms%3Dau%26mv%3Dm%26mvi%3D2%26pcm2cms%3Dyes%26pl%3D24%26susc%3Dgvp%26acao%3Dyes%26ctier%3DL%26mime%3Dvideo%252Fmp4%26vprv%3D1%26dur%3D7.267%26lmt%3D1609247274254961%26mt%3D1661069127%26txp%3D1211222%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Csusc%252Cacao%252Cctier%252Cmime%252Cvprv%252Cdur%252Clmt%26sig%3DAOq0QJ8wRQIhAKtTUzu10duuyNKA-tGUC1RWgchGK_uGHSDZdrav3sdGAiBCwnEMg6POUb_KHgvB6F8pf_4KmvyXoLJhS3_q8b-Iug%253D%253D%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpcm2cms%252Cpl%26lsig%3DAG3C_xAwRAIgTTAj7kuZyg1hKG_X6a9PcblwqoCCmRioT58RU7RQGccCIB7KyWOT9_iD5cpwMF9gEGrUgKNYFgees0Wxq_VTQeca%26cpn%3DKwm_j2j_MqowGqx3%26ic%3Dgmasdk&tag.duration=7267&tag.check_url=https%3A%2F%2Frr2---sn-uxaxpu5ap5-apol.googlevideo.com%2Fvideoplayback%3Fexpire%3D1661098796%26ei%3DrOoBY-STOoXix_APlPi-sAI%26ip%3D79.21.162.29%26id%3Df9ead5933fc112a7%26itag%3D22%26source%3Dyoutube%26requiressl%3Dyes%26mh%3DEA%26mm%3D31%26mn%3Dsn-uxaxpu5ap5-apol%26ms%3Dau%26mv%3Dm%26mvi%3D2%26pcm2cms%3Dyes%26pl%3D24%26susc%3Dgvp%26acao%3Dyes%26ctier%3DL%26mime%3Dvideo%2Fmp4%26vprv%3D1%26dur%3D7.267%26lmt%3D1609247274254961%26mt%3D1661069127%26txp%3D1211222%26sparams%3Dexpire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Csusc%2Cacao%2Cctier%2Cmime%2Cvprv%2Cdur%2Clmt%26sig%3DAOq0QJ8wRQIhAKtTUzu10duuyNKA-tGUC1RWgchGK_uGHSDZdrav3sdGAiBCwnEMg6POUb_KHgvB6F8pf_4KmvyXoLJhS3_q8b-Iug%3D%3D%26lsparams%3Dmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%26lsig%3DAG3C_xAwRAIgTTAj7kuZyg1hKG_X6a9PcblwqoCCmRioT58RU7RQGccCIB7KyWOT9_iD5cpwMF9gEGrUgKNYFgees0Wxq_VTQeca%26cpn%3DKwm_j2j_MqowGqx3 Exception: Timeout reached. Limit: 300000 ms
This is how i implemented rewared video test ads.
bool _isRewardedAdReady = false;
RewardedAd? _rewardedAd;
void _loadRewardedAd() {
RewardedAd.load(
adUnitId: AdHelper.rewardedAdUnitId,
request: AdRequest(),
rewardedAdLoadCallback: RewardedAdLoadCallback(
onAdLoaded: (ad) {
_rewardedAd = ad;
ad.fullScreenContentCallback = FullScreenContentCallback(
onAdDismissedFullScreenContent: (ad) {
setState(() {
_isRewardedAdReady = false;
});
_loadRewardedAd();
},
);
setState(() {
_isRewardedAdReady = true;
});
},
onAdFailedToLoad: (err) {
print('Failed to load a rewarded ad: ${err.message}');
setState(() {
_isRewardedAdReady = false;
});
},
),
);
}
#override
void initState() {
super.initState();
_loadRewardedAd();
}
#override
void dispose() {
_rewardedAd?.dispose();
super.dispose();
}
On the widget, i want to use to display the ad, i have this code
if (isRewardedAdReady) {
rewardedAd?.show(onUserEarnedReward:
(AdWithoutView ad, RewardItem reward) {
print(
'$ad with reward $RewardItem(${reward.amount}, ${reward.type}');
});
}
The implementation looks correct. You can may be check if the rewarded video is loaded or not before you load a new one..
if(isRewardedAdReady == false)
{
load a new ad here;
}
Also When you open the screen on which you wish to show the ad first load the ad and keep it ready. Then when you wish to display it check if its ready and display it. That gives you some time to load the ad. In the current implementation I see that you are setting state of isRewardedAdReady and that will trigger showing the ad immediately the ad is ready(unless they are implemented differently, sorry if I am wrong). Also please check the variables _isRewardedAdReady and isRewardedAdReady are they same or different (notice you missed the underscore). Since you mentioned that it is displaying ads properly you may also try on other devices or simulator too.
As I was creating an app in which all the COVID data will be arranged according to their zones through the API and the API is in the MAP<String, String> form. But I am getting probably the typecasting error.
API URL = https://api.rootnet.in/covid19-in/stats/latest
List<String> redZoneData;
List<String> orangeZoneData;
List<String> greenZoneData;
int n = 2;
Map mapData;
var totalConfirmed;
var dataCalc;
var death;
var stateCode;
mapDataValue() async {
final url = 'https://api.rootnet.in/covid19-in/stats/latest';
final response = await http.get(url);
mapData = json.decode(response.body);
if (response.statusCode == 200) {
setState(() {
for (int index = 0;
index < mapData['data']['regional'].length;
index++) {
totalConfirmed = mapData['data']['regional'][index]['totalConfirmed'];
death = mapData['data']['regional'][index]['deaths'];
dataCalc = double.parse((totalConfirmed / death).toStringAsFixed(2));
stateCode = mapData['data']['regional'][index]['loc'];
if (dataCalc <= 40.00) {
redZoneData.add(stateCode);
} else {
if (dataCalc > 40.00 && dataCalc <= 50.00) {
orangeZoneData.add(stateCode);
} else {
greenZoneData.add(stateCode);
}
}
}
// print(redZoneData);
// print(orangeZoneData);
// print(greenZoneData);
});
} else {
throw Exception('loading failed...');
}
}
#override
void initState() {
mapDataValue();
super.initState();
}
ERROR:
E/flutter (17875): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The method 'add' was called on null.
E/flutter (17875): Receiver: null
E/flutter (17875): Tried calling: add("Andaman and Nicobar Islands")
E/flutter (17875): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
E/flutter (17875): #1 _MapIntegrationState.mapDataValue.<anonymous closure>
package:CovidTracker/MapIntegration.dart:42
E/flutter (17875): #2 State.setState
package:flutter/…/widgets/framework.dart:1240
E/flutter (17875): #3 _MapIntegrationState.mapDataValue
package:CovidTracker/MapIntegration.dart:28
E/flutter (17875): <asynchronous suspension>
E/flutter (17875): #4 _MapIntegrationState.initState
package:CovidTracker/MapIntegration.dart:57
E/flutter (17875): #5 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4684
E/flutter (17875): #6 ComponentElement.mount
package:flutter/…/widgets/framework.dart:4520
E/flutter (17875): #7 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3490
E/flutter (17875): #8 MultiChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5991
E/flutter (17875): #9 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3490
E/flutter (17875): #10 Element.updateChild
package:flutter/…/widgets/framework.dart:3258
E/flutter (17875): #11 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5874
E/flutter (17875): #12 Element.inflateWidget
Can you help me to solve this, please? As I am a newbie that's why I am getting these errors. Please help me to overcome this.
Thank You:}
I just solved this
List redZoneData = new List();
List orangeZoneData = new List();
List greenZoneData = new List();
int n = 2;
Map mapData;
var totalConfirmed;
var dataCalc;
var death;
var stateCode;
mapDataValue() async {
final url = 'https://api.rootnet.in/covid19-in/stats/latest';
final response = await http.get(url);
mapData = json.decode(response.body);
if (response.statusCode == 200) {
setState(() {
for (int index = 0;
index < mapData['data']['regional'].length;
index++) {
totalConfirmed = mapData['data']['regional'][index]['totalConfirmed'];
death = mapData['data']['regional'][index]['deaths'];
dataCalc = double.parse((totalConfirmed / death).toStringAsFixed(2));
stateCode = mapData['data']['regional'][index]['loc'];
if (dataCalc <= 40.00) {
redZoneData.add(stateCode);
} else {
if (dataCalc > 40.00 && dataCalc <= 50.00) {
orangeZoneData.add(stateCode);
} else {
greenZoneData.add(stateCode);
}
}
}
// print(redZoneData);
// print(orangeZoneData);
// print(greenZoneData);
});
} else {
throw Exception('loading failed...');
}
}
#override
void initState() {
mapDataValue();
super.initState();
}
Remove the type of the list and make it dynamic. It will help surely.
Just Simple
I'm maintaining an Android video replay app through Android Studio. All aspects of the application work fine across multiple devices (Samsung S8, S10, S20 etc) except for 64bit devices where the video decode fails. I'm looking for advice and/or an explaination as to what's causing the problem.
Below is a snippet of the code that is causing me grief. Below are the resultant logs. Basically the application works fine when run using jniLibs/armeabi however fails when run using jnilibs/arm64-v8a. The decoder threads keep failing with IllogicalArgumentException.
Code:
private class PlayerThread3 extends Thread {
private MediaCodec decoder;
private Surface surface;
public PlayerThread3(Surface surface) {
this.surface = surface;
}
#Override
public void run() {
Log.d("PlayerThread3->Run", "Entry surface=" + surface.toString());
MediaFormat format = MediaFormat.createVideoFormat("video/avc", mSurfaceWidth, mSurfaceHeight);
try {
Log.d("PlayerThread3->Run", "MediaFormat=" + format.toString());
decoder = MediaCodec.createByCodecName("OMX.google.h264.decoder");
Log.d("PlayerThread3->Run", "MediaCodec=" + decoder.toString());
if (surface.isValid()) {
Log.d("PlayerThread3->Run", "surface.isValid=" + surface.toString());
decoder.configure(format, surface, null, 0);
} else {
Log.i("debug","decoder31");
Message msg = Message.obtain();
msg.what = 3;
msg.obj = "Failed to start live video(surface)";
handler.sendMessage(msg);
return;
}
} catch (IllegalArgumentException e) {
Log.d("PlayerThread3->Run", "IA surface=" + surface.toString());
e.printStackTrace();
Log.i("debug", "decoder32");
Message msg = Message.obtain();
msg.what = 3;
msg.obj = "Failed to start live video(arg)";
handler.sendMessage(msg);
return;
} catch (IOException e) {
e.printStackTrace();
Log.i("debug", "decoder33");
Message msg = Message.obtain();
msg.what = 3;
msg.obj = "Failed to start live video(IO)";
handler.sendMessage(msg);
return;
}
try {
decoder.start();
inputBuffers3 = decoder.getInputBuffers();
Message msg = Message.obtain();
msg.what = 3;
handler.sendMessage(msg);
while (preferences_isAlways.getBoolean("indexDecode3" + index, false)) {
if (decoder_array3 != null) {
offerDecoder(decoder_array3, decoder_array3.length);
decoder_array3 = null;
}
}
decoder.stop();
decoder.release();
} catch (IllegalStateException e) {
e.printStackTrace();
Log.i("debug", "decoder34");
Message msg = Message.obtain();
msg.what = 3;
msg.obj = "Failed to start live video(IS)";
handler.sendMessage(msg);
}
}
Log:
I/frameRate: 2
I/whichPartOfFrame: 0
I/s_frame_serial: 40
I/frame_packet_body: 1952
D/PlayerThread3->Run: Entry surface=Surface(name=null)/#0x68f7d48
D/PlayerThread3->Run: MediaFormat={mime=video/avc, width=536, height=437}
D/CCodec: allocate(c2.android.avc.decoder)
I/CCodec: Created component [c2.android.avc.decoder]
D/CCodecConfig: read media type: video/avc
D/ReflectedParamUpdater: extent() != 1 for single value type: algo.buffers.max-count.values
extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater: extent() != 1 for single value type: input.buffers.allocator-ids.values
extent() != 1 for single value type: output.buffers.allocator-ids.values
extent() != 1 for single value type: algo.buffers.allocator-ids.values
extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater: extent() != 1 for single value type: algo.buffers.pool-ids.values
D/ReflectedParamUpdater: ignored struct field coded.color-format.locations
D/CCodecConfig: ignoring local param raw.size (0xd2001800) as it is already supported
ignoring local param raw.color (0xd2001809) as it is already supported
D/ReflectedParamUpdater: ignored struct field raw.hdr-static-info.mastering
I/CCodecConfig: query failed after returning 12 values (BAD_INDEX)
D/CCodecConfig: c2 config is Dict {
c2::u32 coded.pl.level = 20496
c2::u32 coded.pl.profile = 20481
c2::u32 coded.vui.color.matrix = 0
c2::u32 coded.vui.color.primaries = 0
c2::u32 coded.vui.color.range = 2
c2::u32 coded.vui.color.transfer = 0
c2::u32 default.color.matrix = 0
c2::u32 default.color.primaries = 0
c2::u32 default.color.range = 0
c2::u32 default.color.transfer = 0
c2::u32 input.buffers.max-size.value = 57600
c2::u32 input.delay.value = 0
string input.media-type.value = "video/avc"
c2::u32 output.delay.value = 8
string output.media-type.value = "video/raw"
c2::u32 raw.color.matrix = 0
c2::u32 raw.color.primaries = 0
c2::u32 raw.color.range = 2
c2::u32 raw.color.transfer = 0
c2::u32 raw.max-size.height = 240
c2::u32 raw.max-size.width = 320
c2::u32 raw.pixel-format.value = 35
c2::i32 raw.rotation.flip = 0
c2::i32 raw.rotation.value = 0
c2::u32 raw.sar.height = 1
c2::u32 raw.sar.width = 1
c2::u32 raw.size.height = 240
c2::u32 raw.size.width = 320
c2::u32 ra
W/ColorUtils: expected specified color aspects (2:0:0:0)
D/PlayerThread3->Run: MediaCodec=android.media.MediaCodec#da3c906
surface.isValid=Surface(name=null)/#0x68f7d48
D/SurfaceUtils: connecting to surface 0x7645de8010, reason connectToSurface
I/MediaCodec: [c2.android.avc.decoder] setting surface generation to 27948035
D/SurfaceUtils: disconnecting from surface 0x7645de8010, reason connectToSurface(reconnect)
connecting to surface 0x7645de8010, reason connectToSurface(reconnect)
D/CCodecConfig: no c2 equivalents for native-window
config failed => CORRUPTED
Bad parameter value
D/CCodecConfig: c2 config is Dict {
c2::u32 coded.pl.level = 20496
c2::u32 coded.pl.profile = 20481
c2::u32 coded.vui.color.matrix = 0
c2::u32 coded.vui.color.primaries = 0
c2::u32 coded.vui.color.range = 2
c2::u32 coded.vui.color.transfer = 0
c2::u32 default.color.matrix = 0
c2::u32 default.color.primaries = 0
c2::u32 default.color.range = 0
c2::u32 default.color.transfer = 0
c2::u32 input.buffers.max-size.value = 57600
c2::u32 input.delay.value = 0
string input.media-type.value = "video/avc"
c2::u32 output.delay.value = 8
string output.media-type.value = "video/raw"
c2::u32 raw.color.matrix = 0
c2::u32 raw.color.primaries = 0
c2::u32 raw.color.range = 2
c2::u32 raw.color.transfer = 0
c2::u32 raw.max-size.height = 240
c2::u32 raw.max-size.width = 320
c2::u32 raw.pixel-format.value = 35
c2::i32 raw.rotation.flip = 0
c2::i32 raw.rotation.value = 0
c2::u32 raw.sar.height = 1
c2::u32 raw.sar.width = 1
c2::u32 raw.size.height = 240
c2::u32 raw.size.width = 536
c2::u32 ra
W/CCodec: failed to configure c2 params
E/MediaCodec: Codec reported err 0xffffffea, actionCode 0, while in state 3
D/SurfaceUtils: disconnecting from surface 0x7645de8010, reason disconnectFromSurface
E/MediaCodec: configure failed with err 0xffffffea, resetting...
I/MediaCodec: Codec shutdown complete
D/CCodec: allocate(c2.android.avc.decoder)
I/CCodec: Created component [c2.android.avc.decoder]
D/CCodecConfig: read media type: video/avc
D/ReflectedParamUpdater: extent() != 1 for single value type: algo.buffers.max-count.values
extent() != 1 for single value type: output.subscribed-indices.values
extent() != 1 for single value type: input.buffers.allocator-ids.values
extent() != 1 for single value type: output.buffers.allocator-ids.values
extent() != 1 for single value type: algo.buffers.allocator-ids.values
extent() != 1 for single value type: output.buffers.pool-ids.values
extent() != 1 for single value type: algo.buffers.pool-ids.values
D/ReflectedParamUpdater: ignored struct field coded.color-format.locations
I/frameRate: 2
I/whichPartOfFrame: 0
I/s_frame_serial: 41
I/frame_packet_body: 46
D/CCodecConfig: ignoring local param raw.size (0xd2001800) as it is already supported
ignoring local param raw.color (0xd2001809) as it is already supported
D/ReflectedParamUpdater: ignored struct field raw.hdr-static-info.mastering
I/CCodecConfig: query failed after returning 12 values (BAD_INDEX)
D/CCodecConfig: c2 config is Dict {
c2::u32 coded.pl.level = 20496
c2::u32 coded.pl.profile = 20481
c2::u32 coded.vui.color.matrix = 0
c2::u32 coded.vui.color.primaries = 0
c2::u32 coded.vui.color.range = 2
c2::u32 coded.vui.color.transfer = 0
c2::u32 default.color.matrix = 0
c2::u32 default.color.primaries = 0
c2::u32 default.color.range = 0
c2::u32 default.color.transfer = 0
c2::u32 input.buffers.max-size.value = 57600
c2::u32 input.delay.value = 0
string input.media-type.value = "video/avc"
c2::u32 output.delay.value = 8
string output.media-type.value = "video/raw"
c2::u32 raw.color.matrix = 0
c2::u32 raw.color.primaries = 0
c2::u32 raw.color.range = 2
c2::u32 raw.color.transfer = 0
c2::u32 raw.max-size.height = 240
c2::u32 raw.max-size.width = 320
c2::u32 raw.pixel-format.value = 35
c2::i32 raw.rotation.flip = 0
c2::i32 raw.rotation.value = 0
c2::u32 raw.sar.height = 1
c2::u32 raw.sar.width = 1
c2::u32 raw.size.height = 240
c2::u32 raw.size.width = 320
c2::u32 ra
W/ColorUtils: expected specified color aspects (2:0:0:0)
D/PlayerThread3->Run: IA surface=Surface(name=null)/#0x68f7d48
W/System.err: java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
W/System.err: at android.media.MediaCodec.configure(MediaCodec.java:2023)
at android.media.MediaCodec.configure(MediaCodec.java:1951)
at au.com.FreedomVMS.iFreedomVMSpro.live.ShowFragment$PlayerThread3.run(ShowFragment.java:5789)
I/debug: decoder32
I/.iFreedomVMSpr: Compiler allocated 15MB to compile void au.com.FreedomVMS.iFreedomVMSpro.live.ShowFragment.handleSocket1(int, byte, java.lang.String, int, java.lang.String, java.lang.String)
I/frameRate: 2
I/whichPartOfFrame: 1
I/s_frame_serial: 42
I/frame_packet_body: 10240
Simples, problem solved. Surface dimensions, width and height, have to be multiples of 16 under Android 10. The earlier versions of Android tested against don't appear to be worried by this constraint.
I'm making a side scroller and when i start my game i can touch the screen to keep my penguin in the air, but when i fail and collide with an ice block and press play after going to restart.lua i get the error attempt to call method 'applyForce'
heres my code
local function activatePengs(self,event)
self:applyForce(0, -45, self.x, self.y)
print("run")
end
local function touchScreen(event)
print("touch")
if event.phase == "began" then
peng.enterFrame = activatePengs
Runtime:addEventListener("enterFrame", peng)
end
if event.phase == "ended" then
Runtime:removeEventListener("enterFrame", peng)
end
end
local function onCollision(event)
if event.phase == "began" then
print "collide"
composer.gotoScene( "restart",{ time=800, effect="crossFade" } )
end
end
-- now comes four required functions for Composer:
function scene:create( event )
local sceneGroup = self.view
bg1 = display.newImageRect(sceneGroup, "bg.png", 800, 1000)
bg2 = display.newImage(sceneGroup, "ice2.png",140,210)
bg3 = display.newImage(sceneGroup, "ice2.png",540,210)
bg4 = display.newImage(sceneGroup, "ice2.png",940,210)
bg5 = display.newImage(sceneGroup, "ice2.png",1340,210)
bg6 = display.newImage(sceneGroup, "ice2.png",1740,210)
bg7 = display.newImage(sceneGroup, "ice1.png",140,420)
bg8 = display.newImage(sceneGroup, "ice1.png",540,420)
bg9 = display.newImage(sceneGroup, "ice1.png",940,420)
bg10 = display.newImage(sceneGroup, "ice1.png",1340,420)
bg11 = display.newImage(sceneGroup, "ice1.png",1740,420)
peng = display.newImage(sceneGroup, "peng.png", 80, 201)
physics.addBody(peng, "dynamic", {density=.18, bounce=0.1, friction=.5, radius=55})
...
end
Probably the error occurs because penguin is not a physics object when the function is called. I think remove enterFrame listener before go to next scene should solve your problem.
I added some improvements to your code (not tested) :
local applyForceToPenguin = false
local function enterFrame( self, event )
if applyForceToPenguin then
self:applyForce( 0, -45, self.x, self.y )
print("run")
end
end
local function touchScreen(event)
print("touch")
if event.phase == "began" then applyForceToPenguin = true end
if event.phase == "ended" then applyForceToPenguin = false end
end
local function onCollision(event)
if event.phase == "began" then
print "collide"
applyForceToPenguin = false
composer.gotoScene( "restart",{ time=800, effect="crossFade" } )
end
end
-- now comes four required functions for Composer:
function scene:create( event )
local sceneGroup = self.view
bg1 = display.newImageRect( sceneGroup, "bg.png", 800, 1000 )
bg2 = display.newImage( sceneGroup, "ice2.png", 140, 210 )
bg3 = display.newImage( sceneGroup, "ice2.png", 540, 210 )
bg4 = display.newImage( sceneGroup, "ice2.png", 940, 210 )
bg5 = display.newImage( sceneGroup, "ice2.png", 1340, 210 )
bg6 = display.newImage( sceneGroup, "ice2.png", 1740, 210 )
bg7 = display.newImage( sceneGroup, "ice1.png", 140, 420 )
bg8 = display.newImage( sceneGroup, "ice1.png", 540, 420 )
bg9 = display.newImage( sceneGroup, "ice1.png", 940, 420 )
bg10 = display.newImage( sceneGroup, "ice1.png", 1340, 420 )
bg11 = display.newImage( sceneGroup, "ice1.png", 1740, 420 )
peng = display.newImage( sceneGroup, "peng.png", 80, 201)
physics.addBody( peng, "dynamic", { density=.18, bounce=0.1, friction=.5, radius=55 } )
Runtime:addEventListener( "enterFrame", enterFrame )
...
end
function scene:destroy()
Runtime:removeEventListener( "enterFrame", enterFrame )
end
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if phase == "will" then
-- Code here runs when the scene is still off screen (but is about to come on screen)
elseif phase == "did" then
-- Code here runs when the scene is entirely on screen
applyForceToPenguin = false
end
end
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
Have a nice day:)
I'm developing an android app with the libav and I'm trying decode a 3gp with code below:
#define simbiLog(...) __android_log_print(ANDROID_LOG_DEBUG, "simbiose", __VA_ARGS__)
...
AVCodec *codec;
AVCodecContext *c = NULL;
int len;
FILE *infile, *outfile;
uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
AVPacket avpkt;
AVFrame *decoded_frame = NULL;
simbiLog("inbuf size: %d", sizeof(inbuf) / sizeof(inbuf[0]));
av_register_all();
av_init_packet(&avpkt);
codec = avcodec_find_decoder(AV_CODEC_ID_AMR_NB);
if (!codec) {
simbiLog("codec not found");
return ERROR;
}
c = avcodec_alloc_context3(codec);
if (!c) {
simbiLog("Could not allocate audio codec context");
return ERROR;
}
int open = avcodec_open2(c, codec, NULL);
if (open < 0) {
simbiLog("could not open codec %d", open);
return ERROR;
}
infile = fopen(inputPath, "rb");
if (!infile) {
simbiLog("could not open %s", inputPath);
return ERROR;
}
outfile = fopen(outputPath, "wb");
if (!outfile) {
simbiLog("could not open %s", outputPath);
return ERROR;
}
avpkt.data = inbuf;
avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, infile);
int iterations = 0;
while (avpkt.size > 0) {
simbiLog("iteration %d", (++iterations));
simbiLog("avpkt.size %d avpkt.data %X", avpkt.size, avpkt.data);
int got_frame = 0;
if (!decoded_frame) {
if (!(decoded_frame = avcodec_alloc_frame())) {
simbiLog("out of memory");
return ERROR;
}
} else {
avcodec_get_frame_defaults(decoded_frame);
}
//below the error, but it isn't occur on first time, only in 4th loop interation
len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt);
if (len < 0) {
simbiLog("Error while decoding error %d frame %d duration %d", len, got_frame, avpkt.duration);
return ERROR;
} else {
simbiLog("Decoding length %d frame %d duration %d", len, got_frame, avpkt.duration);
}
if (got_frame) {
int data_size = av_samples_get_buffer_size(NULL, c->channels, decoded_frame->nb_samples, c->sample_fmt, 1);
size_t* fwrite_size = fwrite(decoded_frame->data[0], 1, data_size, outfile);
simbiLog("fwrite returned %d", fwrite_size);
}
avpkt.size -= len;
avpkt.data += len;
if (avpkt.size < AUDIO_REFILL_THRESH) {
memmove(inbuf, avpkt.data, avpkt.size);
avpkt.data = inbuf;
len = fread(avpkt.data + avpkt.size, 1, AUDIO_INBUF_SIZE - avpkt.size, infile);
if (len > 0)
avpkt.size += len;
simbiLog("fread returned %d", len);
}
}
fclose(outfile);
fclose(infile);
avcodec_close(c);
av_free(c);
av_free(decoded_frame);
but I'm getting the follow log and error:
inbuf size: 20488
iteration 1
avpkt.size 3305 avpkt.data BEEED40C
Decoding length 13 frame 1 duration 0
fwrite returned 640
fread returned 0
iteration 2
avpkt.size 3292 avpkt.data BEEED40C
Decoding length 13 frame 1 duration 0
fwrite returned 640
fread returned 0
iteration 3
avpkt.size 3279 avpkt.data BEEED40C
Decoding length 14 frame 1 duration 0
fwrite returned 640
fread returned 0
iteration 4
avpkt.size 3265 avpkt.data BEEED40C
Error while decoding error -1052488119 frame 0 duration 0
the audio file I'm trying decode:
$ avprobe blue.3gp
avprobe version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2007-2013 the Libav developers
built on Mar 30 2013 22:23:21 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'blue.3gp':
Metadata:
major_brand : 3gp4
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2013-09-19 18:53:38
Duration: 00:00:01.52, start: 0.000000, bitrate: 17 kb/s
Stream #0.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s
Metadata:
creation_time : 2013-09-19 18:53:38
thanks a lot!
EDITED
I read on ffmper documentation about the method avcodec_decode_audio4 the follow:
#warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end.
#note You might have to align the input buffer. The alignment requirements depend on the CPU and the decoder.
and I see here a solution using posix_memalign, to android i founded a similar method called memalign, so i did the change:
removed:
uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
inserted:
int inbufSize = sizeof(uint8_t) * (AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
uint8_t *inbuf = memalign(FF_INPUT_BUFFER_PADDING_SIZE, inbufSize);
simbiLog("inbuf size: %d", inbufSize);
for (; inbufSize >= 0; inbufSize--)
simbiLog("inbuf position: %d index: %p", inbufSize, &inbuf[inbufSize]);
I'm getting the correct memory sequence position, but the error not changed.
A piece of outpout:
inbuf position: 37 index: 0x4e43d745
inbuf position: 36 index: 0x4e43d744
inbuf position: 35 index: 0x4e43d743
inbuf position: 34 index: 0x4e43d742
inbuf position: 33 index: 0x4e43d741
inbuf position: 32 index: 0x4e43d740
inbuf position: 31 index: 0x4e43d73f
inbuf position: 30 index: 0x4e43d73e
inbuf position: 29 index: 0x4e43d73d
inbuf position: 28 index: 0x4e43d73c
inbuf position: 27 index: 0x4e43d73b
inbuf position: 26 index: 0x4e43d73a
inbuf position: 25 index: 0x4e43d739
inbuf position: 24 index: 0x4e43d738
inbuf position: 23 index: 0x4e43d737
inbuf position: 22 index: 0x4e43d736
inbuf position: 21 index: 0x4e43d735
inbuf position: 20 index: 0x4e43d734
inbuf position: 19 index: 0x4e43d733
You are trying to decode without demuxing.