Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: ppapi/proxy/video_encoder_resource.cc

Issue 956893002: content: pepper: VideoEncoder: add software encoder support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another android dep fix Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/examples/video_encode/video_encode.html ('k') | ppapi/tests/test_video_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/video_encoder_resource.cc
diff --git a/ppapi/proxy/video_encoder_resource.cc b/ppapi/proxy/video_encoder_resource.cc
index 3c6436b9a3edb8cbea302e90541e69db0891ecca..d337b7b8ee6ca845aa05b405c1d1ccbd0896410c 100644
--- a/ppapi/proxy/video_encoder_resource.cc
+++ b/ppapi/proxy/video_encoder_resource.cc
@@ -8,6 +8,7 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/video_encoder_resource.h"
#include "ppapi/proxy/video_frame_resource.h"
+#include "ppapi/shared_impl/array_writer.h"
#include "ppapi/shared_impl/media_stream_buffer.h"
#include "ppapi/shared_impl/media_stream_buffer_manager.h"
#include "ppapi/thunk/enter.h"
@@ -249,19 +250,23 @@ void VideoEncoderResource::OnPluginMsgGetSupportedProfilesReply(
const PP_ArrayOutput& output,
const ResourceMessageReplyParams& params,
const std::vector<PP_VideoProfileDescription>& profiles) {
- void* ptr = output.GetDataBuffer(
- output.user_data,
- base::checked_cast<uint32_t>(profiles.size()),
- base::checked_cast<uint32_t>(sizeof(PP_VideoProfileDescription)));
+ int32_t error = params.result();
+ if (error) {
+ NotifyError(error);
+ return;
+ }
+
+ ArrayWriter writer(output);
+ if (!writer.is_valid()) {
+ RunCallback(&get_supported_profiles_callback_, PP_ERROR_BADARGUMENT);
+ return;
+ }
- if (!ptr) {
+ if (!writer.StoreVector(profiles)) {
RunCallback(&get_supported_profiles_callback_, PP_ERROR_FAILED);
return;
}
- if (profiles.size() > 0)
- memcpy(ptr, &profiles[0],
- profiles.size() * sizeof(PP_VideoProfileDescription));
RunCallback(&get_supported_profiles_callback_, PP_OK);
}
« no previous file with comments | « ppapi/examples/video_encode/video_encode.html ('k') | ppapi/tests/test_video_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698