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

Side by Side Diff: talk/app/webrtc/java/jni/androidmediaencoder_jni.cc

Issue 1371043003: Unify FrameType and VideoFrameType. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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 | talk/media/webrtc/fakewebrtcvideoengine.h » ('j') | webrtc/common_types.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public rtc::MessageHandler { 79 public rtc::MessageHandler {
80 public: 80 public:
81 virtual ~MediaCodecVideoEncoder(); 81 virtual ~MediaCodecVideoEncoder();
82 explicit MediaCodecVideoEncoder(JNIEnv* jni, VideoCodecType codecType); 82 explicit MediaCodecVideoEncoder(JNIEnv* jni, VideoCodecType codecType);
83 83
84 // webrtc::VideoEncoder implementation. Everything trampolines to 84 // webrtc::VideoEncoder implementation. Everything trampolines to
85 // |codec_thread_| for execution. 85 // |codec_thread_| for execution.
86 int32_t InitEncode(const webrtc::VideoCodec* codec_settings, 86 int32_t InitEncode(const webrtc::VideoCodec* codec_settings,
87 int32_t /* number_of_cores */, 87 int32_t /* number_of_cores */,
88 size_t /* max_payload_size */) override; 88 size_t /* max_payload_size */) override;
89 int32_t Encode( 89 int32_t Encode(const webrtc::VideoFrame& input_image,
90 const webrtc::VideoFrame& input_image, 90 const webrtc::CodecSpecificInfo* /* codec_specific_info */,
91 const webrtc::CodecSpecificInfo* /* codec_specific_info */, 91 const std::vector<webrtc::FrameType>* frame_types) override;
92 const std::vector<webrtc::VideoFrameType>* frame_types) override;
93 int32_t RegisterEncodeCompleteCallback( 92 int32_t RegisterEncodeCompleteCallback(
94 webrtc::EncodedImageCallback* callback) override; 93 webrtc::EncodedImageCallback* callback) override;
95 int32_t Release() override; 94 int32_t Release() override;
96 int32_t SetChannelParameters(uint32_t /* packet_loss */, 95 int32_t SetChannelParameters(uint32_t /* packet_loss */,
97 int64_t /* rtt */) override; 96 int64_t /* rtt */) override;
98 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; 97 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override;
99 98
100 // rtc::MessageHandler implementation. 99 // rtc::MessageHandler implementation.
101 void OnMessage(rtc::Message* msg) override; 100 void OnMessage(rtc::Message* msg) override;
102 101
(...skipping 11 matching lines...) Expand all
114 113
115 // Implementation of webrtc::VideoEncoder methods above, all running on the 114 // Implementation of webrtc::VideoEncoder methods above, all running on the
116 // codec thread exclusively. 115 // codec thread exclusively.
117 // 116 //
118 // If width==0 then this is assumed to be a re-initialization and the 117 // If width==0 then this is assumed to be a re-initialization and the
119 // previously-current values are reused instead of the passed parameters 118 // previously-current values are reused instead of the passed parameters
120 // (makes it easier to reason about thread-safety). 119 // (makes it easier to reason about thread-safety).
121 int32_t InitEncodeOnCodecThread(int width, int height, int kbps, int fps); 120 int32_t InitEncodeOnCodecThread(int width, int height, int kbps, int fps);
122 int32_t EncodeOnCodecThread( 121 int32_t EncodeOnCodecThread(
123 const webrtc::VideoFrame& input_image, 122 const webrtc::VideoFrame& input_image,
124 const std::vector<webrtc::VideoFrameType>* frame_types); 123 const std::vector<webrtc::FrameType>* frame_types);
125 int32_t RegisterEncodeCompleteCallbackOnCodecThread( 124 int32_t RegisterEncodeCompleteCallbackOnCodecThread(
126 webrtc::EncodedImageCallback* callback); 125 webrtc::EncodedImageCallback* callback);
127 int32_t ReleaseOnCodecThread(); 126 int32_t ReleaseOnCodecThread();
128 int32_t SetRatesOnCodecThread(uint32_t new_bit_rate, uint32_t frame_rate); 127 int32_t SetRatesOnCodecThread(uint32_t new_bit_rate, uint32_t frame_rate);
129 128
130 // Helper accessors for MediaCodecVideoEncoder$OutputBufferInfo members. 129 // Helper accessors for MediaCodecVideoEncoder$OutputBufferInfo members.
131 int GetOutputBufferInfoIndex(JNIEnv* jni, jobject j_output_buffer_info); 130 int GetOutputBufferInfoIndex(JNIEnv* jni, jobject j_output_buffer_info);
132 jobject GetOutputBufferInfoBuffer(JNIEnv* jni, jobject j_output_buffer_info); 131 jobject GetOutputBufferInfoBuffer(JNIEnv* jni, jobject j_output_buffer_info);
133 bool GetOutputBufferInfoIsKeyFrame(JNIEnv* jni, jobject j_output_buffer_info); 132 bool GetOutputBufferInfoIsKeyFrame(JNIEnv* jni, jobject j_output_buffer_info);
134 jlong GetOutputBufferInfoPresentationTimestampUs( 133 jlong GetOutputBufferInfoPresentationTimestampUs(
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 this, 330 this,
332 codec_settings->width, 331 codec_settings->width,
333 codec_settings->height, 332 codec_settings->height,
334 codec_settings->startBitrate, 333 codec_settings->startBitrate,
335 codec_settings->maxFramerate)); 334 codec_settings->maxFramerate));
336 } 335 }
337 336
338 int32_t MediaCodecVideoEncoder::Encode( 337 int32_t MediaCodecVideoEncoder::Encode(
339 const webrtc::VideoFrame& frame, 338 const webrtc::VideoFrame& frame,
340 const webrtc::CodecSpecificInfo* /* codec_specific_info */, 339 const webrtc::CodecSpecificInfo* /* codec_specific_info */,
341 const std::vector<webrtc::VideoFrameType>* frame_types) { 340 const std::vector<webrtc::FrameType>* frame_types) {
342 return codec_thread_->Invoke<int32_t>(Bind( 341 return codec_thread_->Invoke<int32_t>(Bind(
343 &MediaCodecVideoEncoder::EncodeOnCodecThread, this, frame, frame_types)); 342 &MediaCodecVideoEncoder::EncodeOnCodecThread, this, frame, frame_types));
344 } 343 }
345 344
346 int32_t MediaCodecVideoEncoder::RegisterEncodeCompleteCallback( 345 int32_t MediaCodecVideoEncoder::RegisterEncodeCompleteCallback(
347 webrtc::EncodedImageCallback* callback) { 346 webrtc::EncodedImageCallback* callback) {
348 return codec_thread_->Invoke<int32_t>( 347 return codec_thread_->Invoke<int32_t>(
349 Bind(&MediaCodecVideoEncoder::RegisterEncodeCompleteCallbackOnCodecThread, 348 Bind(&MediaCodecVideoEncoder::RegisterEncodeCompleteCallbackOnCodecThread,
350 this, 349 this,
351 callback)); 350 callback));
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 RTC_CHECK(yuv_buffer_capacity >= yuv_size_) << "Insufficient capacity"; 492 RTC_CHECK(yuv_buffer_capacity >= yuv_size_) << "Insufficient capacity";
494 } 493 }
495 CHECK_EXCEPTION(jni); 494 CHECK_EXCEPTION(jni);
496 495
497 codec_thread_->PostDelayed(kMediaCodecPollMs, this); 496 codec_thread_->PostDelayed(kMediaCodecPollMs, this);
498 return WEBRTC_VIDEO_CODEC_OK; 497 return WEBRTC_VIDEO_CODEC_OK;
499 } 498 }
500 499
501 int32_t MediaCodecVideoEncoder::EncodeOnCodecThread( 500 int32_t MediaCodecVideoEncoder::EncodeOnCodecThread(
502 const webrtc::VideoFrame& frame, 501 const webrtc::VideoFrame& frame,
503 const std::vector<webrtc::VideoFrameType>* frame_types) { 502 const std::vector<webrtc::FrameType>* frame_types) {
504 CheckOnCodecThread(); 503 CheckOnCodecThread();
505 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 504 JNIEnv* jni = AttachCurrentThreadIfNeeded();
506 ScopedLocalRefFrame local_ref_frame(jni); 505 ScopedLocalRefFrame local_ref_frame(jni);
507 506
508 if (!inited_) { 507 if (!inited_) {
509 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; 508 return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
510 } 509 }
511 frames_received_++; 510 frames_received_++;
512 if (!DeliverPendingOutputs(jni)) { 511 if (!DeliverPendingOutputs(jni)) {
513 ResetCodec(); 512 ResetCodec();
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 } 948 }
950 949
951 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 950 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
952 webrtc::VideoEncoder* encoder) { 951 webrtc::VideoEncoder* encoder) {
953 ALOGD("Destroy video encoder."); 952 ALOGD("Destroy video encoder.");
954 delete encoder; 953 delete encoder;
955 } 954 }
956 955
957 } // namespace webrtc_jni 956 } // namespace webrtc_jni
958 957
OLDNEW
« no previous file with comments | « no previous file | talk/media/webrtc/fakewebrtcvideoengine.h » ('j') | webrtc/common_types.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698