Skip to content

Commit d309186

Browse files
committed
fix: 리뷰 반영
1 parent d71a2ff commit d309186

7 files changed

Lines changed: 14 additions & 32 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ out/
4646
gcp/*.json
4747
!**/src/main/resources/gcp/unity-stt.json
4848
src/main/resources/gcp/
49+
!**/src/main/resources/gcp/unity-stt.sample.json
50+
!**/src/main/resources/gcp/.gitkeep
4951

5052
# Spring secrets
5153
application-local.yml

‎src/main/java/com/ureca/unity/domain/call/controller/CallController.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.ureca.unity.global.exception.CustomException;
66
import com.ureca.unity.global.exception.ErrorCode;
77
import lombok.RequiredArgsConstructor;
8+
import lombok.extern.slf4j.Slf4j;
89
import org.springframework.http.ResponseEntity;
910
import org.springframework.web.bind.annotation.GetMapping;
1011
import org.springframework.web.bind.annotation.RequestMapping;
@@ -14,6 +15,7 @@
1415
@RestController
1516
@RequestMapping("/api/agora")
1617
@RequiredArgsConstructor
18+
@Slf4j
1719
public class CallController {
1820

1921
private final CallService callService;
@@ -22,7 +24,7 @@ public class CallController {
2224
public ResponseEntity<AgoraTokenResponse> getRtcToken(
2325
@RequestParam String channel,
2426
@RequestParam(defaultValue = "0") int uid) {
25-
System.out.println("토큰 요청: "+uid+", 채널: "+channel);
27+
log.debug("토큰 요청: {}, 채널: {}",uid,channel);
2628
AgoraTokenResponse value=callService.makeToken(channel,uid);
2729
return ResponseEntity.ok(value);
2830
}

‎src/main/java/com/ureca/unity/domain/call/service/CallServiceImpl.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ public AgoraTokenResponse makeToken(String channel, int uid) {
1919
RtcTokenBuilder2 tokenBuilder = new RtcTokenBuilder2();
2020
RtcTokenBuilder2.Role role = RtcTokenBuilder2.Role.ROLE_PUBLISHER;
2121
int expirationTimeInSeconds = 3600;
22-
int timestamp = (int) (System.currentTimeMillis() / 1000 + expirationTimeInSeconds);
2322

24-
String token = tokenBuilder.buildTokenWithUid(appId, appCert, channel, uid, role, timestamp,timestamp);
23+
String token = tokenBuilder.buildTokenWithUid(appId, appCert, channel, uid, role, expirationTimeInSeconds,expirationTimeInSeconds);
2524
return new AgoraTokenResponse(appId,token);
2625
}
2726
}

‎src/main/java/com/ureca/unity/domain/call/service/RecordingServiceImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void stop(String resourceId, String sid, String channelName, String uid)
150150
//s3의 파일->wav로 변경->stt
151151
CompletableFuture.runAsync(() -> {
152152
try {
153-
Thread.sleep(10000); //차후 lambda로 호출되면 동작하도록 개선
153+
Thread.sleep(10000); //TODO:차후 lambda로 호출되면 동작하도록 개선
154154
String m3u8Url = String.format("https://%s.s3.ap-northeast-2.amazonaws.com/recordings/%s/%s_%s.m3u8",
155155
s3Bucket, channelName, sid, channelName);
156156
log.info("변환 시작: {}", m3u8Url);
@@ -162,7 +162,7 @@ public void stop(String resourceId, String sid, String channelName, String uid)
162162
}
163163
} catch (Exception e) {
164164
log.error("비동기 변환 작업 중 오류: {}", e.getMessage());
165-
throw new CustomException(ErrorCode.INTERNAL_SERVER_ERROR);
165+
166166
}
167167
});
168168

‎src/main/java/com/ureca/unity/domain/call/util/Converter.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public File convertM3u8ToWav(String m3u8Url) {
3838
return target;
3939

4040
} catch (Exception e) {
41-
log.error("변환 실패: {}", e.getMessage());
42-
if (target != null && target.exists()) {
43-
target.delete();
41+
log.error("변환 실패: {}", m3u8Url, e);
42+
if (target != null && target.exists() && !target.delete()) {
43+
log.warn("임시 파일 삭제 실패: {}", target.getAbsolutePath());
4444
}
45-
return null;
45+
throw new IllegalStateException("m3u8 -> wav 변환 실패", e);
4646
}
4747
}
4848
}

‎src/main/java/com/ureca/unity/domain/call/util/token/AccessToken2.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public enum PrivilegeApaas {
6363
public static final short SERVICE_TYPE_CHAT = 5;
6464
public static final short SERVICE_TYPE_APAAS = 7;
6565

66-
public String appCert = "";
66+
private String appCert = "";
6767
public String appId = "";
6868
public int expire;
6969
public int issueTs;
@@ -86,7 +86,7 @@ public void addService(Service service) {
8686

8787
public String build() throws Exception {
8888
if (!Utils.isUUID(this.appId) || !Utils.isUUID(this.appCert)) {
89-
return "";
89+
throw new IllegalArgumentException("Invalid appId or appCert format. Expected 32-character hex string.");
9090
}
9191

9292
ByteBuf buf = new ByteBuf().put(this.appId).put(this.issueTs).put(this.expire).put(this.salt).put((short) this.services.size());

‎src/main/java/com/ureca/unity/domain/stt/controller/SttController.java‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)