Don't convert audio message if file is already ogg
This commit is contained in:
parent
a0602d6c94
commit
44fb681955
1 changed files with 7 additions and 5 deletions
|
@ -1231,14 +1231,16 @@ func (portal *Portal) convertGoogleMedia(ctx context.Context, source *User, inte
|
||||||
// TODO convert weird formats to mp4
|
// TODO convert weird formats to mp4
|
||||||
case "audio":
|
case "audio":
|
||||||
msgtype = event.MsgAudio
|
msgtype = event.MsgAudio
|
||||||
|
if mime != "audio/ogg" {
|
||||||
data, err = ffmpeg.ConvertBytes(ctx, data, ".ogg", []string{}, []string{"-c:a", "libopus"}, mime)
|
data, err = ffmpeg.ConvertBytes(ctx, data, ".ogg", []string{}, []string{"-c:a", "libopus"}, mime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("%w (%s to ogg): %w", errMediaConvertFailed, mime, err)
|
return nil, nil, fmt.Errorf("%w (%s to ogg): %w", errMediaConvertFailed, mime, err)
|
||||||
}
|
}
|
||||||
extra["org.matrix.msc3245.voice"] = map[string]any{}
|
|
||||||
fileName += ".ogg"
|
fileName += ".ogg"
|
||||||
mime = "audio/ogg"
|
mime = "audio/ogg"
|
||||||
}
|
}
|
||||||
|
extra["org.matrix.msc3245.voice"] = map[string]any{}
|
||||||
|
}
|
||||||
content := &event.MessageEventContent{
|
content := &event.MessageEventContent{
|
||||||
MsgType: msgtype,
|
MsgType: msgtype,
|
||||||
Body: fileName,
|
Body: fileName,
|
||||||
|
|
Loading…
Reference in a new issue