Closed Bug 1069646 Opened 11 years ago Closed 11 years ago

VCMQmResolution::UpdateCodecResolution() sets invalid frame rate

Categories

(Core :: WebRTC: Audio/Video, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35
blocking-b2g 2.0+
Tracking Status
firefox32 --- wontfix
firefox33 --- fixed
firefox34 --- fixed
firefox35 --- fixed
b2g-v2.0 --- fixed
b2g-v2.0M --- fixed
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: jaywang, Assigned: jesup)

References

Details

Attachments

(1 file, 1 obsolete file)

[Blocking Requested - why for this release]: While testing the low bit-rate mode with H.264, I am seeing that VCMQmResolution::UpdateCodecResolution() sets codec framerate to 30,000. I believe this should be 30fps instead of 30,000. 09-18 21:29:33.909 7040 7046 I WebRTC : UpdateCodecResolution: [30000.000000] 30000.000000 fps => 20.993889 fps 09-18 21:29:44.539 7040 7046 I WebRTC : UpdateCodecResolution: [30000.000000] 20.993889 fps => 30000.000000 fps The problem seems to be "native_frame_rate_" was initialized with the wrong value. The frame rate from [1] was multiplied by 1000 and it passed down to VCMQmResolution::Initialize(). Then, native_frame_rate_ assigned with framerate*1000 value. [1]http://git.mozilla.org/?p=releases/gecko.git;a=blob;f=media/webrtc/trunk/webrtc/modules/video_coding/main/source/video_sender.cc;h=d25a38d1986d15c628346ff9df782aedec21af04;hb=HEAD#l160
Attachment #8492749 - Flags: review?(gpascutto)
Comment on attachment 8492749 [details] [diff] [review] scale frame rate initialization in webrtc media_opimization Review of attachment 8492749 [details] [diff] [review]: ----------------------------------------------------------------- This patch begs the question whether this isn't the problem: http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_coding/main/source/video_sender.cc#160 but because it's an integer value, multiplying by 1000 makes sense. Now, there's also this call on line 168: content_->UpdateFrameRate(frame_rate); should it not get the same change? Looking further, it seems incoming_frame_rate_ is intended to be * 1000, see this formula: http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_coding/main/source/media_optimization.cc#647 and there are calls like: http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_coding/main/source/media_optimization.cc#125 and http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_coding/main/source/media_optimization.cc#300 which suggests that setting the framerates * 1000 is intentional. Now, this call is using float, so it likely does not expect the value to be * 1000: http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc#222 So I think you only need to change this line: http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_coding/main/source/media_optimization.cc#181 and not the others! Note that user_frame_rate_ is a float. I suspect the code is probably consistent in that float=*1 and (u)int32's=*1000
Attachment #8492749 - Flags: review?(gpascutto) → review-
(In reply to Gian-Carlo Pascutto [:gcp] from comment #2) > Comment on attachment 8492749 [details] [diff] [review] > scale frame rate initialization in webrtc media_opimization > > Review of attachment 8492749 [details] [diff] [review]: > ----------------------------------------------------------------- > > This patch begs the question whether this isn't the problem: > http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/ > modules/video_coding/main/source/video_sender.cc#160 > but because it's an integer value, multiplying by 1000 makes sense. Sure > Now, there's also this call on line 168: > content_->UpdateFrameRate(frame_rate); > should it not get the same change? That also takes a uint32_t. The other call is at :605, and passes qm->frame_rate, which is an unscaled float. So one must be wrong. Using the initialization value as a guide, it's clear it's expected unscaled (i.e. only the first call from SetEncodingData() was wrong. Since the source for most of it is a float anyways, I converted it to take a float. In practice due to what it's used for (averaging), this will make little difference over a uint32_t. (so long as both are unscaled). > Looking further, it seems incoming_frame_rate_ is intended to be * 1000, see > this formula: > http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/ > modules/video_coding/main/source/media_optimization.cc#647 No, the 1000 factor there is because diff is in ms. (This adds greatly to the confusion since they weren't clear. I think your comment later is correct: floats are always unscaled, integers may be scaled (video_sender.cc/etc) or unscaled (counts of actual frames), and SetRates()). > > and there are calls like: > http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/ > modules/video_coding/main/source/media_optimization.cc#125 Takes a float; appears unscaled. media_opt_utils.h > and > http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/ > modules/video_coding/main/source/media_optimization.cc#300 > which suggests that setting the framerates * 1000 is intentional. Takes a float; code clearly wants unscaled. > Now, this call is using float, so it likely does not expect the value to be > * 1000: > http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/ > modules/video_coding/main/source/qm_select.cc#222 > > So I think you only need to change this line: > http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/ > modules/video_coding/main/source/media_optimization.cc#181 > and not the others! Per above, I disagree. > > Note that user_frame_rate_ is a float. I suspect the code is probably > consistent in that float=*1 and (u)int32's=*1000 Yes.
Attachment #8492749 - Attachment is obsolete: true
Attachment #8493134 - Flags: review?(gpascutto)
Attachment #8493134 - Flags: review?(gpascutto) → review+
Target Milestone: --- → mozilla35
(In reply to Matthew Gregan [:kinetik] from comment #5) > https://tbpl.mozilla.org/?tree=Try&rev=148862fe121e Sorry. Looks like a bug in the bzpost Mercurial extension updated the wrong bug.
Assignee: nobody → rjesup
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [webrtc-uplift][openh264-uplift]
Comment on attachment 8493134 [details] [diff] [review] scale frame rate initialization in webrtc media_opimization [Approval Request Comment] Bug caused by (feature/regressing bug #): enabling content analysis some time ago User impact if declined: mis-setting of initial conditions for the content analsys code. This may cause poor choices in the short term, and also it may confuse the encoder (or make it make bad choices about bits) if it believes it's being told an FPS of 30000 instead of 30. These problems should mostly go away the longer you're in the call, though it may take a while for some parts of it (due to running averages). Testing completed: On m-c. Should be verified before actual uplift occurs. Risk to taking this patch (and alternatives if risky): very low; corrects an obvious fault that should only avoid confusing optimization/allocation-of-bits. String or UUID changes made by this patch: none.
Attachment #8493134 - Flags: approval-mozilla-beta?
Attachment #8493134 - Flags: approval-mozilla-b2g32?
Attachment #8493134 - Flags: approval-mozilla-aurora?
nils, can you please help with testing/verifying this on a nightly before we can uplift?
Flags: needinfo?(drno)
blocking-b2g: 2.0? → 2.0+
Comment on attachment 8493134 [details] [diff] [review] scale frame rate initialization in webrtc media_opimization I believe you are just asking for a verify on the patch landed to master - the verifyme tag is not for that (confusing, I know)- please use QA-Approval flag on the patch to get it verified as fixed
Attachment #8493134 - Flags: qa-approval?
Keywords: verifyme
Jayme - when you are done with your current task please verify this patch has fixed this issue in the latest Master build.
QA Contact: jmercado
I tried yesterday to verify this, by putting load on my desktop machine while in a H264 call, but I failed to find the log messages from the original report in my log files. Hopefully Jayme has a more reliable way how to reproduce and test this. Let know if I can help in any way.
Flags: needinfo?(drno)
As with Nils in comment 13 I don't have a reliable way of reproducing this either. Jay: Can you provide some steps that we can use to verify this issue was fixed, including if possible information on what you were using to view the h.264 video in your comment 0?
Flags: needinfo?(jaywang)
(In reply to Jayme Mercado [:JMercado] from comment #14) > As with Nils in comment 13 I don't have a reliable way of reproducing this > either. > > Jay: Can you provide some steps that we can use to verify this issue was > fixed, including if possible information on what you were using to view the > h.264 video in your comment 0? I saw this issue when I ran the test with bad network condition. The test was performed with two 8x10 devices connected to two different APs, then the APs are connected to a managed switch. The switch is configured to low bandwidth 384K or 512K.
Flags: needinfo?(jaywang)
Comment on attachment 8493134 [details] [diff] [review] scale frame rate initialization in webrtc media_opimization I am taking it for beta 8, otherwise it is going to be too late. WebRTC is one of the feature we are going to put the focus on.
Attachment #8493134 - Flags: approval-mozilla-beta?
Attachment #8493134 - Flags: approval-mozilla-beta+
Attachment #8493134 - Flags: approval-mozilla-aurora?
Attachment #8493134 - Flags: approval-mozilla-aurora+
removing qa-wanted tag - issue seems to be resolved already + we can not replicate the steps in this lab.
Keywords: qawanted
Comment on attachment 8493134 [details] [diff] [review] scale frame rate initialization in webrtc media_opimization Jay, If you could confirm this fixes the issue, given you have a reliable way of reproducing this, It'd be helpful. Meanwhile :drno will try his best to get this verified based on your feedback in parallel with landing..
Attachment #8493134 - Flags: approval-mozilla-b2g32? → approval-mozilla-b2g32+
Whiteboard: [webrtc-uplift][openh264-uplift]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: