refactor(video): change default video format to webm#466
refactor(video): change default video format to webm#466max-lvs merged 1 commit intolinuxdeepin:develop/eagle20260427from
Conversation
Unify video format selection logic across all devices. Change default format from mp4 to webm for better compatibility. 统一所有设备的视频格式选择逻辑,将默认格式从 mp4 改为 webm 以提升兼容性。 Log: 修改默认录制视频格式为 webm PMS: https://pms.uniontech.com/bug-view-358869.html Influence: 新用户默认使用 webm 格式录制视频,用户仍可在设置中切换为 mp4。已有用户配置不受影响。
|
Hi @Resurgamz. Thanks for your PR. 😃 |
|
Hi @Resurgamz. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
CLA Assistant Lite bot: |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactors video format selection to make webm the primary default format across devices while simplifying and unifying the selection logic, with settings now interpreting index 0 as webm and 1 as mp4. Class diagram for updated video format selectionclassDiagram
class videowidget {
- string m_videoFormat
+ videowidget(parent)
}
class Settings {
- SettingsInstance m_settings
- QStringList videoFormatList
+ void init()
}
class DataManager {
+ static DataManager* instance()
+ int encodeEnv()
+ bool encExists()
}
class GlobalUtils {
+ static void loadCameraConf()
+ static bool isLowPerformanceBoard()
}
class dc_Settings {
+ static dc_Settings& get()
+ QVariant getOption(key)
+ void setOption(key, value)
}
videowidget --> DataManager : uses encodeEnv
videowidget --> DataManager : uses encExists
videowidget --> dc_Settings : reads vidformat
Settings --> DataManager : uses encodeEnv
Settings --> DataManager : uses encExists
Settings --> GlobalUtils : uses loadCameraConf
Settings --> dc_Settings : sets vidformat
note for videowidget "m_videoFormat default webm; config index 0=webm, 1=mp4"
note for Settings "videoFormatList[0]=webm, [1]=mp4 when encoder exists"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The logic around
GlobalUtils::isLowPerformanceBoard()has been removed from both the constructor and settings list, which changes behavior on low-performance boards; please double-check whether these devices are still expected to preferwebmonly or ifmp4should now be user-selectable there. - The mapping from
outsetting.outformat.vidformatoption to actual format strings ("webm"/"mp4") is duplicated betweenSettings::initandvideowidget—consider centralizing this mapping (e.g., via a helper or enum) to keep default indices and supported formats consistent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The logic around `GlobalUtils::isLowPerformanceBoard()` has been removed from both the constructor and settings list, which changes behavior on low-performance boards; please double-check whether these devices are still expected to prefer `webm` only or if `mp4` should now be user-selectable there.
- The mapping from `outsetting.outformat.vidformat` option to actual format strings (`"webm"` / `"mp4"`) is duplicated between `Settings::init` and `videowidget`—consider centralizing this mapping (e.g., via a helper or enum) to keep default indices and supported formats consistent.
## Individual Comments
### Comment 1
<location path="src/src/videowidget.cpp" line_range="225-231" />
<code_context>
setGridType(Grid_None);
- if (DataManager::instance()->encodeEnv() != FFmpeg_Env || !DataManager::instance()->encExists() || GlobalUtils::isLowPerformanceBoard()) {
+ // 默认使用 webm 格式
+ if (DataManager::instance()->encodeEnv() != FFmpeg_Env || !DataManager::instance()->encExists()) {
m_videoFormat = "webm";
- }
- if (dc::Settings::get().getOption("outsetting.outformat.vidformat").toInt()) {
- if (!GlobalUtils::isLowPerformanceBoard())
- m_videoFormat = "webm";
- else
+ } else {
+ // 根据配置选择格式:0=webm(默认), 1=mp4
+ int formatIndex = dc::Settings::get().getOption("outsetting.outformat.vidformat").toInt();
+ if (formatIndex == 1) {
m_videoFormat = "mp4";
+ } else {
</code_context>
<issue_to_address>
**suggestion:** Consider simplifying default format logic to reduce duplication and make future changes safer.
`m_videoFormat = "webm"` is assigned in both branches. Since `webm` is the default, you can set it once before the `if`, then only set `
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| // 默认使用 webm 格式 | ||
| if (DataManager::instance()->encodeEnv() != FFmpeg_Env || !DataManager::instance()->encExists()) { | ||
| m_videoFormat = "webm"; | ||
| } | ||
| if (dc::Settings::get().getOption("outsetting.outformat.vidformat").toInt()) { | ||
| if (!GlobalUtils::isLowPerformanceBoard()) | ||
| m_videoFormat = "webm"; | ||
| else | ||
| } else { | ||
| // 根据配置选择格式:0=webm(默认), 1=mp4 | ||
| int formatIndex = dc::Settings::get().getOption("outsetting.outformat.vidformat").toInt(); | ||
| if (formatIndex == 1) { |
There was a problem hiding this comment.
suggestion: Consider simplifying default format logic to reduce duplication and make future changes safer.
m_videoFormat = "webm" is assigned in both branches. Since webm is the default, you can set it once before the if, then only set `
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, max-lvs, Resurgamz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
5a29a2d
into
linuxdeepin:develop/eagle20260427
Unify video format selection logic across all devices. Change default format from mp4 to webm for better compatibility.
统一所有设备的视频格式选择逻辑,将默认格式从 mp4 改为 webm 以提升兼容性。
Log: 修改默认录制视频格式为 webm
PMS: https://pms.uniontech.com/bug-view-358869.html
Influence: 新用户默认使用 webm 格式录制视频,用户仍可在设置中切换为 mp4。已有用户配置不受影响。
Summary by Sourcery
Enhancements: