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

Side by Side Diff: native_client_sdk/src/examples/api/video_encode/video_encode.cc

Issue 1069653002: ppapi: VideoEncoder: fix reported value for GetSupportedProfiles() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bbudge's nit Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | ppapi/examples/video_encode/video_encode.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <math.h> 5 #include <math.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <iostream> 9 #include <iostream>
10 #include <map> 10 #include <map>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 274 }
275 275
276 void VideoEncoderInstance::OnEncoderProbed( 276 void VideoEncoderInstance::OnEncoderProbed(
277 int32_t result, 277 int32_t result,
278 const std::vector<PP_VideoProfileDescription> profiles) { 278 const std::vector<PP_VideoProfileDescription> profiles) {
279 pp::VarDictionary dict; 279 pp::VarDictionary dict;
280 dict.Set(pp::Var("name"), pp::Var("supportedProfiles")); 280 dict.Set(pp::Var("name"), pp::Var("supportedProfiles"));
281 pp::VarArray js_profiles; 281 pp::VarArray js_profiles;
282 dict.Set(pp::Var("profiles"), js_profiles); 282 dict.Set(pp::Var("profiles"), js_profiles);
283 283
284 if (result != PP_OK) { 284 if (result < 0) {
285 LogError(result, "Cannot get supported profiles"); 285 LogError(result, "Cannot get supported profiles");
286 PostMessage(dict); 286 PostMessage(dict);
287 } 287 }
288 288
289 int32_t idx = 0; 289 int32_t idx = 0;
290 for (uint32_t i = 0; i < profiles.size(); i++) { 290 for (uint32_t i = 0; i < profiles.size(); i++) {
291 const PP_VideoProfileDescription& profile = profiles[i]; 291 const PP_VideoProfileDescription& profile = profiles[i];
292 js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile))); 292 js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile)));
293 } 293 }
294 PostMessage(dict); 294 PostMessage(dict);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 563 }
564 564
565 } // anonymous namespace 565 } // anonymous namespace
566 566
567 namespace pp { 567 namespace pp {
568 // Factory function for your specialization of the Module object. 568 // Factory function for your specialization of the Module object.
569 Module* CreateModule() { 569 Module* CreateModule() {
570 return new VideoEncoderModule(); 570 return new VideoEncoderModule();
571 } 571 }
572 } // namespace pp 572 } // namespace pp
OLDNEW
« no previous file with comments | « no previous file | ppapi/examples/video_encode/video_encode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698