Bug 167639 - [Mac] Add an audio stream description class
Summary: [Mac] Add an audio stream description class
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks: 268255
  Show dependency treegraph
 
Reported: 2017-01-31 06:52 PST by Eric Carlson
Modified: 2024-01-28 09:25 PST (History)
6 users (show)

See Also:


Attachments
Proposed patch (18.00 KB, patch)
2017-01-31 07:25 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing. (17.81 KB, patch)
2017-01-31 09:42 PST, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2017-01-31 06:52:11 PST
Create a class to wrap a CA audio stream description.
Comment 1 Eric Carlson 2017-01-31 07:25:37 PST
Created attachment 300219 [details]
Proposed patch
Comment 2 youenn fablet 2017-01-31 08:26:29 PST
Comment on attachment 300219 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300219&action=review

> Source/WebCore/platform/audio/AudioStreamDescription.h:39
> +    } description;

Can we use Variant<std::nullptr_t, const AudioStreamBasicDescription*>?

> Source/WebCore/platform/audio/AudioStreamDescription.h:49
> +        Unknown,

Do we need Unknown and isPCM?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp:115
> +            return Unknown;

Why do we return Unknown here? Shouldn't we return m_format?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp:125
> +    return m_format;

Would it be clearer if we were returning early whenever we know the format.
Then at the end, we would return Unknown I guess?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:36
> +class CAAudioStreamDescription : public AudioStreamDescription {

Can it be final?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:41
> +    const PlatformDescription& platformDescription() const final;

Make all of these private?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:47
> +    bool isPCM() const final { return m_streamDescription.mFormatID == kAudioFormatLinearPCM; }

Do we need to override this one?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:64
> +    bool operator!=(const AudioStreamBasicDescription& other) { return !operator==(other); }

space around ==?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:66
> +    bool operator!=(const AudioStreamDescription& other) { return !operator==(other); }

Ditto?

> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:78
> +CAAudioStreamDescription toCAAudioStreamDescription(const AudioStreamDescription&);

Could be inlined maybe?
Comment 3 Eric Carlson 2017-01-31 09:42:04 PST
Comment on attachment 300219 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300219&action=review

>> Source/WebCore/platform/audio/AudioStreamDescription.h:39
>> +    } description;
> 
> Can we use Variant<std::nullptr_t, const AudioStreamBasicDescription*>?

Yes, done.

>> Source/WebCore/platform/audio/AudioStreamDescription.h:49
>> +        Unknown,
> 
> Do we need Unknown and isPCM?

"None" is probably better than "Unknown"

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp:115
>> +            return Unknown;
> 
> Why do we return Unknown here? Shouldn't we return m_format?

Oops!

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp:125
>> +    return m_format;
> 
> Would it be clearer if we were returning early whenever we know the format.
> Then at the end, we would return Unknown I guess?

OK, fixed.

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:36
>> +class CAAudioStreamDescription : public AudioStreamDescription {
> 
> Can it be final?

Yes.

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:41
>> +    const PlatformDescription& platformDescription() const final;
> 
> Make all of these private?

No, because we will use this class directly in a number of places.

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:47
>> +    bool isPCM() const final { return m_streamDescription.mFormatID == kAudioFormatLinearPCM; }
> 
> Do we need to override this one?

No, fixed.

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:64
>> +    bool operator!=(const AudioStreamBasicDescription& other) { return !operator==(other); }
> 
> space around ==?

Fixed.

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:66
>> +    bool operator!=(const AudioStreamDescription& other) { return !operator==(other); }
> 
> Ditto?

Fixed.

>> Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h:78
>> +CAAudioStreamDescription toCAAudioStreamDescription(const AudioStreamDescription&);
> 
> Could be inlined maybe?

Good idea, fixed.
Comment 4 Eric Carlson 2017-01-31 09:42:54 PST
Created attachment 300226 [details]
Patch for landing.
Comment 5 WebKit Commit Bot 2017-01-31 10:20:08 PST
Comment on attachment 300226 [details]
Patch for landing.

Clearing flags on attachment: 300226

Committed r211437: <http://trac.webkit.org/changeset/211437>