EXC_ARITHMETIC when re-negotiating H.264 stream

RESOLVED DUPLICATE of bug 1237224

Status

()

RESOLVED DUPLICATE of bug 1237224
3 years ago
3 years ago

People

(Reporter: solmaks, Unassigned)

Tracking

Trunk
x86_64
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [WebRTC])

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36

Steps to reproduce:

Re-negotiated H.264 stream, expected video packets to flow


Actual results:

Firefox crashed with EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)


Expected results:

After re-negotiating H.264 stream, video packets should have continued flowing
(Reporter)

Comment 1

3 years ago
Telemetry polling performed every second by PeerConnectionCtx might catch individual PC video conduits in a state where transmission has been already restarted due to processing incoming re-invite (which shouldn't even be changing anything as media direction and previously negotiated PT and its params remain the same), but encoder hasn't yet managed to produce any frames. This situation leads to both VideoConduit::mSendingWidth and VideoConduit::mSendingHeight still set to 0, causing the following code in VideoConduit.cpp to perform division by zero:

@1245
    mb_width = (mSendingWidth + 15) >> 4;
    mb_height = (mSendingHeight + 15) >> 4;
    cur_fs = mb_width * mb_height;
    max_fps = mCurSendCodecConfig->mEncodingConstraints.maxMbps/cur_fs;

LLDB analysis:
(lldb) bt
* thread #9: tid = 0x6369, 0x00000001028f07d0 XUL`mozilla::WebrtcVideoConduit::SelectSendResolution(unsigned short, unsigned short, webrtc::I420VideoFrame*) + 71 at VideoConduit.cpp:1249, name = 'Socket Thread', stop reason = EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
    frame #0: 0x00000001028f07d0 XUL`mozilla::WebrtcVideoConduit::SelectSendResolution(unsigned short, unsigned short, webrtc::I420VideoFrame*) + 71 at VideoConduit.cpp:1249
    frame #1: 0x00000001028f0789 XUL`mozilla::WebrtcVideoConduit::SelectSendResolution(this=0x000000013e171bb0, width=<unavailable>, height=<unavailable>, frame=0x0000000000000000) + 489 at VideoConduit.cpp:1137
  * frame #2: 0x00000001028f0529 XUL`mozilla::WebrtcVideoConduit::GetVideoEncoderStats(this=0x000000013e171bb0, framerateMean=0x00007000003a5778, framerateStdDev=<unavailable>, bitrateMean=<unavailable>, bitrateStdDev=<unavailable>, droppedFrames=<unavailable>) + 345 at VideoConduit.cpp:185
    frame #3: 0x000000010293598f XUL`mozilla::PeerConnectionImpl::ExecuteStatsQuery_s(query=0x00000001434c3f10) + 3615 at PeerConnectionImpl.cpp:3304
    frame #4: 0x0000000102923d26 XUL`mozilla::EverySecondTelemetryCallback_s(aQueryList=nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0, mozilla::MallocAllocPolicy> > @ 0x00007000003a5af0) + 214 at PeerConnectionCtx.cpp:206
    frame #5: 0x0000000102925b30 XUL`mozilla::runnable_args_func<void (*)(nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> >), nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> > >::Run() [inlined] void mozilla::detail::RunnableFunctionCallHelper<void>::apply<void (func=<unavailable>)(nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> >), nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> >, 0ul>(void (*)(nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> >), mozilla::Tuple<nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> > >&, mozilla::IndexSequence<0ul>) + 22 at runnable_utils.h:79
    frame #6: 0x0000000102925b1a XUL`mozilla::runnable_args_func<void (*)(nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> >), nsAutoPtr<mozilla::Vector<nsAutoPtr<mozilla::RTCStatsQuery>, 0ul, mozilla::MallocAllocPolicy> > >::Run(this=<unavailable>) + 10 at runnable_utils.h:118
    frame #7: 0x0000000101ea3147 XUL`nsThread::ProcessNextEvent(this=0x000000010072cb00, aMayWait=<unavailable>, aResult=0x00007000003a5c07) + 1495 at nsThread.cpp:989
    frame #8: 0x0000000101ee2653 XUL`NS_ProcessNextEvent(aThread=<unavailable>, aMayWait=true) + 51 at nsThreadUtils.cpp:297
    frame #9: 0x0000000101fb4250 XUL`nsSocketTransportService::Run(this=0x0000000100727640) + 960 at nsSocketTransportService2.cpp:905
    frame #10: 0x0000000101fb4dfd XUL`non-virtual thunk to nsSocketTransportService::Run(this=<unavailable>) + 13 at nsSocketTransportService2.cpp:793
    frame #11: 0x0000000101ea3147 XUL`nsThread::ProcessNextEvent(this=0x000000010072cb00, aMayWait=<unavailable>, aResult=0x00007000003a5dd7) + 1495 at nsThread.cpp:989
    frame #12: 0x0000000101ee2653 XUL`NS_ProcessNextEvent(aThread=<unavailable>, aMayWait=false) + 51 at nsThreadUtils.cpp:297
    frame #13: 0x00000001022c2acc XUL`mozilla::ipc::MessagePumpForNonMainThreads::Run(this=0x0000000111095e80, aDelegate=0x00000001007d44e0) + 284 at MessagePump.cpp:326
    frame #14: 0x000000010228592c XUL`MessageLoop::Run() [inlined] MessageLoop::RunHandler(this=<unavailable>) + 60 at message_loop.cc:227
    frame #15: 0x0000000102285927 XUL`MessageLoop::Run(this=<unavailable>) + 55 at message_loop.cc:201
    frame #16: 0x0000000101ea1033 XUL`nsThread::ThreadFunc(aArg=0x000000010072cb00) + 291 at nsThread.cpp:401
    frame #17: 0x0000000101b3be79 libnss3.dylib`_pt_root(arg=0x00000001007349f0) + 281 at ptthread.c:212
    frame #18: 0x00007fff90f0a9b1 libsystem_pthread.dylib`_pthread_body + 131
    frame #19: 0x00007fff90f0a92e libsystem_pthread.dylib`_pthread_start + 168
    frame #20: 0x00007fff90f08385 libsystem_pthread.dylib`thread_start + 13
(lldb) frame select 0
frame #0: 0x00000001028f07d0 XUL`mozilla::WebrtcVideoConduit::SelectSendResolution(unsigned short, unsigned short, webrtc::I420VideoFrame*) + 71 at VideoConduit.cpp:1249
   1246	    mb_height = (mSendingHeight + 15) >> 4;
   1247
   1248	    cur_fs = mb_width * mb_height;
-> 1249	    max_fps = mCurSendCodecConfig->mEncodingConstraints.maxMbps/cur_fs;
   1250	    if (max_fps < mSendingFramerate) {
   1251	      new_framerate = max_fps;
   1252	    }
(lldb) p *this
(mozilla::WebrtcVideoConduit) $14 = {
  mozilla::VideoSessionConduit = {
    mozilla::MediaSessionConduit = {
      mRefCnt = {
        mValue = {
          mozilla::detail::AtomicBaseIncDec<unsigned long, mozilla::MemoryOrdering> = {
            mozilla::detail::AtomicBase<unsigned long, mozilla::MemoryOrdering> = (mValue = 4)
          }
        }
      }
    }
    mFrameRequestMethod = FrameRequestNone
    mUsingNackBasic = false
    mUsingTmmbr = false
  }
  mVideoEngine = 0x0000000139bfc090
  mTransportMonitor = {
    mozilla::BlockingResourceBase = {
      mChainPrev = 0x0000000000000000
      mName = 0x00000001068cdfb6 "WebrtcVideoConduit"
      mType = eReentrantMonitor
      mAcquired = false
    }
    mReentrantMonitor = 0x000000013de92400
    mEntryCount = 0
  }
  mTransmitterTransport = {
    mRawPtr = 0x000000011b9dc9e0
  }
  mReceiverTransport = {
    mRawPtr = 0x000000011ef692a0
  }
  mRenderer = {
    mRawPtr = 0x000000011ef69320
  }
  mPtrViEBase = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViEBase> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrViECapture = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViECapture> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrViECodec = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViECodec> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrViENetwork = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViENetwork> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrViERender = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViERender> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrRTP = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViERTP_RTCP> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrExtCodec = {
    mozilla::Scoped<mozilla::ScopedCustomReleaseTraits0<webrtc::ViEExternalCodec> > = {
      mValue = 0x0000000139bfc090
      _mCheckNotUsedAsTemporary = (mStatementDone = true)
    }
  }
  mPtrExtCapture = 0x0000000139684000
  mEngineTransmitting = {
    mozilla::detail::AtomicBase<unsigned int, mozilla::MemoryOrdering> = (mValue = 1)
  }
  mEngineReceiving = {
    mozilla::detail::AtomicBase<unsigned int, mozilla::MemoryOrdering> = (mValue = 1)
  }
  mChannel = 0
  mCapId = 4097
  mRecvCodecList = size=2 {
    [0] = 0x0000000126e3b8f0
    [1] = 0x0000000111443860
  }
  mCodecMutex = {
    mozilla::OffTheBooksMutex = {
      mozilla::BlockingResourceBase = {
        mChainPrev = 0x0000000000000000
        mName = 0x00000001068cdfc9 "VideoConduit codec db"
        mType = eMutex
        mAcquired = true
      }
      mLock = 0x000000013de92b80
    }
  }
  mCurSendCodecConfig = {
    mRawPtr = 0x0000000111499d70
  }
  mInReconfig = false
  mLastWidth = 0
  mLastHeight = 0
  mSendingWidth = 0
  mSendingHeight = 0
  mReceivingWidth = 640
  mReceivingHeight = 480
  mSendingFramerate = 30
  mLastFramerateTenths = {
    mozilla::detail::AtomicBaseIncDec<int, mozilla::MemoryOrdering> = {
      mozilla::detail::AtomicBase<int, mozilla::MemoryOrdering> = (mValue = 80)
    }
  }
  mNumReceivingStreams = 1
  mVideoLatencyTestEnable = false
  mVideoLatencyAvg = 0
  mMinBitrate = 200
  mStartBitrate = 300
  mMaxBitrate = 2000
  mSyncedTo = {
    mRawPtr = 0x000000013c938900
  }
  mExternalSendCodec = {
    mRawPtr = 0x0000000126e481f0
  }
  mExternalRecvCodec = {
    mRawPtr = 0x0000000126d6cee0
  }
  mExternalSendCodecHandle = (mRawPtr = 0x000000011ef6bf80)
  mExternalRecvCodecHandle = (mRawPtr = 0x000000011ef51860)
  mVideoCodecStat = {
    mRawPtr = 0x00000001278cf100
  }
  mLoadManager = {
    mRawPtr = 0x000000011e6acf20
  }
  mCodecMode = kRealtimeVideo
}
(lldb) frame variable
(mozilla::WebrtcVideoConduit *) this = 0x000000013e171bb0
(unsigned int) framerate = 30
(unsigned int) new_framerate = 30
(unsigned int) mb_width = <variable not available>

(unsigned int) mb_height = <variable not available>

(unsigned int) cur_fs = 0
Component: Untriaged → Untriaged
OS: Unspecified → Mac OS X
Product: Firefox → Core
Hardware: Unspecified → x86_64
Whiteboard: [WebRTC]

Updated

3 years ago
Component: Untriaged → WebRTC: Audio/Video
(Reporter)

Updated

3 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1237224
You need to log in before you can comment on or make changes to this bug.