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

Unified Diff: talk/app/webrtc/objc/h264encoderfactory.cc

Issue 1187573004: iOS HW H264 support. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Unit tests Created 5 years, 6 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
Index: talk/app/webrtc/objc/h264encoderfactory.cc
diff --git a/talk/app/webrtc/dtlsidentityservice.cc b/talk/app/webrtc/objc/h264encoderfactory.cc
similarity index 52%
copy from talk/app/webrtc/dtlsidentityservice.cc
copy to talk/app/webrtc/objc/h264encoderfactory.cc
index b4b7279c8288395a8e23a507f7c78dc199572cab..77d105e1e985b5147c0e7eb7628a8cd4b75a46fd 100644
--- a/talk/app/webrtc/dtlsidentityservice.cc
+++ b/talk/app/webrtc/objc/h264encoderfactory.cc
@@ -25,26 +25,51 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/app/webrtc/dtlsidentityservice.h"
+#include "talk/app/webrtc/objc/h264encoderfactory.h"
-#include "talk/app/webrtc/dtlsidentitystore.h"
-#include "webrtc/base/logging.h"
+#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
+
+static size_t const kMaxVideoSize = 1280;
+static size_t const kMaxFps = 30;
namespace webrtc {
-bool DtlsIdentityService::RequestIdentity(
- const std::string& identity_name,
- const std::string& common_name,
- webrtc::DTLSIdentityRequestObserver* observer) {
- if (identity_name != DtlsIdentityStore::kIdentityName ||
- common_name != DtlsIdentityStore::kIdentityName) {
- LOG(LS_WARNING) << "DtlsIdentityService::RequestIdentity called with "
- << "unsupported params, identity_name=" << identity_name
- << ", common_name=" << common_name;
- return false;
+H264EncoderFactory::H264EncoderFactory() {
+ // Check that encoder can be created.
+ // TODO(tkchin): Find better way to check that encoder is supported. e.g.
pbos-webrtc 2015/06/23 19:13:56 Yes, please do that now. bool H264Encoder::IsSuppo
tkchin_webrtc 2015/06/24 23:21:14 Done.
+ // is iOS8 sufficient.
+ rtc::scoped_ptr<H264Encoder> encoder(H264Encoder::Create());
+ if (encoder) {
+ webrtc::VideoCodec rtc_codec = {};
+ rtc_codec.codecType = webrtc::kVideoCodecH264;
+ rtc_codec.width = 640;
+ rtc_codec.height = 480;
+ rtc_codec.targetBitrate = 100;
+ bool h264_supported =
+ encoder->InitEncode(&rtc_codec, 0, 0) == WEBRTC_VIDEO_CODEC_OK;
+ if (h264_supported) {
+ h264_codec_or_empty_vector_.push_back(VideoCodec(
+ kVideoCodecH264, "H264", kMaxVideoSize, kMaxVideoSize, kMaxFps));
+ }
+ }
+}
+
+VideoEncoder* H264EncoderFactory::CreateVideoEncoder(VideoCodecType type) {
+ for (const VideoCodec& codec : h264_codec_or_empty_vector_) {
+ if (codec.type == type) {
+ return H264Encoder::Create();
+ }
}
- store_->RequestIdentity(observer);
- return true;
+ return nullptr;
+}
+
+const std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>&
+H264EncoderFactory::codecs() const {
+ return h264_codec_or_empty_vector_;
+}
+
+void H264EncoderFactory::DestroyVideoEncoder(VideoEncoder* encoder) {
+ delete encoder;
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698