Issues on midroll ads

Hi all

We are having some issues in AdError event with some midroll ads tests

We have two VAST files loaded at the start of the content, both of them can return a VAST, or sometimes, return an empty VAST. But sometimes, also returns internal ExoPlayer Codec Error
VAST1
VAST2

The problem is that we are having some intermitence in the AdError event so the Player is paused at mid content and not returning the player to play state.

Here are the logs:
Codec Error:

2022-12-07 14:09:01.793 9744-10248/com.riivi.riivi E/ExoPlayerImplInternal: Playback error
      com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.4D002A, -1, null, [1980, 1080, 30.0], [-1, -1]), format_supported=NO_EXCEEDS_CAPABILITIES
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:585)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:329)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.qcom.video.decoder.avc, Format(1, null, null, video/avc, avc1.4D002A, -1, null, [1980, 1080, 30.0], [-1, -1])
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1017)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:546)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1437)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:799)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:950)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:779)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1008)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:509)
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loopOnce(Looper.java:226) 
        at android.os.Looper.loop(Looper.java:329) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 
     Caused by: android.media.MediaCodec$CodecException: Error 0xfffffc0e
        at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:2176)
        at android.media.MediaCodec.configure(MediaCodec.java:2092)
        at com.google.android.exoplayer2.mediacodec.AsynchronousMediaCodecAdapter.initialize(AsynchronousMediaCodecAdapter.java:167)
        at com.google.android.exoplayer2.mediacodec.AsynchronousMediaCodecAdapter.access$100(AsynchronousMediaCodecAdapter.java:50)
        at com.google.android.exoplayer2.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(AsynchronousMediaCodecAdapter.java:111)
        at com.google.android.exoplayer2.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:128)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1095)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1006)

Empty Vast on First Event (last 3 lines) - No Second Event (just pused)

2022-12-07 13:34:25.459 1183-1183/com.riivi.riivi I/ExoPlayerImpl: Init c47ab86 [ExoPlayerLib/2.17.1] [caprip, moto g(30), motorola, 31]
2022-12-07 13:34:25.589 1183-1183/com.riivi.riivi I/Choreographer: Skipped 40 frames!  The application may be doing too much work on its main thread.
2022-12-07 13:34:26.381 1183-5495/com.riivi.riivi I/DMCodecAdapterFactory: Creating an asynchronous MediaCodec adapter for track type video
2022-12-07 13:34:26.389 1183-5495/com.riivi.riivi I/MediaCodec: (0xb4000073aefc96c0) init name(OMX.qcom.video.decoder.avc)
2022-12-07 13:34:26.397 1183-5539/com.riivi.riivi I/OMXClient: IOmx service obtained
2022-12-07 13:34:26.412 1183-5538/com.riivi.riivi I/MediaCodec: (0xb4000073aefc96c0) Component Allocated (OMX.qcom.video.decoder.avc)
2022-12-07 13:34:26.428 1183-5538/com.riivi.riivi I/MediaCodec: MediaCodec will operate in async mode
2022-12-07 13:34:26.429 1183-5495/com.riivi.riivi I/MediaCodec: (0xb4000073aefc96c0) configure surface(0xb4000073dec87740) crypto(0x0) flags(0)
2022-12-07 13:34:26.429 1183-5495/com.riivi.riivi D/MediaCodec: (0xb4000073aefc96c0) configure format: AMessage(what = 0x00000000) = {
          Buffer csd-1 = {
            00000000:  00 00 01 68 eb e3 cb 20                           ...h... 
      }
          int32_t max-height = 1012
          int32_t max-width = 1920
          string mime = "video/avc"
          int32_t width = 1280
          int32_t priority = 0
          float frame-rate = 25.000000
          int32_t rotation-degrees = 0
          int32_t max-input-size = 1474560
          int32_t height = 676
          Buffer csd-0 = {
            00000000:  00 00 01 67 4d 40 1f ec  a0 28 02 bf cf 80 88 00  ...gM@...(......
            00000010:  00 03 00 08 00 00 03 01  90 78 c1 8c b0 00        .........x....
          }
        }
2022-12-07 13:34:26.429 1183-5538/com.riivi.riivi D/SurfaceUtils: connecting to surface 0xb4000073dec87750, reason connectToSurface
2022-12-07 13:34:26.429 1183-5538/com.riivi.riivi I/MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 1211427
2022-12-07 13:34:26.429 1183-5538/com.riivi.riivi D/SurfaceUtils: disconnecting from surface 0xb4000073dec87750, reason connectToSurface(reconnect)
2022-12-07 13:34:26.429 1183-5538/com.riivi.riivi D/SurfaceUtils: connecting to surface 0xb4000073dec87750, reason connectToSurface(reconnect)
2022-12-07 13:34:26.432 1183-5539/com.riivi.riivi I/ACodec: DRC Mode: Dynamic Buffer Mode
2022-12-07 13:34:26.432 1183-5539/com.riivi.riivi I/ExtendedACodec: setupVideoDecoder()
2022-12-07 13:34:26.433 1183-5539/com.riivi.riivi I/ACodec: [OMX.qcom.video.decoder.avc] setupVideoDecoder Width Height (1280x676)
2022-12-07 13:34:26.433 1183-5539/com.riivi.riivi I/ACodec: mime (video/avc) compressionFormat (7)
2022-12-07 13:34:26.435 1183-5539/com.riivi.riivi I/ExtendedACodec: Decoder will be in frame by frame mode
2022-12-07 13:34:26.436 1183-5539/com.riivi.riivi W/ExtendedACodec: Failed to set frame packing format on component
2022-12-07 13:34:26.443 1183-5495/com.riivi.riivi I/MediaCodec: (0xb4000073aefc96c0) start
2022-12-07 13:34:26.444 1183-5495/com.riivi.riivi D/MediaCodec: keep callback message for reclaim
2022-12-07 13:34:26.590 1183-5539/com.riivi.riivi D/SurfaceUtils: set up nativeWindow 0xb4000073dec87750 for 1280x676, color 0x7fa30c04, rotation 0, usage 0x20402900
2022-12-07 13:34:26.598 1183-5538/com.riivi.riivi I/MediaCodec: (0xb4000073aefc96c0) kWhatStartCompleted
2022-12-07 13:34:26.807 1183-5539/com.riivi.riivi D/SurfaceUtils: set up nativeWindow 0xb4000073dec87750 for 1280x688, color 0x7fa30c04, rotation 0, usage 0x20402900
2022-12-07 13:34:26.832 1183-5538/com.riivi.riivi D/MediaCodec: (0xb4000073aefc96c0) kWhatOutputBuffersChanged
2022-12-07 13:34:26.858 1183-5495/com.riivi.riivi I/MediaCodec: (0xb4000073aefc96c0) setParameters
2022-12-07 13:34:26.858 1183-5538/com.riivi.riivi W/MediaCodec: mapFormat: no mediaType information
2022-12-07 13:34:26.951 1183-5550/com.riivi.riivi D/GASS: Clearcut logging disabled
2022-12-07 13:34:27.019 1183-5558/com.riivi.riivi D/GASS: Clearcut logging disabled
2022-12-07 13:34:27.938 1183-1183/com.riivi.riivi E/ad error msg: The VAST response document is empty.
2022-12-07 13:34:27.938 1183-1183/com.riivi.riivi E/ad error code: 1009
2022-12-07 13:34:33.971 1183-1183/com.riivi.riivi E/player pause: OK 0.0

And here is the video, in which you can see at the start it plays without problem after the first AdError returned an empty VAST, but at the mid content, the player just pause the content and no AdError is returned.

Video - Google Drive

Here is our Ad Config and AdError Event

fun getAdConfig(dataMediaResponse: MediaPlaylist, custom6: String): AdvertisingConfig {

        urlPre = getVastUrl(dataMediaResponse, custom6, "pre")
        urlMid = getVastUrl(dataMediaResponse, custom6, "mid")

        Log.e("URL vast pre", urlPre)
        Log.e("URL vast mid", urlMid)

        val adSourcePre = AdSource(
            AdSourceType.Ima,
            urlPre)

        val adSourceMid = AdSource(
            AdSourceType.Ima,
            urlMid)

        val itemPre = AdItem(arrayOf(adSourcePre), position = "pre", replaceContentDuration = 0.0, preloadOffset = 8.0)
        val itemMid = AdItem(arrayOf(adSourceMid), position = "50%", replaceContentDuration = 0.0, preloadOffset = 8.0)

       return AdvertisingConfig(itemPre, itemMid)
}

----

private fun onAdErrorCallback(p0: PlayerEvent.AdError) {
        bView.loader.visibility = View.GONE
        bView.loaderLottie.cancelAnimation()
        contAdsErrors++
        Log.e("ad error msg", "${p0.message}")
        Log.e("ad error code", "${p0.code}")

        mPresenter.sendSentryError(p0)
        //If not empty, fallback logo
        if(contAdsErrors <= 2 && p0.code != 1009){
            /*Log.e("ad fallback", "yes")*/
            p0.message?.let {
                mPresenter.sendAnalyticsPlayerError(AnalyticsPlayer.PLAYER_ERROR,
                    it
                )
            }
            bView.bitmovinPlayerView.player?.scheduleAd(playerDataManager.getAdFallback())

        }
        bView.bitmovinPlayerView.player?.play()

}

Thanks in advance.

We are implementing Bitmovin Android v3.24.1

Hi @gledezma , thanks for sharing the behaviour. Looking at the first set of logs with codec error, the issues seems to be related to incompatible video codec format.

  com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.4D002A, -1, null, [1980, 1080, 30.0], [-1, -1]), format_supported=NO_EXCEEDS_CAPABILITIES

Bitmovin Android player SDK offers videoFilter configuration which can be used to configure strict check for video codec support. The default value is Loose, which keeps in any video tracks which may be potentially supported. This can be configured as Strict to filter out any tracks which are not supported. You can try this configuration and see if it helps with codec error related behaviour.

We detected that our develop environment has too short contents, and the preload offset of the ads cannot be processed before because it needed more time that the actual content time.

i.e: Contents in our dev env are 12 seconds long, so first ad error appears without problem because is “pre” roll, but “mid” roll need at least 8 seconds to be preloaded in offset (that time was set for test) but half content is 6 seconds, so mid roll ad was never processed and fail to throw an ad error event. After noticing this we changed the preload offset to 5 seconds and then the second ad error event appeared. Check that if you can.

Thanks for sharing your findings @gledezma . These are indeed interesting. And as you found the likely cause of midroll Ads not getting processed.

I believe adjusting the preload offset as per the content durations in your environment has solved the problem.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.