Closed Bug 1124175 Opened 5 years ago Closed 5 years ago

Debug Crash (screensharing?): Assertion failed: (qm_->codec_width % 2 == 0), function UpdateCodecResolution

Categories

(Core :: WebRTC, defect, critical)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: standard8, Assigned: jesup)

Details

Attachments

(1 file, 1 obsolete file)

I'm getting this occasionally over the last few days, I think it is to do with the fact I'm testing the initial implementation of screen sharing on Loop.

The browser crashes with an assertion failure:

Assertion failed: (qm_->codec_width % 2 == 0), function UpdateCodecResolution, file /Users/mark/loop/gecko-dev/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc, line 717.

I missed the stack this time around, next time I'll add it to this bug.
I've had this a few more times now, here's the stack of the crashing thread:

Thread 3 Crashed:: Socket Thread
0   libsystem_kernel.dylib        	0x00007fff85cdc866 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff8b84835c pthread_kill + 92
2   libsystem_c.dylib             	0x00007fff88c7ab1a abort + 125
3   libsystem_c.dylib             	0x00007fff88c449bf __assert_rtn + 321
4   XUL                           	0x000000010416890d webrtc::VCMQmResolution::UpdateCodecResolution() + 477
5   XUL                           	0x0000000104168109 webrtc::VCMQmResolution::UpdateDownsamplingState(webrtc::UpDownAction) + 969 (qm_select.cc:698)
6   XUL                           	0x0000000104167cc5 webrtc::VCMQmResolution::GoingDownResolution() + 517 (qm_select.cc:632)
7   XUL                           	0x0000000104166fd3 webrtc::VCMQmResolution::SelectResolution(webrtc::VCMResolutionScale**) + 627 (qm_select.cc:374)
8   XUL                           	0x000000010416682c webrtc::media_optimization::MediaOptimization::SelectQuality(webrtc::VCMQMSettingsCallback*) + 172 (media_optimization.cc:485)
9   XUL                           	0x00000001041665b1 webrtc::media_optimization::MediaOptimization::SetTargetRates(unsigned int, unsigned char, unsigned int, webrtc::VCMProtectionCallback*, webrtc::VCMQMSettingsCallback*) + 1345 (scoped_ptr.h:259)
10  XUL                           	0x000000010416fa5c webrtc::(anonymous namespace)::VideoCodingModuleImpl::SetChannelParameters(unsigned int, unsigned char, unsigned int) + 92 (video_sender.cc:256)
11  XUL                           	0x0000000104195da5 webrtc::ViEEncoder::OnNetworkChanged(unsigned int, unsigned char, unsigned int) + 133 (vie_encoder.cc:1079)
12  XUL                           	0x00000001040f02f0 webrtc::BitrateControllerImpl::OnNetworkChanged(unsigned int, unsigned char, unsigned int) + 480 (bitrate_controller_impl.cc:324)
13  XUL                           	0x00000001040f047a webrtc::BitrateControllerImpl::OnReceivedRtcpReceiverReport(unsigned char, unsigned int, int, unsigned int) + 250 (bitrate_controller_impl.cc:275)
14  XUL                           	0x00000001040f0977 webrtc::RtcpBandwidthObserverImpl::OnReceivedRtcpReceiverReport(std::list<webrtc::RTCPReportBlock, std::allocator<webrtc::RTCPReportBlock> > const&, unsigned short, long long) + 359 (bitrate_controller_impl.cc:72)
15  XUL                           	0x000000010412c389 webrtc::RTCPReceiver::TriggerCallbacksFromRTCPPacket(webrtc::RTCPHelp::RTCPPacketInformation&) + 521 (rtcp_receiver.cc:1485)
16  XUL                           	0x000000010413c673 webrtc::ModuleRtpRtcpImpl::IncomingRtcpPacket(unsigned char const*, unsigned short) + 195 (rtp_rtcp_impl.cc:314)
17  XUL                           	0x000000010419c565 webrtc::ViENetworkImpl::ReceivedRTCPPacket(int, void const*, int) + 133 (vie_network_impl.cc:178)
18  XUL                           	0x0000000101ed051f mozilla::WebrtcVideoConduit::ReceivedRTCPPacket(void const*, int) + 111 (VideoConduit.cpp:1150)
19  XUL                           	0x0000000101ed5f48 mozilla::MediaPipeline::RtcpPacketReceived(mozilla::TransportLayer*, unsigned char const*, unsigned long) + 264 (MediaPipeline.cpp:493)
20  XUL                           	0x0000000101ed6efe mozilla::MediaPipeline::PacketReceived(mozilla::TransportLayer*, unsigned char const*, unsigned long) + 798 (MediaPipeline.cpp:542)
21  XUL                           	0x0000000101f62af6 mozilla::TransportLayerIce::IcePacketReceived(mozilla::NrIceMediaStream*, int, unsigned char const*, int) + 1142 (sigslot.h:2481)
22  XUL                           	0x0000000101f3dd79 mozilla::NrIceCtx::msg_recvd(void*, nr_ice_peer_ctx_*, nr_ice_media_stream_*, int, unsigned char*, int) + 201 (sigslot.h:2553)
23  XUL                           	0x00000001041b0760 nr_ice_peer_ctx_deliver_packet_maybe + 256 (ice_peer_ctx.c:739)
24  XUL                           	0x00000001041ad4a1 nr_ice_ctx_deliver_packet + 81 (ice_ctx.c:664)
25  XUL                           	0x00000001041b0df8 nr_ice_socket_readable_cb + 1160 (ice_socket.c:187)
26  XUL                           	0x0000000101f3439a mozilla::NrSocket::OnSocketReady(PRFileDesc*, short) + 58 (nr_socket_prsock.cpp:198)
27  XUL                           	0x00000001016d8037 nsSocketTransportService::DoPollIteration(bool) + 679 (nsSocketTransportService2.cpp:882)
28  XUL                           	0x00000001016d7c10 nsSocketTransportService::Run() + 352 (nsSocketTransportService2.cpp:735)
29  XUL                           	0x00000001016d833d non-virtual thunk to nsSocketTransportService::Run() + 13 (nsSocketTransportService2.cpp:776)
30  XUL                           	0x00000001015f191f nsThread::ProcessNextEvent(bool, bool*) + 1487 (nsCOMPtr.h:389)
31  XUL                           	0x0000000101620e43 NS_ProcessNextEvent(nsIThread*, bool) + 51 (nsThreadUtils.cpp:265)
32  XUL                           	0x00000001019a429c mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) + 284 (MessagePump.cpp:339)
33  XUL                           	0x000000010197a770 MessageLoop::Run() + 64 (message_loop.cc:508)
34  XUL                           	0x00000001015efd52 nsThread::ThreadFunc(void*) + 562 (nsThread.cpp:358)
35  libnss3.dylib                 	0x000000010133da49 _pt_root + 281 (ptthread.c:215)
36  libsystem_pthread.dylib       	0x00007fff8b847899 _pthread_body + 138
37  libsystem_pthread.dylib       	0x00007fff8b84772a _pthread_start + 137
38  libsystem_pthread.dylib       	0x00007fff8b84bfc9 thread_start + 13
This is also happening to me quite often (while working on Loop screen sharing). I'm running a debug build on OSX and it sometimes crashes without showing the crash reporter(!)
Severity: normal → critical
These should not happen; it tests for an odd size in VCMQmResolution::AdjustAction() via EvenFrameSize().

However, I may have found a small window that isn't checked for EvenFrameSize() - in ConvertSpatialFractionalToWhole(), where it combines two 3/4 reductions to a 1/2 reduction.  I'll attach a patch that should plug that.
Assignee: nobody → rjesup
OS: Mac OS X → All
Can you guys try this patch?
Flags: needinfo?(standard8)
Flags: needinfo?(mdeboer)
Attachment #8555324 - Flags: review?(pkerr)
Attachment #8555324 - Flags: review?(pkerr) → review+
I've tried it a few times today, and I haven't seen any crashes - though I'm not sure I've used it enough to be certain yet.
I've just had another crash but with the patch applied. The stack is the same as per comment 1.

I had set up a screen share between 2 FFs on my Mac. The share is a hidden dom element on the side that is sending it. At the time I was resizing the receiving window lots though I'd be surprised if that had a direct affect.
Flags: needinfo?(standard8)
Top of the assertion stack:

* thread #6: tid = 0x10fe7e, 0x00007fff8d9e5866 libsystem_kernel.dylib`__pthread_kill + 10, name = 'Socket Thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff8d9e5866 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff8e1f335c libsystem_pthread.dylib`pthread_kill + 92
    frame #2: 0x00007fff969f5b1a libsystem_c.dylib`abort + 125
    frame #3: 0x00007fff969bf9bf libsystem_c.dylib`__assert_rtn + 321
    frame #4: 0x00000001041a705d XUL`webrtc::VCMQmResolution::UpdateCodecResolution(this=<unavailable>) + 477 at qm_select.cc:713
    frame #5: 0x00000001041a6849 XUL`webrtc::VCMQmResolution::UpdateDownsamplingState(this=0x000000010ff08600, up_down=<unavailable>) + 969 at qm_select.cc:697
    frame #6: 0x00000001041a6405 XUL`webrtc::VCMQmResolution::GoingDownResolution(this=0x000000010ff08600) + 517 at qm_select.cc:632
    frame #7: 0x00000001041a56c3 XUL`webrtc::VCMQmResolution::SelectResolution(this=0x000000010ff08600, qm=0x0000000100583c68) + 627 at qm_select.cc:374
    frame #8: 0x00000001041a4d1c XUL`webrtc::media_optimization::MediaOptimization::SelectQuality(this=0x000000011db1c070, video_qmsettings_callback=0x000000011d8835d0) + 172 at media_optimization.cc:536
    frame #9: 0x00000001041a4aa2 XUL`webrtc::media_optimization::MediaOptimization::SetTargetRates(this=0x000000011db1c070, target_bitrate=<unavailable>, fraction_lost=<unavailable>, round_trip_time_ms=<unavailable>, protection_callback=<unavailable>, qmsettings_callback=<unavailable>) + 1730 at media_optimization.cc:337
    frame #10: 0x00000001041ad68c XUL`webrtc::(anonymous namespace)::VideoCodingModuleImpl::SetChannelParameters(unsigned int, unsigned char, unsigned int) [inlined] webrtc::scoped_ptr<webrtc::vcm::VideoSender, webrtc::DefaultDeleter<webrtc::vcm::VideoSender> >::operator->(this=0x000000011db1c000, target_bitrate=322318, lossRate='\0', rtt=9) const + 67 at video_sender.cc:253
    frame #11: 0x00000001041ad649 XUL`webrtc::(anonymous namespace)::VideoCodingModuleImpl::SetChannelParameters(this=<unavailable>, target_bitrate=322318, lossRate='\0', rtt=9) + 25 at video_coding_impl.cc:150
    frame #12: 0x00000001041da4a8 XUL`webrtc::ViEEncoder::OnNetworkChanged(this=0x0000000113a58d40, bitrate_bps=322318, fraction_lost='\0', round_trip_time_ms=<unavailable>) + 264 at vie_encoder.cc:918
    frame #13: 0x000000010411b550 XUL`webrtc::BitrateControllerImpl::NormalRateAllocation(this=<unavailable>, bitrate=<unavailable>, fraction_loss=<unavailable>, rtt=9, sum_min_bitrates=<unavailable>) + 432 at bitrate_controller_impl.cc:328
    frame #14: 0x000000010411b226 XUL`webrtc::BitrateControllerImpl::OnReceivedRtcpReceiverReport(this=0x0000000114c28020, fraction_loss=<unavailable>, rtt=<unavailable>, number_of_packets=<unavailable>, now_ms=<unavailable>) + 182 at bitrate_controller_impl.cc:254
    frame #15: 0x000000010411c0d7 XUL`webrtc::BitrateControllerImpl::RtcpBandwidthObserverImpl::OnReceivedRtcpReceiverReport(this=<unavailable>, report_blocks=<unavailable>, rtt=<unavailable>, now_ms=<unavailable>) + 359 at bitrate_controller_impl.cc:71
    frame #16: 0x000000010416b85b XUL`webrtc::RTCPReceiver::TriggerCallbacksFromRTCPPacket(this=0x0000000114802f18, rtcpPacketInformation=0x0000000100584ba8) + 699 at rtcp_receiver.cc:1470
The weird thing is, the assertion says:

Assertion failed: (qm_->codec_width % 2 == 0), function UpdateCodecResolution, file /Users/mark/loop/gecko-dev/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc, line 717.

but, going up the stack frame in the debugger gives:

frame #4: 0x00000001041a705d XUL`webrtc::VCMQmResolution::UpdateCodecResolution(this=<unavailable>) + 477 at qm_select.cc:713
   710 	    qm_->codec_height = static_cast<uint16_t>(height_ /
   711 	                                              qm_->spatial_height_fact + 0.5f);
   712 	    // Size should not exceed native sizes.
-> 713 	    assert(qm_->codec_width <= native_width_);
   714 	    assert(qm_->codec_height <= native_height_);
   715 	    // New sizes should be multiple of 2, otherwise spatial should not have
   716 	    // been selected.

Apparently "this" isn't available, so I'll see if I can adjust the trace and have that output before the assertions.
Flags: needinfo?(mdeboer)
Here's the trace line just before the crash:

UpdateCodecResolution: [2270 1160] 2270 1160 => 1703 870

This is from:

    printf("UpdateCodecResolution: [%d %d] %d %d => %d %d\n",
                 native_width_, native_height_,
                 old_width, old_height,
                 qm_->codec_width, qm_->codec_height
                 );

which obviously shows the codec_width isn't a multiple of 2.

I played around with it a bit more. I'm typically reproducing this with two FF instances running on a Mac, with screensharing using Hello. I find that using Colloquy as the window to share seems to give this more commonly - although it could be because its on a retina display.

The crash I just got had these proceeding it:

UpdateCodecResolution: [640 480] 640 480 => 480 360
UpdateCodecResolution: [640 480] 480 360 => 320 240
UpdateCodecResolution: [640 480] 320 240 => 240 180
UpdateCodecResolution: [2126 1064] 2126 1064 => 1595 798
Assertion failed: (qm_->codec_width % 2 == 0), function UpdateCodecResolution, file /Users/mark/loop/gecko-dev/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc, line 731.

The first three updates are me moving the Colloquy window onto the non-retina display, resizing it, moving it back to the retina display and then putting it back to its normal size (approximately). The wacky numbers and the crash appeared as I'd flipped back onto some main apps on my main screen, and then focussed back on Colloquy on the retina display.

That isn't always the STR. I can reproduce this just with it transmitter sitting static (apart from maybe updates on irc in Colloquy), and I might be playing around with receiving end.
Patch to remove all Even-size limitations and replace asserts for scaling up too far with maximums.  (The logic for scaling selection is convoluted and involves history array rewrites, and clearly has bugs somewhere in it - this avoids problems while not asserting, until we can rewrite that mess)
Attachment #8562156 - Flags: review?(pkerr)
Attachment #8555324 - Attachment is obsolete: true
Attachment #8562156 - Flags: review?(pkerr) → review+
https://hg.mozilla.org/mozilla-central/rev/e4663f57570a
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.