Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenWebRTCLocalAudioSource with volume property #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenWebRTC-SDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
:git => "https://github.com/EricssonResearch/openwebrtc-ios-sdk.git",
:tag => "0.4"
}
s.source_files = "SDK/**/*.{h,m}"
s.source_files = "OpenWebRTC-SDK/**/*.{h,m}"
s.resources = "Resources/**"
s.dependency 'OpenWebRTC'
#s.resource = { :http => "https://github.com/EricssonResearch/openwebrtc/blob/master/bridge/client/sdp.js" }
Expand Down
1 change: 1 addition & 0 deletions SDK/OpenWebRTC.h → OpenWebRTC-SDK/OpenWebRTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#import <OpenWebRTC-SDK/OpenWebRTCUtils.h>
#import <OpenWebRTC-SDK/OpenWebRTCSettings.h>
#import <OpenWebRTC-SDK/OpenWebRTCNativeHandler.h>
#import <OpenWebRTC-SDK/OpenWebRTCLocalAudioSource.h>

#import "owr.h"

Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions OpenWebRTC-SDK/OpenWebRTCLocalAudioSource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// OpenWebRTCLocalAudioSource.h
//
// Copyright (c) 2016, Ericsson AB.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Copyright should be yours since it is your change :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh.. I thought these sorts of contributions usually involved copyright
reassignment.

On Thu, Feb 18, 2016 at 11:24 PM, Stefan Ålund [email protected]
wrote:

In OpenWebRTC-SDK/OpenWebRTCLocalAudioSource.h
#58 (comment)
:

@@ -0,0 +1,44 @@
+//
+// OpenWebRTCLocalAudioSource.h
+//
+// Copyright (c) 2016, Ericsson AB.

The Copyright should be yours since it is your change :)


Reply to this email directly or view it on GitHub
https://github.com/EricssonResearch/openwebrtc-ios-sdk/pull/58/files#r53429820
.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, no. Your code, your copyright. @superdump what do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Come to think of it, the reason some projects do that so they're able to
change the license down the line if they need to, say if it turns out the
license wording needs to be updated for some reason. Without copyright
reassignment you'd need to get permission from each author rather than
simply changing the license unilaterally. I shouldn't have said "usually".
Some projects do it.

On Thu, Feb 18, 2016 at 11:28 PM, Stefan Ålund [email protected]
wrote:

In OpenWebRTC-SDK/OpenWebRTCLocalAudioSource.h
#58 (comment)
:

@@ -0,0 +1,44 @@
+//
+// OpenWebRTCLocalAudioSource.h
+//
+// Copyright (c) 2016, Ericsson AB.

I don't think so, no. Your code, your copyright. @superdump
https://github.com/superdump what do you think?


Reply to this email directly or view it on GitHub
https://github.com/EricssonResearch/openwebrtc-ios-sdk/pull/58/files#r53430044
.

// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.

// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
// OF SUCH DAMAGE.
//

#ifndef OpenWebRTCLocalAudioSource_h
#define OpenWebRTCLocalAudioSource_h

typedef struct _OwrLocalMediaSource OwrLocalMediaSource;

@interface OpenWebRTCLocalAudioSource : NSValue

@property (readonly) const char *objCType;
@property double volume;

- (instancetype)initWithLocalMediaSource:(OwrLocalMediaSource *)localMediaSource;
- (void)getValue:(void *)value;

@end

#endif /* OpenWebRTCLocalAudioSource_h */
76 changes: 76 additions & 0 deletions OpenWebRTC-SDK/OpenWebRTCLocalAudioSource.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//
// OpenWebRTCLocalAudioSource.m
//
// Copyright (c) 2016, Ericsson AB.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.

// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
// OF SUCH DAMAGE.
//

@import Foundation;

#include "glib-object.h"
#include "OpenWebRTCLocalAudioSource.h"

@interface OpenWebRTCLocalAudioSource ()
{
OwrLocalMediaSource *_mediaSource;
}
@end

@implementation OpenWebRTCLocalAudioSource

#pragma mark - Public methods

- (instancetype)initWithLocalMediaSource:(OwrLocalMediaSource *)mediaSource {
if (self = [super init]) {
_mediaSource = mediaSource;
g_object_ref(mediaSource);
}

return self;
}

- (void)getValue:(void *)value {
*((void **)value) = _mediaSource;
}

- (const char *)objCType {
return @encode(OwrLocalMediaSource *);
}

- (void)dealloc {
g_object_unref(_mediaSource);
_mediaSource = nil;
}

- (double)volume {
double volume;
g_object_get(_mediaSource, "volume", &volume, NULL);
return volume;
}

- (void)setVolume:(double)localSourceVolume {
g_object_set(_mediaSource, "volume", localSourceVolume, NULL);
}

@end
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
// OF SUCH DAMAGE.
//

@import Foundation;

#import "OpenWebRTCLocalAudioSource.h"
#import "OpenWebRTCNativeHandler.h"
#import "OpenWebRTCUtils.h"

Expand All @@ -36,6 +39,7 @@
#include "owr_audio_payload.h"
#include "owr_audio_renderer.h"
#include "owr_media_session.h"
#include "owr_local_media_source.h"
#include "owr_transport_agent.h"
#include "owr_video_payload.h"
#include "owr_video_renderer.h"
Expand Down Expand Up @@ -1145,23 +1149,32 @@ static void got_local_sources(GList *sources)
OwrMediaSource *source = NULL;
OwrMediaType media_type;
OwrMediaType source_type;
NSValue *source_value;
NSString *media_type_name;

source = sources->data;
g_assert(OWR_IS_MEDIA_SOURCE(source));

g_object_get(source, "name", &name, "type", &source_type, "media-type", &media_type, NULL);

if (media_type == OWR_MEDIA_TYPE_AUDIO) {
source_value = [[OpenWebRTCLocalAudioSource alloc] initWithLocalMediaSource:OWR_LOCAL_MEDIA_SOURCE(source)];
media_type_name = @"audio";
} else {
/* We ref the sources because we want them to stay around. On iOS they will never be
* unplugged, I expect, but it's safer this way. */
g_object_ref(source);
source_value = [NSValue valueWithPointer:source];
media_type_name = @"video";
}

/* We ref the sources because we want them to stay around. On iOS they will never be
* unplugged, I expect, but it's safer this way. */
g_object_ref(source);

g_print("[%s/%s] %s\n", media_type == OWR_MEDIA_TYPE_AUDIO ? "audio" : "video",
g_print("[%s/%s] %s\n", media_type_name,
source_type == OWR_SOURCE_TYPE_CAPTURE ? "capture" : source_type == OWR_SOURCE_TYPE_TEST ? "test" : "unknown",
name);

[staticSelf.localSourceArray addObject:@{@"name": [NSString stringWithUTF8String:name],
@"source": [NSValue valueWithPointer:source],
@"mediaType": media_type == OWR_MEDIA_TYPE_AUDIO ? @"audio" : @"video"
@"source": source_value,
@"mediaType": media_type_name
}];

if (!have_video && media_type == OWR_MEDIA_TYPE_VIDEO && source_type == OWR_SOURCE_TYPE_CAPTURE) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
// OF SUCH DAMAGE.
//

@import Foundation;

#import "OpenWebRTCSettings.h"

@implementation OpenWebRTCSettings
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions SDK/OpenWebRTCUtils.m → OpenWebRTC-SDK/OpenWebRTCUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
// OF SUCH DAMAGE.
//

@import Foundation;

#import "OpenWebRTCUtils.h"

@import JavaScriptCore;
Expand Down
File renamed without changes.
File renamed without changes.