Java Code Examples for com.qiniu.pili.droid.streaming.StreamingProfile#AVProfile

The following examples show how to use com.qiniu.pili.droid.streaming.StreamingProfile#AVProfile . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PiliStreamingViewManager.java    From pili-react-native with MIT License 6 votes vote down vote up
@ReactProp(name = "profile")
public void setProfile(AspectFrameLayout view, @Nullable ReadableMap profile) {
    ReadableMap video = profile.getMap("video");
    ReadableMap audio = profile.getMap("audio");
    int encodingSize = profile.getInt("encodingSize");

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(video.getInt("fps"), video.getInt("bps"), video.getInt("maxFrameInterval"));//fps bps maxFrameInterval
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mProfile.setEncodingSizeLevel(encodingSize);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
 
Example 2
Source File: PiliStreamingViewManager.java    From react-native-pili with MIT License 6 votes vote down vote up
@ReactProp(name = "profile")
public void setProfile(AspectFrameLayout view, @Nullable ReadableMap profile) {
    ReadableMap video = profile.getMap("video");
    ReadableMap audio = profile.getMap("audio");
    int encodingSize = profile.getInt("encodingSize");

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(video.getInt("fps"), video.getInt("bps"), video.getInt("maxFrameInterval"));//fps bps maxFrameInterval
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mProfile.setEncodingSizeLevel(encodingSize);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
 
Example 3
Source File: PiliAudioStreamingViewManager.java    From pili-react-native with MIT License 5 votes vote down vote up
@ReactProp(name = "profile")
public void setProfile(View view, @Nullable ReadableMap profile) {
    ReadableMap audio = profile.getMap("audio");

    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(0,0,0);//hack for bad API

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
 
Example 4
Source File: PiliAudioStreamingViewManager.java    From react-native-pili with MIT License 5 votes vote down vote up
@ReactProp(name = "profile")
public void setProfile(View view, @Nullable ReadableMap profile) {
    ReadableMap audio = profile.getMap("audio");

    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(0,0,0);//hack for bad API

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
 
Example 5
Source File: StreamingBaseActivity.java    From PLDroidMediaStreaming with Apache License 2.0 4 votes vote down vote up
private void initEncodingProfile() {
    mEncodingConfig = (EncodingConfig) getIntent().getSerializableExtra("EncodingConfig");

    StreamingProfile.AudioProfile aProfile = null;
    StreamingProfile.VideoProfile vProfile = null;

    if (!mEncodingConfig.mIsAudioOnly) {
        // video quality
        if (mEncodingConfig.mIsVideoQualityPreset) {
            mProfile.setVideoQuality(mEncodingConfig.mVideoQualityPreset);
        } else {
            vProfile = new StreamingProfile.VideoProfile(
                    mEncodingConfig.mVideoQualityCustomFPS,
                    mEncodingConfig.mVideoQualityCustomBitrate * 1024,
                    mEncodingConfig.mVideoQualityCustomMaxKeyFrameInterval,
                    mEncodingConfig.mVideoQualityCustomProfile
            );
        }

        // video size
        if (mEncodingConfig.mIsVideoSizePreset) {
            mProfile.setEncodingSizeLevel(mEncodingConfig.mVideoSizePreset);
        } else {
            mProfile.setPreferredVideoEncodingSize(mEncodingConfig.mVideoSizeCustomWidth, mEncodingConfig.mVideoSizeCustomHeight);
        }

        // video misc
        mProfile.setEncodingOrientation(mEncodingConfig.mVideoOrientationPortrait ? StreamingProfile.ENCODING_ORIENTATION.PORT : StreamingProfile.ENCODING_ORIENTATION.LAND);
        mProfile.setEncoderRCMode(mEncodingConfig.mVideoRateControlQuality ? StreamingProfile.EncoderRCModes.QUALITY_PRIORITY : StreamingProfile.EncoderRCModes.BITRATE_PRIORITY);
        mProfile.setBitrateAdjustMode(mEncodingConfig.mBitrateAdjustMode);
        mProfile.setFpsControllerEnable(mEncodingConfig.mVideoFPSControl);
        mProfile.setYuvFilterMode(mEncodingConfig.mYuvFilterMode);
        if (mEncodingConfig.mBitrateAdjustMode == StreamingProfile.BitrateAdjustMode.Auto) {
            mProfile.setVideoAdaptiveBitrateRange(mEncodingConfig.mAdaptiveBitrateMin * 1024, mEncodingConfig.mAdaptiveBitrateMax * 1024);
        }
    }

    // audio quality
    if (mEncodingConfig.mIsAudioQualityPreset) {
        mProfile.setAudioQuality(mEncodingConfig.mAudioQualityPreset);
    } else {
        aProfile = new StreamingProfile.AudioProfile(
                mEncodingConfig.mAudioQualityCustomSampleRate,
                mEncodingConfig.mAudioQualityCustomBitrate * 1024
        );
    }

    // custom
    if (aProfile != null || vProfile != null) {
        StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
        mProfile.setAVProfile(avProfile);
    }

    mProfile.setDnsManager(getMyDnsManager())
            .setStreamStatusConfig(new StreamingProfile.StreamStatusConfig(3))
            .setSendingBufferProfile(new StreamingProfile.SendingBufferProfile(0.2f, 0.8f, 3.0f, 20 * 1000));
}