Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h265_params 対応 #486

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## develop

- [ADD] `h265_params` のフォームを追加する
- @tnamao
- [ADD] コネクション ID とクライアント ID の表示にラベルを追加する
- @tnamao
- [ADD] Sora 接続後にセッション ID の表示を追加する
Expand Down Expand Up @@ -55,7 +57,7 @@
- @voluntas
- [CHANGE] 一時的に ; ありにする
- @voluntas
- [UPDATE] sora-js-sdk のバージョンを 2023.2.0-canary.2 に上げる
- [UPDATE] sora-js-sdk のバージョンを 2023.2.0-canary.14 に上げる
- @voluntas
- [UPDATE] @shiguredo/virtual-background のバージョンを 2023.2.0 に上げる
- @sile
Expand Down
3 changes: 3 additions & 0 deletions instructions.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"videoH264Params": {
"description": "映像のコーデックタイプに H264 を指定した場合の設定を指定します。"
},
"videoH265Params": {
"description": "映像のコーデックタイプに H265 を指定した場合の設定を指定します。"
},
"videoAV1Params": {
"description": "映像のコーデックタイプに AV1 を指定した場合の設定を指定します。"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"redux": "4.2.1",
"redux-logger": "3.0.6",
"redux-thunk": "2.4.2",
"sora-js-sdk": "2023.2.0-canary.13"
"sora-js-sdk": "2023.2.0-canary.14"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export const setInitialParameter = () => {
if (qsParams.videoH264Params !== undefined) {
dispatch(slice.actions.setVideoH264Params(qsParams.videoH264Params))
}
if (qsParams.videoH265Params !== undefined) {
dispatch(slice.actions.setVideoH265Params(qsParams.videoH265Params))
}
if (qsParams.videoAV1Params !== undefined) {
dispatch(slice.actions.setVideoAV1Params(qsParams.videoAV1Params))
}
Expand Down Expand Up @@ -256,6 +259,7 @@ export const setInitialParameter = () => {
forwardingFilter,
videoVP9Params,
videoH264Params,
videoH265Params,
videoAV1Params,
} = getState()
if (e2ee) {
Expand Down Expand Up @@ -316,6 +320,10 @@ export const setInitialParameter = () => {
if (videoH264Params !== '') {
dispatch(slice.actions.setEnabledVideoH264Params(true))
}
// videoH265Params が存在した場合は enabledH265Params をセットする
if (videoH265Params !== '') {
dispatch(slice.actions.setEnabledVideoH265Params(true))
}
// videoAV1Params が存在した場合は enabledVideoAV1Params をセットする
if (videoAV1Params !== '') {
dispatch(slice.actions.setEnabledVideoAV1Params(true))
Expand Down Expand Up @@ -358,6 +366,10 @@ export const copyURL = () => {
appendAudioVideoParams && state.videoH264Params !== '' && state.enabledVideoH264Params
? state.videoH264Params
: undefined,
videoH265Params:
appendAudioVideoParams && state.videoH265Params !== '' && state.enabledVideoH265Params
? state.videoH265Params
: undefined,
videoAV1Params:
appendAudioVideoParams && state.videoAV1Params !== '' && state.enabledVideoAV1Params
? state.videoAV1Params
Expand Down Expand Up @@ -962,6 +974,7 @@ function pickConnectionOptionsState(state: SoraDevtoolsState): ConnectionOptions
enabledForwardingFilter: state.enabledForwardingFilter,
enabledVideoVP9Params: state.enabledVideoVP9Params,
enabledVideoH264Params: state.enabledVideoH264Params,
enabledVideoH265Params: state.enabledVideoH265Params,
enabledVideoAV1Params: state.enabledVideoAV1Params,
ignoreDisconnectWebSocket: state.ignoreDisconnectWebSocket,
audioLyraParamsBitrate: state.audioLyraParamsBitrate,
Expand All @@ -979,6 +992,7 @@ function pickConnectionOptionsState(state: SoraDevtoolsState): ConnectionOptions
videoCodecType: state.videoCodecType,
videoVP9Params: state.videoVP9Params,
videoH264Params: state.videoH264Params,
videoH265Params: state.videoH265Params,
videoAV1Params: state.videoAV1Params,
role: state.role,
}
Expand Down Expand Up @@ -1893,6 +1907,7 @@ export const {
setEnabledSignalingUrlCandidates,
setEnabledVideoVP9Params,
setEnabledVideoH264Params,
setEnabledVideoH265Params,
setEnabledVideoAV1Params,
setAudioStreamingLanguageCode,
setEnabledAudioStreamingLanguageCode,
Expand Down Expand Up @@ -1935,5 +1950,6 @@ export const {
setVideoTrack,
setVideoVP9Params,
setVideoH264Params,
setVideoH265Params,
setVideoAV1Params,
} = slice.actions
8 changes: 8 additions & 0 deletions src/app/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const initialState: SoraDevtoolsState = {
enabledSignalingUrlCandidates: false,
enabledVideoVP9Params: false,
enabledVideoH264Params: false,
enabledVideoH265Params: false,
enabledVideoAV1Params: false,
audioStreamingLanguageCode: '',
enabledAudioStreamingLanguageCode: false,
Expand Down Expand Up @@ -116,6 +117,7 @@ const initialState: SoraDevtoolsState = {
videoInputDevices: [],
videoVP9Params: '',
videoH264Params: '',
videoH265Params: '',
videoAV1Params: '',
version: packageJSON.version,
cameraDevice: true,
Expand Down Expand Up @@ -245,6 +247,9 @@ export const slice = createSlice({
setEnabledVideoH264Params: (state, action: PayloadAction<boolean>) => {
state.enabledVideoH264Params = action.payload
},
setEnabledVideoH265Params: (state, action: PayloadAction<boolean>) => {
state.enabledVideoH265Params = action.payload
},
setEnabledVideoAV1Params: (state, action: PayloadAction<boolean>) => {
state.enabledVideoAV1Params = action.payload
},
Expand Down Expand Up @@ -355,6 +360,9 @@ export const slice = createSlice({
setVideoH264Params: (state, action: PayloadAction<string>) => {
state.videoH264Params = action.payload
},
setVideoH265Params: (state, action: PayloadAction<string>) => {
state.videoH265Params = action.payload
},
setVideoAV1Params: (state, action: PayloadAction<string>) => {
state.videoAV1Params = action.payload
},
Expand Down
58 changes: 58 additions & 0 deletions src/components/DevtoolsPane/VideoH265ParamsForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from 'react'
import { Col, FormControl, FormGroup, Row } from 'react-bootstrap'

import { setEnabledVideoH265Params, setVideoH265Params } from '@/app/actions'
import { useAppDispatch, useAppSelector } from '@/app/hooks'
import { isFormDisabled } from '@/utils'

import { TooltipFormCheck } from './TooltipFormCheck'

export const VideoH265ParamsForm: React.FC = () => {
const enabledVideoH265Params = useAppSelector((state) => state.enabledVideoH265Params)
const videoH265Params = useAppSelector((state) => state.videoH265Params)
const connectionStatus = useAppSelector((state) => state.soraContents.connectionStatus)
const disabled = isFormDisabled(connectionStatus)
const dispatch = useAppDispatch()
const onChangeSwitch = (event: React.ChangeEvent<HTMLInputElement>): void => {
dispatch(setEnabledVideoH265Params(event.target.checked))
}
const onChangeText = (event: React.ChangeEvent<HTMLInputElement>): void => {
dispatch(setVideoH265Params(event.target.value))
}
return (
<>
<Row className="form-row">
<Col className="col-auto">
<FormGroup className="form-inline" controlId="enabledVideoH265Params">
<TooltipFormCheck
kind="videoH265Params"
checked={enabledVideoH265Params}
onChange={onChangeSwitch}
disabled={disabled}
>
videoH265Params
</TooltipFormCheck>
</FormGroup>
</Col>
</Row>
{enabledVideoH265Params ? (
<Row className="form-row">
<Col className="col-auto">
<FormGroup className="form-inline" controlId="videoH265Params">
<FormControl
className="flex-fill"
as="textarea"
placeholder="videoH265Paramsを指定"
value={videoH265Params}
onChange={onChangeText}
rows={10}
cols={100}
disabled={disabled}
/>
</FormGroup>
</Col>
</Row>
) : null}
</>
)
}
4 changes: 4 additions & 0 deletions src/components/DevtoolsPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { VideoCodecTypeForm } from './VideoCodecTypeForm'
import { VideoContentHintForm } from './VideoContentHintForm'
import { VideoForm } from './VideoForm'
import { VideoH264ParamsForm } from './VideoH264ParamsForm'
import { VideoH265ParamsForm } from './VideoH265ParamsForm'
import { VideoInputForm } from './VideoInputForm'
import { VideoTrackForm } from './VideoTrackForm'
import { VideoVP9ParamsForm } from './VideoVP9ParamsForm'
Expand Down Expand Up @@ -240,12 +241,14 @@ const RowAdvancedSignalingOptions: React.FC = () => {
const audioLyraParamsBitrate = useAppSelector((state) => state.audioLyraParamsBitrate)
const enabledVideoVP9Params = useAppSelector((state) => state.enabledVideoVP9Params)
const enabledVideoH264Params = useAppSelector((state) => state.enabledVideoH264Params)
const enabledVideoH265Params = useAppSelector((state) => state.enabledVideoH265Params)
const enabledVideoAV1Params = useAppSelector((state) => state.enabledVideoAV1Params)
const enabledOptions = [
audioStreamingLanguageCode !== '',
audioLyraParamsBitrate !== '',
enabledVideoVP9Params,
enabledVideoH264Params,
enabledVideoH265Params,
enabledVideoAV1Params,
].some((e) => e)
const linkClassNames = ['btn-collapse-options']
Expand Down Expand Up @@ -278,6 +281,7 @@ const RowAdvancedSignalingOptions: React.FC = () => {
<VideoVP9ParamsForm />
<VideoAV1ParamsForm />
<VideoH264ParamsForm />
<VideoH265ParamsForm />
</div>
</Collapse>
</Row>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Header/DownloadReportButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function createDownloadReport(): DownloadReport {
enabledSignalingUrlCandidates: state.enabledSignalingUrlCandidates,
enabledVideoVP9Params: state.enabledVideoVP9Params,
enabledVideoH264Params: state.enabledVideoH264Params,
enabledVideoH265Params: state.enabledVideoH265Params,
enabledVideoAV1Params: state.enabledVideoAV1Params,
facingMode: state.facingMode,
fakeVolume: state.fakeVolume,
Expand Down Expand Up @@ -75,6 +76,7 @@ function createDownloadReport(): DownloadReport {
videoTrack: state.videoTrack,
videoVP9Params: state.videoVP9Params,
videoH264Params: state.videoH264Params,
videoH265Params: state.videoH265Params,
videoAV1Params: state.videoAV1Params,
}
const report = {
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export type SoraDevtoolsState = {
enabledForwardingFilter: boolean
enabledVideoVP9Params: boolean
enabledVideoH264Params: boolean
enabledVideoH265Params: boolean
enabledVideoAV1Params: boolean
audioStreamingLanguageCode: string
enabledAudioStreamingLanguageCode: boolean
Expand Down Expand Up @@ -138,6 +139,7 @@ export type SoraDevtoolsState = {
videoInputDevices: MediaDeviceInfo[]
videoVP9Params: string
videoH264Params: string
videoH265Params: string
videoAV1Params: string
version: string
cameraDevice: boolean
Expand Down Expand Up @@ -347,6 +349,7 @@ export type ConnectionOptionsState = Pick<
| 'enabledForwardingFilter'
| 'enabledVideoVP9Params'
| 'enabledVideoH264Params'
| 'enabledVideoH265Params'
| 'enabledVideoAV1Params'
| 'ignoreDisconnectWebSocket'
| 'audioLyraParamsBitrate'
Expand All @@ -364,6 +367,7 @@ export type ConnectionOptionsState = Pick<
| 'videoCodecType'
| 'videoVP9Params'
| 'videoH264Params'
| 'videoH265Params'
| 'videoAV1Params'
| 'role'
>
Expand Down
8 changes: 8 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export function parseQueryString(): Partial<QueryStringParameters> {
videoCodecType: parseSpecifiedStringParameter(qs.videoCodecType, VIDEO_CODEC_TYPES),
videoVP9Params: parseStringParameter(qs.videoVP9Params),
videoH264Params: parseStringParameter(qs.videoH264Params),
videoH265Params: parseStringParameter(qs.videoH265Params),
videoAV1Params: parseStringParameter(qs.videoAV1Params),
audioInput: parseStringParameter(qs.audioInput),
videoInput: parseStringParameter(qs.videoInput),
Expand Down Expand Up @@ -703,6 +704,13 @@ export function createConnectOptions(
connectionOptionsState.videoH264Params,
)
}
// videoH265Params
if (connectionOptionsState.enabledVideoH265Params) {
connectionOptions.videoH265Params = parseMetadata(
true,
connectionOptionsState.videoH265Params,
)
}
// videoVP9Params
if (connectionOptionsState.enabledVideoAV1Params) {
connectionOptions.videoAV1Params = parseMetadata(true, connectionOptionsState.videoAV1Params)
Expand Down