| OLD | NEW | 
|---|
| 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 <algorithm> | 9 #include <algorithm> | 
| 10 #include <deque> | 10 #include <deque> | 
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 235   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH, "h264high"); | 235   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH, "h264high"); | 
| 236   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH10PROFILE, "h264high10"); | 236   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH10PROFILE, "h264high10"); | 
| 237   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH422PROFILE, "h264high422"); | 237   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH422PROFILE, "h264high422"); | 
| 238   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE, | 238   AddVideoProfile(PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE, | 
| 239                   "h264high444predictive"); | 239                   "h264high444predictive"); | 
| 240   AddVideoProfile(PP_VIDEOPROFILE_H264SCALABLEBASELINE, "h264scalablebaseline"); | 240   AddVideoProfile(PP_VIDEOPROFILE_H264SCALABLEBASELINE, "h264scalablebaseline"); | 
| 241   AddVideoProfile(PP_VIDEOPROFILE_H264SCALABLEHIGH, "h264scalablehigh"); | 241   AddVideoProfile(PP_VIDEOPROFILE_H264SCALABLEHIGH, "h264scalablehigh"); | 
| 242   AddVideoProfile(PP_VIDEOPROFILE_H264STEREOHIGH, "h264stereohigh"); | 242   AddVideoProfile(PP_VIDEOPROFILE_H264STEREOHIGH, "h264stereohigh"); | 
| 243   AddVideoProfile(PP_VIDEOPROFILE_H264MULTIVIEWHIGH, "h264multiviewhigh"); | 243   AddVideoProfile(PP_VIDEOPROFILE_H264MULTIVIEWHIGH, "h264multiviewhigh"); | 
| 244   AddVideoProfile(PP_VIDEOPROFILE_VP8_ANY, "vp8"); | 244   AddVideoProfile(PP_VIDEOPROFILE_VP8_ANY, "vp8"); | 
| 245   AddVideoProfile(PP_VIDEOPROFILE_VP9_ANY, "vp9"); | 245   AddVideoProfile(PP_VIDEOPROFILE_VP9_PROFILE0, "vp9 profile0"); | 
|  | 246   AddVideoProfile(PP_VIDEOPROFILE_VP9_PROFILE1, "vp9 profile1"); | 
|  | 247   AddVideoProfile(PP_VIDEOPROFILE_VP9_PROFILE2, "vp9 profile2"); | 
|  | 248   AddVideoProfile(PP_VIDEOPROFILE_VP9_PROFILE3, "vp9 profile3"); | 
| 246 } | 249 } | 
| 247 | 250 | 
| 248 PP_VideoProfile VideoEncoderInstance::VideoProfileFromString( | 251 PP_VideoProfile VideoEncoderInstance::VideoProfileFromString( | 
| 249     const std::string& str) { | 252     const std::string& str) { | 
| 250   VideoProfileFromStringMap::iterator it = profile_from_string_.find(str); | 253   VideoProfileFromStringMap::iterator it = profile_from_string_.find(str); | 
| 251   if (it == profile_from_string_.end()) | 254   if (it == profile_from_string_.end()) | 
| 252     return PP_VIDEOPROFILE_VP8_ANY; | 255     return PP_VIDEOPROFILE_VP8_ANY; | 
| 253   return it->second; | 256   return it->second; | 
| 254 } | 257 } | 
| 255 | 258 | 
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 548 | 551 | 
| 549 void VideoEncoderInstance::PostDataMessage(const void* buffer, uint32_t size) { | 552 void VideoEncoderInstance::PostDataMessage(const void* buffer, uint32_t size) { | 
| 550   pp::VarDictionary dictionary; | 553   pp::VarDictionary dictionary; | 
| 551 | 554 | 
| 552   dictionary.Set(pp::Var("name"), pp::Var("data")); | 555   dictionary.Set(pp::Var("name"), pp::Var("data")); | 
| 553 | 556 | 
| 554   pp::VarArrayBuffer array_buffer; | 557   pp::VarArrayBuffer array_buffer; | 
| 555   uint8_t* data_ptr; | 558   uint8_t* data_ptr; | 
| 556   uint32_t data_offset = 0; | 559   uint32_t data_offset = 0; | 
| 557   if (video_profile_ == PP_VIDEOPROFILE_VP8_ANY || | 560   if (video_profile_ == PP_VIDEOPROFILE_VP8_ANY || | 
| 558       video_profile_ == PP_VIDEOPROFILE_VP9_ANY) { | 561       video_profile_ == PP_VIDEOPROFILE_VP9_PROFILE0 || | 
|  | 562       video_profile_ == PP_VIDEOPROFILE_VP9_PROFILE1 || | 
|  | 563       video_profile_ == PP_VIDEOPROFILE_VP9_PROFILE2 || | 
|  | 564       video_profile_ == PP_VIDEOPROFILE_VP9_PROFILE3) { | 
| 559     uint32_t frame_offset = 0; | 565     uint32_t frame_offset = 0; | 
| 560     if (encoded_frames_ == 1) { | 566     if (encoded_frames_ == 1) { | 
| 561       array_buffer = pp::VarArrayBuffer( | 567       array_buffer = pp::VarArrayBuffer( | 
| 562           size + ivf_writer_.GetFileHeaderSize() + | 568           size + ivf_writer_.GetFileHeaderSize() + | 
| 563           ivf_writer_.GetFrameHeaderSize()); | 569           ivf_writer_.GetFrameHeaderSize()); | 
| 564       data_ptr = static_cast<uint8_t*>(array_buffer.Map()); | 570       data_ptr = static_cast<uint8_t*>(array_buffer.Map()); | 
| 565       frame_offset = ivf_writer_.WriteFileHeader( | 571       frame_offset = ivf_writer_.WriteFileHeader( | 
| 566           data_ptr, ToUpperString(VideoProfileToString(video_profile_)), | 572           data_ptr, ToUpperString(VideoProfileToString(video_profile_)), | 
| 567           frame_size_.width(), frame_size_.height()); | 573           frame_size_.width(), frame_size_.height()); | 
| 568     } else { | 574     } else { | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 609 } | 615 } | 
| 610 | 616 | 
| 611 }  // anonymous namespace | 617 }  // anonymous namespace | 
| 612 | 618 | 
| 613 namespace pp { | 619 namespace pp { | 
| 614 // Factory function for your specialization of the Module object. | 620 // Factory function for your specialization of the Module object. | 
| 615 Module* CreateModule() { | 621 Module* CreateModule() { | 
| 616   return new VideoEncoderModule(); | 622   return new VideoEncoderModule(); | 
| 617 } | 623 } | 
| 618 }  // namespace pp | 624 }  // namespace pp | 
| OLD | NEW | 
|---|