Repository navigation
feat(mobile): add native iOS and Android apps - #886
Conversation
Windows 真机上的 AAC spike本评论由 spike.logapartment.logproduct.log |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
| output := C.AMediaCodec_getOutputBuffer(c.codec, index, nil) | ||
| if output == nil || size < 0 || size%(2*c.chans) != 0 { | ||
| readErr = fmt.Errorf("mfadec: Android AAC: invalid %d-byte MediaCodec PCM buffer", size) | ||
| } else { | ||
| pcm := unsafe.Slice((*byte)(unsafe.Pointer(output)), size) | ||
| for sample := 0; sample < len(pcm); sample += 2 { | ||
| c.pcm = append(c.pcm, float32(int16(binary.LittleEndian.Uint16(pcm[sample:])))/32768) | ||
| } |
There was a problem hiding this comment.
Suggestion: AMediaCodecBufferInfo.offset is ignored, so codecs that place PCM later in the output buffer decode bytes before the valid range and produce corrupted audio.
Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Logic error
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/service/audio/mfadec/open_android.go
**Line:** 223:230
**Comment:**
*Logic Error: `AMediaCodecBufferInfo.offset` is ignored, so codecs that place PCM later in the output buffer decode bytes before the valid range and produce corrupted audio.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| if stored.Password != "" && draft.user == stored.Username && | ||
| strings.Trim(strings.TrimSpace(draft.host), "[]") == stored.Host && stored.Port != nil && | ||
| strings.TrimSpace(draft.port) == strconv.Itoa(*stored.Port) && draft.kind == stored.Type { | ||
| secretHint = "留空保留已保存的密码" | ||
| savedSecret = stored.Password | ||
| } |
There was a problem hiding this comment.
Suggestion: stored.Type becomes direct or system while draft.kind remains custom, so this guard drops the saved password and the next blank-password save erases it.
Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Incorrect condition logic
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/mobileui/settings.go
**Line:** 545:550
**Comment:**
*Incorrect Condition Logic: `stored.Type` becomes direct or system while `draft.kind` remains custom, so this guard drops the saved password and the next blank-password save erases it.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
|
||
| func (s *shell) playerProgress(c *ui.Context, state app.State) { | ||
| if state.Duration > 0 { | ||
| s.player.seek = float64(state.Position) / float64(state.Duration) |
There was a problem hiding this comment.
Suggestion: Each render resets seek to the live playhead, so playback updates overwrite the user’s slider drag and make seeking jump while playing.
Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/mobileui/player.go
**Line:** 328:328
**Comment:**
*Logic Error: Each render resets `seek` to the live playhead, so playback updates overwrite the user’s slider drag and make seeking jump while playing.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| Duration: n.Duration.Seconds(), Position: n.Position.Seconds(), Rate: n.Rate, | ||
| ArtworkURL: n.ArtworkURL, Artwork: p.artwork, | ||
| } | ||
| p.dirty = false |
There was a problem hiding this comment.
Suggestion: dirty is cleared before the native call; if publishing fails, this snapshot is discarded, and an unchanged paused or stopped state may never be sent again.
Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Possible bug
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/media/platform_mobile.go
**Line:** 116:116
**Comment:**
*Possible Bug: `dirty` is cleared before the native call; if publishing fails, this snapshot is discarded, and an unchanged paused or stopped state may never be sent again.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| .setAudioAttributes(attributes) | ||
| .setWillPauseWhenDucked(true) | ||
| .setOnAudioFocusChangeListener { change -> | ||
| if (change < 0 && state == "playing") command("pause") |
There was a problem hiding this comment.
Suggestion: After transient focus loss, playback is paused and the request is abandoned; the later focus gain is ignored, leaving playback paused after the interruption.
Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/media/android/NowPlaying.kt
**Line:** 148:148
**Comment:**
*Logic Error: After transient focus loss, playback is paused and the request is abandoned; the later focus gain is ignored, leaving playback paused after the interruption.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
|
||
| func (a *App) startPlayer(p *audio.Player) bool { | ||
| a.mu.Lock() | ||
| gate, intent := a.beforePlayback, a.PlaybackIntent() |
There was a problem hiding this comment.
Suggestion: The intent is sampled after Play begins; a Pause between its intent increment and this snapshot becomes the baseline, so the stale Play proceeds and starts audio after Pause.
Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Race condition
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/app/media.go
**Line:** 193:193
**Comment:**
*Race Condition: The intent is sampled after `Play` begins; a Pause between its intent increment and this snapshot becomes the baseline, so the stale Play proceeds and starts audio after Pause.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| if !l.settled.CompareAndSwap(false, true) || ctx.Err() != nil { | ||
| if err != nil { | ||
| return ErrStaleGeneration | ||
| } |
There was a problem hiding this comment.
Suggestion: If cancellation lands while Save returns an error after replacing the session file, this exits without rollback, leaving canceled login credentials persisted despite ErrStaleGeneration.
Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Missing cleanup
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/app/credentials.go
**Line:** 515:518
**Comment:**
*Missing Cleanup: If cancellation lands while `Save` returns an error after replacing the session file, this exits without rollback, leaving canceled login credentials persisted despite `ErrStaleGeneration`.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| rgba[0] = color_byte((light + 459*cr + 128) >> 8); | ||
| rgba[1] = color_byte((light - 55*cb - 136*cr + 128) >> 8); | ||
| rgba[2] = color_byte((light + 541*cb + 128) >> 8); |
There was a problem hiding this comment.
Suggestion: These coefficients assume BT.709 for every YUV stream, so BT.601 tracks are converted with the wrong matrix and display inaccurate colors.
Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** internal/service/video/open_android.go
**Line:** 116:118
**Comment:**
*Logic Error: These coefficients assume BT.709 for every YUV stream, so BT.601 tracks are converted with the wrong matrix and display inaccurate colors.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
|
User description
Why
Bring the approved PudMusic mobile prototype to iOS and Android using native MyGo views.
What changed
Scope
The PR stays in draft while device checks and the 102-scene prototype matrix are open. Android simulators are occupied. Audio focus, system playback controls, and file sharing need device runs. Astra is rechecking the fixes at
88730633.Verification
88730633.origin/main: two drawer hit tests, the radius convention check, and intermittent full-player like and download cleanup tests.CodeAnt-AI Description
Bring PudMusic to iOS and Android with native music browsing and playback
What Changed
Impact
✅ Music browsing and playback on iOS and Android✅ Offline playback for imported and downloaded tracks✅ Playback controls from the lock screen💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.