Skip to content

Commit f3f76af

Browse files
authored
Merge pull request #552 from QN-zhangzhuo/QRTC-1875-format
QRTC-1875 format code
2 parents 8f396d8 + f6ceefe commit f3f76af

File tree

7 files changed

+52
-45
lines changed

7 files changed

+52
-45
lines changed

src/main/java/com/qiniu/rtc/model/MediaConfig.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ public void setStretchMode(StretchModeEnum stretchMode) {
9999

100100
@Override
101101
public String toString() {
102-
return "MediaConfig{" +
103-
"fps=" + fps +
104-
", kbps=" + kbps +
105-
", width=" + width +
106-
", height=" + height +
107-
", holdLastFrame=" + holdLastFrame +
108-
", audioOnly=" + audioOnly +
109-
", stretchMode=" + stretchMode +
110-
'}';
102+
return "MediaConfig{"
103+
+ "fps=" + fps
104+
+ ", kbps=" + kbps
105+
+ ", width=" + width
106+
+ ", height=" + height
107+
+ ", holdLastFrame=" + holdLastFrame
108+
+ ", audioOnly=" + audioOnly
109+
+ ", stretchMode=" + stretchMode
110+
+ '}';
111111
}
112112
}

src/main/java/com/qiniu/rtc/model/MediaInput.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ public void setPosition(MediaPosition position) {
8888

8989
@Override
9090
public String toString() {
91-
return "MediaInput{" +
92-
"userId='" + userId + '\'' +
93-
", tag='" + tag + '\'' +
94-
", url='" + url + '\'' +
95-
", kind='" + kind + '\'' +
96-
", stretchMode=" + stretchMode +
97-
", position=" + position +
98-
'}';
91+
return "MediaInput{"
92+
+ "kind='" + kind + '\''
93+
+ ", userId='" + userId + '\''
94+
+ ", url='" + url + '\''
95+
+ ", tag='" + tag + '\''
96+
+ ", position=" + position
97+
+ ", stretchMode=" + stretchMode
98+
+ '}';
9999
}
100100
}

src/main/java/com/qiniu/rtc/model/MediaOutput.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public void setUrl(String url) {
4242

4343
@Override
4444
public String toString() {
45-
return "MediaOutput{" +
46-
"type='" + type + '\'' +
47-
", url='" + url + '\'' +
48-
'}';
45+
return "MediaOutput{"
46+
+ "type='" + type + '\''
47+
+ ", url='" + url + '\''
48+
+ '}';
4949
}
5050
}

src/main/java/com/qiniu/rtc/model/MediaPosition.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public void setZ(int z) {
7878

7979
@Override
8080
public String toString() {
81-
return "MediaPosition{" +
82-
"x=" + x +
83-
", y=" + y +
84-
", w=" + w +
85-
", h=" + h +
86-
", z=" + z +
87-
'}';
81+
return "MediaPosition{"
82+
+ "x=" + x
83+
+ ", y=" + y
84+
+ ", w=" + w
85+
+ ", h=" + h
86+
+ ", z=" + z
87+
+ '}';
8888
}
8989
}

src/main/java/com/qiniu/rtc/model/MergeJob.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public void setConfig(MediaConfig config) {
7171

7272
@Override
7373
public String toString() {
74-
return "MergeJob{" +
75-
"id='" + id + '\'' +
76-
", type='" + type + '\'' +
77-
", inputs=" + inputs +
78-
", outputs=" + outputs +
79-
", config=" + config +
80-
'}';
74+
return "MergeJob{"
75+
+ "id='" + id + '\''
76+
+ ", type='" + type + '\''
77+
+ ", inputs=" + inputs
78+
+ ", outputs=" + outputs
79+
+ ", config=" + config
80+
+ '}';
8181
}
8282
}

src/main/java/com/qiniu/rtc/service/MergeServiceV4.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import com.qiniu.util.Auth;
55
import com.qiniu.http.Response;
66
import com.qiniu.common.QiniuException;
7+
import com.qiniu.util.StringUtils;
78

89
import java.util.HashMap;
910
import java.util.Map;
1011

1112
public class MergeServiceV4 extends AbstractService {
1213
/**
1314
* 初始化
15+
*
1416
* @param auth
1517
*/
1618
public MergeServiceV4(Auth auth) {
@@ -19,7 +21,8 @@ public MergeServiceV4(Auth auth) {
1921

2022
/**
2123
* 创建合流任务
22-
* @param job 任务信息
24+
*
25+
* @param job 任务信息
2326
* @param appId
2427
* @param roomName
2528
* @return
@@ -32,26 +35,34 @@ public Response createMergeJob(MergeJob job, String appId, String roomName) thro
3235

3336
/**
3437
* 更新合流任务
38+
*
3539
* @param job
3640
* @param appId
3741
* @param roomName
3842
* @return
3943
* @throws QiniuException
4044
*/
4145
public Response updateMergeJob(MergeJob job, String appId, String roomName) throws QiniuException {
46+
if (job == null || StringUtils.isNullOrEmpty(job.getId())) {
47+
throw new IllegalArgumentException("");
48+
}
4249
String urlPattern = "/v4/apps/%s/rooms/%s/jobs/update";
43-
return postCall(job,urlPattern, appId, roomName);
50+
return postCall(job, urlPattern, appId, roomName);
4451
}
4552

4653
/**
4754
* 删除合流任务
48-
* @param jobId 合流任务ID
55+
*
56+
* @param jobId 合流任务ID
4957
* @param appId
5058
* @param roomName
5159
* @return
5260
* @throws QiniuException
5361
*/
5462
public Response stopMergeJob(String jobId, String appId, String roomName) throws QiniuException {
63+
if (StringUtils.isNullOrEmpty(jobId)) {
64+
throw new IllegalArgumentException("");
65+
}
5566
String urlPattern = "/v4/apps/%s/rooms/%s/jobs/stop";
5667
Map<String, String> params = new HashMap<>();
5768
params.put("id", jobId);

src/test/java/test/com/qiniu/rtc/MergeServiceV4Test.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
import com.qiniu.rtc.model.*;
77
import com.qiniu.util.StringUtils;
88

9-
import com.qiniu.util.UrlSafeBase64;
109
import org.junit.jupiter.api.BeforeAll;
1110
import org.junit.jupiter.api.Test;
1211
import test.com.qiniu.TestConfig;
1312

14-
import javax.crypto.Mac;
15-
import javax.crypto.SecretKey;
16-
import javax.crypto.spec.SecretKeySpec;
1713
import java.util.*;
1814

1915
class MergeServiceV4Test {
@@ -27,7 +23,7 @@ static void setUp() {
2723
}
2824

2925
@Test
30-
void MergeJob() throws Exception {
26+
void mergeJob() throws Exception {
3127
MergeJob mergeJob = new MergeJob();
3228
mergeJob.setType("basic");
3329

@@ -47,7 +43,7 @@ void MergeJob() throws Exception {
4743

4844
MediaOutput mediaOutput1 = new MediaOutput();
4945
mediaOutput1.setType("rtmp");
50-
mediaOutput1.setUrl("rtmp://pili-publish.qnsdk.com/sdk-live/zhuozi001?expire=1650964845&token=Zk7Ku-e90IVu2gsVItS2e7b2rR8=");
46+
mediaOutput1.setUrl("rtmp://pili-publish.qnsdk.com/sdk-live/zhuozi0001?expire=1651139796&token=XWZ8aS4vTaI13QsS0YUWy1HhJB4=");
5147

5248
List<MediaOutput> outputs = new ArrayList<>();
5349
outputs.add(mediaOutput1);
@@ -114,4 +110,4 @@ void MergeJob() throws Exception {
114110
assert mergeResult.getStatus().equals("OK");
115111
assert !StringUtils.isNullOrEmpty(mergeResult.getId());
116112
}
117-
}
113+
}

0 commit comments

Comments
 (0)