зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1169125 - Part 2: Use UniquePtr for scoped delete of yuv data in MediaPipeline. r=bwc
--HG-- extra : rebase_source : 4a66d6946479adb7d0574448e2204e63f388b698 extra : histedit_source : c7c0824f3ed1f02db24a1792b10ea7315b6e46e6
This commit is contained in:
Родитель
f76298db5c
Коммит
ffc3d7735d
|
@ -1176,9 +1176,10 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk(
|
|||
int half_height = (size.height + 1) >> 1;
|
||||
int c_size = half_width * half_height;
|
||||
int buffer_size = YSIZE(size.width, size.height) + 2 * c_size;
|
||||
uint8* yuv = (uint8*) malloc(buffer_size); // fallible
|
||||
if (!yuv)
|
||||
UniquePtr<uint8[]> yuv_scoped(new (fallible) uint8[buffer_size]);
|
||||
if (!yuv_scoped)
|
||||
return;
|
||||
uint8* yuv = yuv_scoped.get();
|
||||
|
||||
{
|
||||
DataSourceSurface::ScopedMap map(data, DataSourceSurface::READ);
|
||||
|
@ -1219,7 +1220,6 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk(
|
|||
}
|
||||
}
|
||||
conduit->SendVideoFrame(yuv, buffer_size, size.width, size.height, mozilla::kVideoI420, 0);
|
||||
free(yuv);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче