Skip to content

Commit d96b98a

Browse files
tyohanat-wat
andauthored
Apply suggestions from code review
Co-authored-by: Atsushi Watanabe <[email protected]>
1 parent 9185fa5 commit d96b98a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/codec/vpx/vpx.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (e *encoder) Read() ([]byte, func(), error) {
252252
e.raw.d_w, e.raw.d_h = C.uint(width), C.uint(height)
253253
}
254254

255-
duration := t.Sub(e.tLastFrame).Nanoseconds() / 1000000
255+
duration := t.Sub(e.tLastFrame).Microseconds()
256256
// VPX doesn't allow 0 duration. If 0 is given, vpx_codec_encode will fail with VPX_CODEC_INVALID_PARAM.
257257
// 0 duration is possible because mediadevices first gets the frame meta data by reading from the source,
258258
// and consequently the codec will read the first frame from the buffer. This means the first frame won't
@@ -267,7 +267,7 @@ func (e *encoder) Read() ([]byte, func(), error) {
267267
}
268268
if ec := C.encode_wrapper(
269269
e.codec, e.raw,
270-
C.long(t.Sub(e.tStart).Nanoseconds()/1000000), C.ulong(duration), C.long(flags), C.ulong(e.deadline),
270+
C.long(t.Sub(e.tStart).Microseconds()), C.ulong(duration), C.long(flags), C.ulong(e.deadline),
271271
(*C.uchar)(&yuvImg.Y[0]), (*C.uchar)(&yuvImg.Cb[0]), (*C.uchar)(&yuvImg.Cr[0]),
272272
); ec != C.VPX_CODEC_OK {
273273
return nil, func() {}, fmt.Errorf("vpx_codec_encode failed (%d)", ec)

0 commit comments

Comments
 (0)