Skip to content

Commit

Permalink
Merge pull request #3840 from AgoraIO/4.5.0-rte-destroy
Browse files Browse the repository at this point in the history
4.5.0 rte destroy
  • Loading branch information
Suri539 authored Nov 25, 2024
2 parents ff38605 + f9db695 commit 31c0af4
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 79 deletions.
58 changes: 58 additions & 0 deletions dita/RTC-NG/API/api_rte_destroy.dita
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="api_rte_destroy">
<title><ph keyref="Destroy_Rte"/></title>
<shortdesc id="short"><ph id="shortdesc">销毁 RTE 对象。</ph></shortdesc>
<prolog>
<metadata>
<keywords>
<indexterm keyref="Destroy_Rte"/>
</keywords>
</metadata>
</prolog>
<refbody>
<section id="prototype">
<p outputclass="codeblock">
<codeblock props="android" outputclass="language-java">public synchronized void destroy() throws RteException;</codeblock>
<codeblock props="ios mac" outputclass="language-objectivec">- (BOOL)destroy:(AgoraRteError * _Nullable)error;</codeblock>
<codeblock props="cpp unreal" outputclass="language-cpp">bool Destroy(Error *err = nullptr){
return RteDestroy(&amp;c_rte, err != nullptr ? err->get_underlying_impl() : nullptr);
}</codeblock>
<codeblock props="bp" outputclass="language-cpp"/>
<codeblock props="electron" outputclass="language-typescript"/>
<codeblock props="unity cs" outputclass="language-csharp"/>
<codeblock props="rn" outputclass="language-typescript"/>
<codeblock props="flutter" outputclass="language-dart"/> </p>
</section>
<section id="detailed_desc" deliveryTarget="details" otherprops="no-title">
<dl outputclass="since">
<dlentry props="native">
<dt>自从</dt>
<dd>v4.5.0</dd>
</dlentry>
</dl>
<p>该方法释放 RTE 对象使用的所有资源。</p>
</section>
<section id="restriction" deliveryTarget="details">
<title>调用限制</title>
<p>无。</p>
</section>
<section id="parameters" deliveryTarget="details">
<title><ph props="cpp apple">参数</ph></title>
<parml props="cpp apple">
<plentry conkeyref="SetConfigs_Rte/err">
<pt/>
<pd/>
</plentry>
</parml> </section>
<section id="return_values" props="apple cpp framework">
<title><ph keyref="return-section-title"/></title>
<p props="flutter">方法成功调用时,无返回值;方法调用失败时,会抛出 <xref keyref="AgoraRtcException"/> 异常,你需要捕获异常并进行处理。<ph props="cn">详见<xref keyref="error-code-link"/>了解详情和解决建议。</ph></p>
<p props="cpp apple unreal bp electron unity rn cs">销毁 RTE 对象是否成功:<ul>
<li><codeph><ph keyref="true"/></codeph>:销毁成功。</li>
<li><codeph><ph keyref="false"/></codeph>:销毁失败。</li>
</ul>
</p> </section>
<section props="android" conkeyref="SetAppId/exception"/>
</refbody>
</reference>
142 changes: 68 additions & 74 deletions dita/RTC-NG/API/class_videoframe.dita
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,45 @@
<section id="prototype">
<p outputclass="codeblock">
<codeblock props="android" outputclass="language-java">public class VideoFrame implements RefCounted {

public interface Buffer extends RefCounted {

@CalledByNative(&quot;Buffer&quot;) int getWidth();

@CalledByNative(&quot;Buffer&quot;) int getHeight();

@CalledByNative(&quot;Buffer&quot;) I420Buffer toI420();

@Override @CalledByNative(&quot;Buffer&quot;) void release();

@Override @CalledByNative(&quot;Buffer&quot;) void retain();

@CalledByNative(&quot;Buffer&quot;)
Buffer cropAndScale(
int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight);

@CalledByNative(&quot;Buffer&quot;) @Nullable Buffer mirror(int frameRotation);

@CalledByNative(&quot;Buffer&quot;) @Nullable Buffer rotate(int frameRotation);

@CalledByNative(&quot;Buffer&quot;)
@Nullable
Buffer transform(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth,
int scaleHeight, int frameRotation);
}

public interface I420Buffer extends Buffer {

@CalledByNative(&quot;I420Buffer&quot;) ByteBuffer getDataY();

@CalledByNative(&quot;I420Buffer&quot;) ByteBuffer getDataU();

@CalledByNative(&quot;I420Buffer&quot;) ByteBuffer getDataV();
@CalledByNative(&quot;I420Buffer&quot;) int getStrideY();
@CalledByNative(&quot;I420Buffer&quot;) int getStrideU();
@CalledByNative(&quot;I420Buffer&quot;) int getStrideV();
}

public interface I422Buffer extends Buffer {
@CalledByNative(&quot;I422Buffer&quot;) ByteBuffer getDataY();
@CalledByNative(&quot;I422Buffer&quot;) ByteBuffer getDataU();
Expand All @@ -55,13 +55,13 @@
@CalledByNative(&quot;I422Buffer&quot;) int getStrideV();
}
public interface RgbaBuffer extends Buffer { @CalledByNative(&quot;RgbaBuffer&quot;) ByteBuffer getData(); }

public interface TextureBuffer extends Buffer {

enum Type {

OES(GLES11Ext.GL_TEXTURE_EXTERNAL_OES),

RGB(GLES20.GL_TEXTURE_2D);
private final int glTarget;
private Type(final int glTarget) {
Expand All @@ -76,17 +76,17 @@
EGL_CONTEXT_14;
}
Type getType();

@CalledByNative(&quot;TextureBuffer&quot;) int getTextureId();

Matrix getTransformMatrix();

@CalledByNative(&quot;TextureBuffer&quot;) EglBase.Context getEglBaseContext();
@CalledByNative(&quot;TextureBuffer&quot;) Object getSourceTexturePool();
@CalledByNative(&quot;TextureBuffer&quot;) long getNativeEglContext();
@CalledByNative(&quot;TextureBuffer&quot;) int getEglContextType();
@CalledByNative(&quot;TextureBuffer&quot;) float[] getTransformMatrixArray();

@CalledByNative(&quot;TextureBuffer&quot;) int getSequence();
@CalledByNative(&quot;TextureBuffer&quot;) long getFenceObject();
@CalledByNative(&quot;TextureBuffer&quot;) boolean is10BitTexture();
Expand Down Expand Up @@ -198,22 +198,22 @@
return stitchMode;
}
}

private Buffer buffer;

private int rotation;

private long timestampNs;
private ColorSpace colorSpace;
private SourceType sourceType;
private float sampleAspectRatio;

private AlphaStitchMode alphaStitchMode = AlphaStitchMode.ALPHA_NO_STITCH;
private VideoFrameMetaInfo metaInfo = new VideoFrameMetaInfo();

private @Nullable ByteBuffer alphaBuffer;
private long nativeAlphaBuffer;

public VideoFrame(Buffer buffer, int rotation, long timestampNs) {
this(buffer, rotation, timestampNs, new WrappedNativeColorSpace(), null, 0L, 1.0f,
SourceType.kUnspecified.ordinal());
Expand Down Expand Up @@ -243,12 +243,12 @@
public float getSampleAspectRatio() {
return sampleAspectRatio;
}

@CalledByNative
public Buffer getBuffer() {
return buffer;
}

@CalledByNative
public int getRotation() {
return rotation;
Expand All @@ -261,7 +261,7 @@
public void setAlphaStitchMode(int stitchMode) {
alphaStitchMode = AlphaStitchMode.values()[stitchMode];
}

@CalledByNative
public long getTimestampNs() {
return timestampNs;
Expand All @@ -270,7 +270,7 @@
public VideoFrameMetaInfo getMetaInfo() {
return metaInfo;
}

public int getRotatedWidth() {
if (rotation % 180 == 0) {
return (alphaStitchMode == AlphaStitchMode.ALPHA_STITCH_LEFT
Expand All @@ -283,7 +283,7 @@
? buffer.getHeight() / 2
: buffer.getHeight();
}

public int getRotatedHeight() {
if (rotation % 180 == 0) {
return (alphaStitchMode == AlphaStitchMode.ALPHA_STITCH_UP
Expand All @@ -296,7 +296,7 @@
? buffer.getWidth() / 2
: buffer.getWidth();
}

public void replaceBuffer(Buffer buffer, int rotation, long timestampNs) {
release();
this.buffer = buffer;
Expand Down Expand Up @@ -351,12 +351,12 @@
public void fillAlphaData(ByteBuffer buffer) {
alphaBuffer = buffer;
}

@Override
public void retain() {
buffer.retain();
}

@Override
@CalledByNative
public void release() {
Expand Down Expand Up @@ -431,51 +431,51 @@ struct VideoFrame {
metaInfo(NULL){
memset(matrix, 0, sizeof(matrix));
}

VIDEO_PIXEL_FORMAT type;

int width;

int height;

int yStride;

int uStride;

int vStride;

uint8_t* yBuffer;

uint8_t* uBuffer;

uint8_t* vBuffer;

int rotation;

int64_t renderTimeMs;

int avsync_type;

uint8_t* metadata_buffer;

int metadata_size;

void* sharedContext;

int textureId;

void* d3d11Texture2d;

float matrix[16];

uint8_t* alphaBuffer;

ALPHA_STITCH_MODE alphaStitchMode;

void* pixelBuffer;

IVideoFrameMetaInfo* metaInfo;

ColorSpace colorSpace;
};</codeblock>
<codeblock props="bp" outputclass="language-cpp">USTRUCT(BlueprintType)
Expand Down Expand Up @@ -742,19 +742,6 @@ class VideoFrame {
<section id="detailed_desc">
<p>缓冲区给出的是指向指针的指针,该接口不能修改缓冲区的指针,只能修改缓冲区的内容。</p>
</section>
<section id="sub-method" props="android">
<title>方法</title>
<parml>
<plentry>
<pt>getColorSpace</pt>
<pd>获取视频帧的色彩空间属性。</pd>
</plentry>
<plentry>
<pt>setColorSpace</pt>
<pd>设置视频帧的色彩空间属性。</pd>
</plentry>
</parml>
</section>
<section id="parameters">
<title><text conref="../conref/conref_api_metadata.dita#conref_api_metadata/property"/></title>
<parml>
Expand Down Expand Up @@ -881,7 +868,14 @@ class VideoFrame {
</plentry>
<plentry id="colorspace">
<pt>colorSpace</pt>
<pd>视频帧的色彩空间属性,默认情况下会应用 Full Range 和 BT.709 标准配置。你可以根据自定义采集、自定义渲染的业务需求进行自定义设置,详见 <xref keyref="videocolorspace-link"/>。</pd>
<pd props="ios mac cpp cs unity flutter electron rn unreal bp">视频帧的色彩空间属性,默认情况下会应用 Full Range 和 BT.709 标准配置。你可以根据自定义采集、自定义渲染的业务需求进行自定义设置,详见 <xref
keyref="videocolorspace-link"/>。</pd>
<pd props="android hmos">视频帧的色彩空间属性,默认情况下会应用 Full Range 和 BT.709 标准配置。你可以根据自定义采集、自定义渲染的业务需求进行自定义设置,详见 <xref
keyref="videocolorspace-link"/>。与该参数相关的方法如下所示:
<ul>
<li><codeph>getColorSpace</codeph>:获取视频帧的色彩空间属性。</li>
<li><codeph>setColorSpace</codeph>:设置视频帧的色彩空间属性。</li>
</ul></pd>
</plentry>
<plentry props="android hmos">
<pt>sourceType</pt>
Expand Down
1 change: 1 addition & 0 deletions dita/RTC-NG/RTC_NG_API_Android.ditamap
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
<topicref keyref="AddView" toc="no"/>
<topicref keyref="Code" toc="no"/>
<topicref keyref="errorCode_RteException" toc="no"/>
<topicref keyref="Destroy_Rte" toc="no"/>
<topicref keyref="GetInfo" toc="no"/>
<topicref keyref="Message" toc="no"/>
<topicref keyref="MuteAudio" toc="no"/>
Expand Down
1 change: 1 addition & 0 deletions dita/RTC-NG/RTC_NG_API_CPP.ditamap
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
<topicref href="API/toc_rte_player.dita" chunk="to-content">
<topicref keyref="AddView" toc="no"/>
<topicref keyref="Code" toc="no"/>
<topicref keyref="Destroy_Rte" toc="no"/>
<topicref keyref="GetInfo" toc="no"/>
<topicref keyref="Message" toc="no"/>
<topicref keyref="MuteAudio" toc="no"/>
Expand Down
1 change: 1 addition & 0 deletions dita/RTC-NG/RTC_NG_API_iOS.ditamap
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@
<topicref href="API/toc_rte_player.dita" chunk="to-content">
<topicref keyref="AddView" toc="no"/>
<topicref keyref="Code" toc="no"/>
<topicref keyref="Destroy_Rte" toc="no"/>
<topicref keyref="GetInfo" toc="no"/>
<topicref keyref="Message" toc="no"/>
<topicref keyref="MuteAudio" toc="no"/>
Expand Down
1 change: 1 addition & 0 deletions dita/RTC-NG/RTC_NG_API_macOS.ditamap
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
<topicref href="API/toc_rte_player.dita" chunk="to-content">
<topicref keyref="AddView" toc="no"/>
<topicref keyref="Code" toc="no"/>
<topicref keyref="Destroy_Rte" toc="no"/>
<topicref keyref="GetInfo" toc="no"/>
<topicref keyref="Message" toc="no"/>
<topicref keyref="MuteAudio" toc="no"/>
Expand Down
Loading

0 comments on commit 31c0af4

Please sign in to comment.