OLD | NEW |
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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 yuv_buffer, width_, width_, height_, encoder_fourcc_)) | 583 yuv_buffer, width_, width_, height_, encoder_fourcc_)) |
584 << "ConvertFromI420 failed"; | 584 << "ConvertFromI420 failed"; |
585 last_input_timestamp_ms_ = current_timestamp_us_ / 1000; | 585 last_input_timestamp_ms_ = current_timestamp_us_ / 1000; |
586 frames_in_queue_++; | 586 frames_in_queue_++; |
587 | 587 |
588 // Save input image timestamps for later output | 588 // Save input image timestamps for later output |
589 timestamps_.push_back(input_frame.timestamp()); | 589 timestamps_.push_back(input_frame.timestamp()); |
590 render_times_ms_.push_back(input_frame.render_time_ms()); | 590 render_times_ms_.push_back(input_frame.render_time_ms()); |
591 frame_rtc_times_ms_.push_back(GetCurrentTimeMs()); | 591 frame_rtc_times_ms_.push_back(GetCurrentTimeMs()); |
592 | 592 |
593 bool key_frame = frame_types->front() != webrtc::kDeltaFrame; | 593 bool key_frame = frame_types->front() != webrtc::kVideoFrameDelta; |
594 bool encode_status = jni->CallBooleanMethod(*j_media_codec_video_encoder_, | 594 bool encode_status = jni->CallBooleanMethod(*j_media_codec_video_encoder_, |
595 j_encode_method_, | 595 j_encode_method_, |
596 key_frame, | 596 key_frame, |
597 j_input_buffer_index, | 597 j_input_buffer_index, |
598 yuv_size_, | 598 yuv_size_, |
599 current_timestamp_us_); | 599 current_timestamp_us_); |
600 CHECK_EXCEPTION(jni); | 600 CHECK_EXCEPTION(jni); |
601 current_timestamp_us_ += 1000000 / last_set_fps_; | 601 current_timestamp_us_ += 1000000 / last_set_fps_; |
602 | 602 |
603 if (!encode_status || !DeliverPendingOutputs(jni)) { | 603 if (!encode_status || !DeliverPendingOutputs(jni)) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 762 |
763 // Callback - return encoded frame. | 763 // Callback - return encoded frame. |
764 int32_t callback_status = 0; | 764 int32_t callback_status = 0; |
765 if (callback_) { | 765 if (callback_) { |
766 scoped_ptr<webrtc::EncodedImage> image( | 766 scoped_ptr<webrtc::EncodedImage> image( |
767 new webrtc::EncodedImage(payload, payload_size, payload_size)); | 767 new webrtc::EncodedImage(payload, payload_size, payload_size)); |
768 image->_encodedWidth = width_; | 768 image->_encodedWidth = width_; |
769 image->_encodedHeight = height_; | 769 image->_encodedHeight = height_; |
770 image->_timeStamp = output_timestamp_; | 770 image->_timeStamp = output_timestamp_; |
771 image->capture_time_ms_ = output_render_time_ms_; | 771 image->capture_time_ms_ = output_render_time_ms_; |
772 image->_frameType = (key_frame ? webrtc::kKeyFrame : webrtc::kDeltaFrame); | 772 image->_frameType = |
| 773 (key_frame ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta); |
773 image->_completeFrame = true; | 774 image->_completeFrame = true; |
774 | 775 |
775 webrtc::CodecSpecificInfo info; | 776 webrtc::CodecSpecificInfo info; |
776 memset(&info, 0, sizeof(info)); | 777 memset(&info, 0, sizeof(info)); |
777 info.codecType = codecType_; | 778 info.codecType = codecType_; |
778 if (codecType_ == kVideoCodecVP8) { | 779 if (codecType_ == kVideoCodecVP8) { |
779 info.codecSpecific.VP8.pictureId = picture_id_; | 780 info.codecSpecific.VP8.pictureId = picture_id_; |
780 info.codecSpecific.VP8.nonReference = false; | 781 info.codecSpecific.VP8.nonReference = false; |
781 info.codecSpecific.VP8.simulcastIdx = 0; | 782 info.codecSpecific.VP8.simulcastIdx = 0; |
782 info.codecSpecific.VP8.temporalIdx = webrtc::kNoTemporalIdx; | 783 info.codecSpecific.VP8.temporalIdx = webrtc::kNoTemporalIdx; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 } | 956 } |
956 | 957 |
957 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 958 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
958 webrtc::VideoEncoder* encoder) { | 959 webrtc::VideoEncoder* encoder) { |
959 ALOGD << "Destroy video encoder."; | 960 ALOGD << "Destroy video encoder."; |
960 delete encoder; | 961 delete encoder; |
961 } | 962 } |
962 | 963 |
963 } // namespace webrtc_jni | 964 } // namespace webrtc_jni |
964 | 965 |
OLD | NEW |