Skip to content

Commit

Permalink
Release RongCloud CallKit SDK 2.8.24
Browse files Browse the repository at this point in the history
  • Loading branch information
RongRobot committed Dec 8, 2017
1 parent 2f6d53f commit 19b6857
Show file tree
Hide file tree
Showing 26 changed files with 261 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//For Agora Only Begin
//
// RCDAudioFrameObserver.hpp
// RCDAudioFrameObserver.h
// RongCallKit
//
// Created by litao on 16/9/12.
// Copyright © 2016年 Rong Cloud. All rights reserved.
//

#ifndef RCDAudioFrameObserver_hpp
#define RCDAudioFrameObserver_hpp
#ifndef RCDAudioFrameObserver_h
#define RCDAudioFrameObserver_h

#import <AgoraRtcEngineKit/IAgoraMediaEngine.h>
#import <RongCallLib/IVideoFrameObserver.h>
Expand All @@ -23,4 +24,5 @@ class RCDAudioFrameObserver : public agora::media::IAudioFrameObserver {
bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, agora::media::IAudioFrameObserver::AudioFrame &audioFrame);
};

#endif /* RCDAudioFrameObserver_hpp */
#endif /* RCDAudioFrameObserver_h */
//For Agora Only End
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//For Agora Only Begin
//
// RCDAudioFrameObserver.cpp
// RCDAudioFrameObserver.mm
// RongCallKit
//
// Created by litao on 16/9/12.
Expand Down Expand Up @@ -28,3 +29,4 @@
NSLog(@"the user id is %@", userId);
return true;
}
//For Agora Only End
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ - (void)appDidBecomeActive {
- (void)startPlayRing:(NSString *)ringPath {
if (ringPath) {
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
//默认情况下扬声器播放
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
//默认情况按静音或者锁屏键会静音
[audioSession setCategory:AVAudioSessionCategorySoloAmbient error:nil];
[audioSession setActive:YES error:nil];

if (self.audioPlayer) {
Expand All @@ -125,6 +125,9 @@ - (void)stopPlayRing {
if (self.audioPlayer) {
[self.audioPlayer stop];
self.audioPlayer = nil;
//设置铃声停止后恢复其他app的声音
[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
error:nil];
}
}

Expand Down
4 changes: 2 additions & 2 deletions ios-rongcallkit/RongCallKit/Header/RCloudImageLoader.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// EGOImageLoader.h
// EGOImageLoading
// RCloudImageLoader.h
// RongCallKit
//
// Created by Shaun Harrison on 9/15/09.
// Copyright (c) 2009-2010 enormego
Expand Down
4 changes: 2 additions & 2 deletions ios-rongcallkit/RongCallKit/Header/RCloudImageView.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// EGOImageView.h
// EGOImageLoading
// RCloudImageView.h
// RongCallKit
//
// Created by Shaun Harrison on 9/15/09.
// Copyright (c) 2009-2010 enormego
Expand Down
2 changes: 1 addition & 1 deletion ios-rongcallkit/RongCallKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.8.23</string>
<string>2.8.24</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
34 changes: 2 additions & 32 deletions ios-rongcallkit/RongCallKit/RCCall.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RCCall.m
// RCCall.mm
// RongCallKit
//
// Created by 岑裕 on 16/3/11.
Expand Down Expand Up @@ -344,37 +344,6 @@ - (void)didReceiveCallRemoteNotification:(NSString *)callId
[[UIApplication sharedApplication] presentLocalNotificationNow:callNotification];
}

#pragma mark - ringing
- (void)startPlayRing:(NSString *)ringPath {
if (ringPath) {
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
//默认情况下扬声器播放
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive:YES error:nil];

if (self.audioPlayer) {
[self stopPlayRing];
}

NSURL *url = [NSURL URLWithString:ringPath];
NSError *error = nil;
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
if (!error) {
self.audioPlayer.numberOfLoops = -1;
self.audioPlayer.volume = 1.0;
[self.audioPlayer prepareToPlay];
[self.audioPlayer play];
}
}
}

- (void)stopPlayRing {
if (self.audioPlayer) {
[self.audioPlayer stop];
self.audioPlayer = nil;
}
}

#pragma mark - alert
- (void)loadErrorAlertWithoutConfirm:(NSString *)title {
UIAlertView *alert =
Expand All @@ -393,6 +362,7 @@ - (void)cancelAlert:(NSTimer *)scheduledTimer {
if (alert.tag == AlertWithoutConfirm) {
[alert dismissWithClickedButtonIndex:0 animated:NO];
}
[[UIApplication sharedApplication].delegate.window makeKeyAndVisible];
}

- (void)loadErrorAlertWithConfirm:(NSString *)title message:(NSString *)message {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//For Agora Only Begin
//
// RCDVideoFrameObserver.h
// RongCallLib
// RongCallKit
//
// Created by litao on 16/5/16.
// Copyright © 2016年 Rong Cloud. All rights reserved.
//

#ifndef RCDVideoFrameObserver_hpp
#define RCDVideoFrameObserver_hpp
#ifndef RCDVideoFrameObserver_h
#define RCDVideoFrameObserver_h
#import <AgoraRtcEngineKit/IAgoraMediaEngine.h>
#include <RongCallLib/IVideoFrameObserver.h>
#import <UIKit/UIKit.h>
Expand All @@ -34,4 +35,5 @@ class RCDVideoFrameObserver : public agora::media::IVideoFrameObserver {

virtual ~RCDVideoFrameObserver();
};
#endif /* RCDVideoFrameObserver_hpp */
#endif /* RCDVideoFrameObserver_h */
//For Agora Only End
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//For Agora Only Begin
//
// RCDVideoFrameObserver.mm
// RongCallLib
// RongCallKit
//
// Created by litao on 16/5/16.
// Copyright © 2016年 Rong Cloud. All rights reserved.
Expand Down Expand Up @@ -115,3 +116,4 @@
[s_lock unlock];
}
}
//For Agora Only End
11 changes: 11 additions & 0 deletions ios-rongcallkit/autobuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,23 @@ ENV_FLAG=$PPARAM
elif [ $PFLAG == "-o" ]
then
VOIP_FLAG=$PPARAM
elif [ $PFLAG == "-g" ]
then
VOIP_TYPE=$PPARAM
fi
done


sed -i "" -e '/CFBundleShortVersionString/{n;s/[0-9]\.[0-9]\.[0-9]\{1,2\}/'"$VER_FLAG"'/; }' ./RongCallKit/Info.plist

if [ ${VOIP_TYPE} == "Blink" ]
then
sed -i '' -e '/For Agora Only Begin/,/For Agora Only End/d' ./RongCallKit/AudioObserver/RCDAudioFrameObserver.h
sed -i '' -e '/For Agora Only Begin/,/For Agora Only End/d' ./RongCallKit/AudioObserver/RCDAudioFrameObserver.mm
sed -i '' -e '/For Agora Only Begin/,/For Agora Only End/d' ./RongCallKit/VideoObserver/RCDVideoFrameObserver.h
sed -i '' -e '/For Agora Only Begin/,/For Agora Only End/d' ./RongCallKit/VideoObserver/RCDVideoFrameObserver.mm
fi

if [ ${DEV_FLAG} == "debug" ]
then
configuration="Debug"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#ifndef AGORA_MEDIA_ENGINE_H
#define AGORA_MEDIA_ENGINE_H
#if defined _WIN32 || defined __CYGWIN__
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif

namespace agora {
namespace media {

class IAudioFrameObserver {
public:
enum AUDIO_FRAME_TYPE {
FRAME_TYPE_PCM16 = 0, // PCM 16bit little endian
};
struct AudioFrame {
AUDIO_FRAME_TYPE type;
int samples; // number of samples in this frame
int bytesPerSample; // number of bytes per sample: 2 for PCM16
int channels; // number of channels (data are interleaved if stereo)
int samplesPerSec; // sampling rate
void *buffer; // data buffer
int64_t renderTimeMs;
};

public:
virtual bool onRecordAudioFrame(AudioFrame &audioFrame) = 0;
virtual bool onPlaybackAudioFrame(AudioFrame &audioFrame) = 0;
virtual bool onMixedAudioFrame(AudioFrame &audioFrame) = 0;
virtual bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame &audioFrame) = 0;
};

class IVideoFrameObserver {
public:
enum VIDEO_FRAME_TYPE {
FRAME_TYPE_YUV420 = 0, // YUV 420 format
};
struct VideoFrame {
VIDEO_FRAME_TYPE type;
int width; // width of video frame
int height; // height of video frame
int yStride; // stride of Y data buffer
int uStride; // stride of U data buffer
int vStride; // stride of V data buffer
void *yBuffer; // Y data buffer
void *uBuffer; // U data buffer
void *vBuffer; // V data buffer
int rotation; // rotation of this frame (0, 90, 180, 270)
int64_t renderTimeMs;
};

public:
virtual bool onCaptureVideoFrame(VideoFrame &videoFrame) = 0;
virtual bool onRenderVideoFrame(unsigned int uid, VideoFrame &videoFrame) = 0;
};

class IVideoFrame {
public:
enum PLANE_TYPE { Y_PLANE = 0, U_PLANE = 1, V_PLANE = 2, NUM_OF_PLANES = 3 };
enum VIDEO_TYPE {
VIDEO_TYPE_UNKNOWN = 0,
VIDEO_TYPE_I420 = 1,
VIDEO_TYPE_IYUV = 2,
VIDEO_TYPE_RGB24 = 3,
VIDEO_TYPE_ABGR = 4,
VIDEO_TYPE_ARGB = 5,
VIDEO_TYPE_ARGB4444 = 6,
VIDEO_TYPE_RGB565 = 7,
VIDEO_TYPE_ARGB1555 = 8,
VIDEO_TYPE_YUY2 = 9,
VIDEO_TYPE_YV12 = 10,
VIDEO_TYPE_UYVY = 11,
VIDEO_TYPE_MJPG = 12,
VIDEO_TYPE_NV21 = 13,
VIDEO_TYPE_NV12 = 14,
VIDEO_TYPE_BGRA = 15,
VIDEO_TYPE_RGBA = 16,
};
virtual void release() = 0;
virtual const unsigned char *buffer(PLANE_TYPE type) const = 0;

// Copy frame: If required size is bigger than allocated one, new buffers of
// adequate size will be allocated.
// Return value: 0 on success ,-1 on error.
virtual int copyFrame(IVideoFrame **dest_frame) const = 0;

// Convert frame
// Input:
// - src_frame : Reference to a source frame.
// - dst_video_type : Type of output video.
// - dst_sample_size : Required only for the parsing of MJPG.
// - dst_frame : Pointer to a destination frame.
// Return value: 0 if OK, < 0 otherwise.
// It is assumed that source and destination have equal height.
virtual int convertFrame(VIDEO_TYPE dst_video_type, int dst_sample_size, unsigned char *dst_frame) const = 0;

// Get allocated size per plane.
virtual int allocated_size(PLANE_TYPE type) const = 0;

// Get allocated stride per plane.
virtual int stride(PLANE_TYPE type) const = 0;

// Get frame width.
virtual int width() const = 0;

// Get frame height.
virtual int height() const = 0;

// Get frame timestamp (90kHz).
virtual unsigned int timestamp() const = 0;

// Get render time in milliseconds.
virtual int64_t render_time_ms() const = 0;

// Return true if underlying plane buffers are of zero size, false if not.
virtual bool IsZeroSize() const = 0;
};

class IExternalVideoRenderCallback {
public:
virtual void onViewSizeChanged(int width, int height) = 0;
virtual void onViewDestroyed() = 0;
};

struct ExternalVideoRenerContext {
IExternalVideoRenderCallback *renderCallback;
void *view;
int renderMode;
int zOrder;
float left;
float top;
float right;
float bottom;
};

class IExternalVideoRender {
public:
virtual void release() = 0;
virtual int initialize() = 0;
virtual int deliverFrame(const IVideoFrame &videoFrame, int rotation, bool mirrored) = 0;
};

class IExternalVideoRenderFactory {
public:
virtual IExternalVideoRender *createRenderInstance(const ExternalVideoRenerContext &context) = 0;
};

class IMediaEngine {
public:
virtual void release() = 0;
virtual int registerAudioFrameObserver(IAudioFrameObserver *observer) = 0;
virtual int registerVideoFrameObserver(IVideoFrameObserver *observer) = 0;
virtual int registerVideoRenderFactory(IExternalVideoRenderFactory *factory) = 0;
};

} // namespace media

} // namespace agora

#endif // AGORA_MEDIA_ENGINE_H
Loading

0 comments on commit 19b6857

Please sign in to comment.