⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246489 in webkit


Ignore:
Timestamp:
Jun 16, 2019, 6:38:51 PM (7 years ago)
Author:
eric.carlson@apple.com
Message:

[MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate
https://bugs.webkit.org/show_bug.cgi?id=198875
<rdar://problem/51768374>

Reviewed by Youenn Fablet.

Source/WebCore:

  • platform/graphics/MediaPlayer.h:

(WTF::LogArgument<MediaTime>::toString): Deleted, moved to MediaTime.h.
(WTF::LogArgument<MediaTimeRange>::toString): Deleted, moved to MediaTime.h.

  • platform/mediastream/mac/AVVideoCaptureSource.mm:

(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate): Avoid roundoff error.

Source/WTF:

  • wtf/MediaTime.h:

(WTF::LogArgument<MediaTime>::toString):
(WTF::LogArgument<MediaTimeRange>::toString):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r246395 r246489  
     12019-06-16  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate
     4        https://bugs.webkit.org/show_bug.cgi?id=198875
     5        <rdar://problem/51768374>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        * wtf/MediaTime.h:
     10        (WTF::LogArgument<MediaTime>::toString):
     11        (WTF::LogArgument<MediaTimeRange>::toString):
     12
    1132019-06-12  Antoine Quint  <graouts@apple.com>
    214
  • trunk/Source/WTF/wtf/MediaTime.h

    r241148 r246489  
    175175}
    176176
     177template<typename Type>
     178struct LogArgument;
     179
     180template <>
     181struct LogArgument<MediaTime> {
     182    static String toString(const MediaTime& time)
     183    {
     184        return time.toJSONString();
     185    }
     186};
     187
     188template <>
     189struct LogArgument<MediaTimeRange> {
     190    static String toString(const MediaTimeRange& range)
     191    {
     192        return range.toJSONString();
     193    }
     194};
     195
    177196}
    178197
  • trunk/Source/WebCore/ChangeLog

    r246488 r246489  
     12019-06-16  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate
     4        https://bugs.webkit.org/show_bug.cgi?id=198875
     5        <rdar://problem/51768374>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        * platform/graphics/MediaPlayer.h:
     10        (WTF::LogArgument<MediaTime>::toString): Deleted, moved to MediaTime.h.
     11        (WTF::LogArgument<MediaTimeRange>::toString): Deleted, moved to MediaTime.h.
     12
     13        * platform/mediastream/mac/AVVideoCaptureSource.mm:
     14        (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate): Avoid roundoff error.
     15
    1162019-06-16  Simon Fraser  <simon.fraser@apple.com>
    217
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.h

    r245039 r246489  
    633633} // namespace WebCore
    634634
    635 namespace WTF {
    636 
    637 template<typename Type>
    638 struct LogArgument;
    639 
    640 template <>
    641 struct LogArgument<MediaTime> {
    642     static String toString(const MediaTime& time)
    643     {
    644         return time.toJSONString();
    645     }
    646 };
    647 
    648 template <>
    649 struct LogArgument<MediaTimeRange> {
    650     static String toString(const MediaTimeRange& range)
    651     {
    652         return range.toJSONString();
    653     }
    654 };
    655 
    656 }
    657 
    658635#endif // ENABLE(VIDEO)
  • trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm

    r245948 r246489  
    328328                m_currentFrameRate = clampTo(m_currentFrameRate, frameRateRange.minFrameRate, frameRateRange.maxFrameRate);
    329329
    330                 ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate);
    331                 [device() setActiveVideoMinFrameDuration: CMTimeMake(1, m_currentFrameRate)];
    332                 [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, m_currentFrameRate)];
     330                auto frameDuration = CMTimeMake(1, m_currentFrameRate);
     331                if (CMTimeCompare(frameDuration, frameRateRange.minFrameDuration) < 0)
     332                    frameDuration = frameRateRange.minFrameDuration;
     333                else if (CMTimeCompare(frameDuration, frameRateRange.maxFrameDuration) > 0)
     334                    frameDuration = frameRateRange.maxFrameDuration;
     335
     336                ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate, ", duration ", PAL::toMediaTime(frameDuration));
     337
     338                [device() setActiveVideoMinFrameDuration: frameDuration];
     339                [device() setActiveVideoMaxFrameDuration: frameDuration];
    333340            } else
    334341                ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "cannot find proper frame rate range for the selected preset\n");
Note: See TracChangeset for help on using the changeset viewer.