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

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

Issue 1401943002: Fix use of scaler in MediaCodecVideoEncoder (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 | no next file » | no next file with comments »
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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 537
538 RTC_CHECK(frame_types->size() == 1) << "Unexpected stream count"; 538 RTC_CHECK(frame_types->size() == 1) << "Unexpected stream count";
539 // Check framerate before spatial resolution change. 539 // Check framerate before spatial resolution change.
540 if (scale_) 540 if (scale_)
541 quality_scaler_.OnEncodeFrame(frame); 541 quality_scaler_.OnEncodeFrame(frame);
542 542
543 const VideoFrame& input_frame = 543 const VideoFrame& input_frame =
544 scale_ ? quality_scaler_.GetScaledFrame(frame) : frame; 544 scale_ ? quality_scaler_.GetScaledFrame(frame) : frame;
545 545
546 if (!MaybeReconfigureEncoderOnCodecThread(frame)) { 546 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) {
547 ALOGE << "Failed to reconfigure encoder."; 547 ALOGE << "Failed to reconfigure encoder.";
548 return WEBRTC_VIDEO_CODEC_ERROR; 548 return WEBRTC_VIDEO_CODEC_ERROR;
549 } 549 }
550 550
551 // Check if we accumulated too many frames in encoder input buffers 551 // Check if we accumulated too many frames in encoder input buffers
552 // or the encoder latency exceeds 70 ms and drop frame if so. 552 // or the encoder latency exceeds 70 ms and drop frame if so.
553 if (frames_in_queue_ > 0 && last_input_timestamp_ms_ >= 0) { 553 if (frames_in_queue_ > 0 && last_input_timestamp_ms_ >= 0) {
554 int encoder_latency_ms = last_input_timestamp_ms_ - 554 int encoder_latency_ms = last_input_timestamp_ms_ -
555 last_output_timestamp_ms_; 555 last_output_timestamp_ms_;
556 if (frames_in_queue_ > 2 || encoder_latency_ms > 70) { 556 if (frames_in_queue_ > 2 || encoder_latency_ms > 70) {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 } 999 }
1000 1000
1001 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1001 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1002 webrtc::VideoEncoder* encoder) { 1002 webrtc::VideoEncoder* encoder) {
1003 ALOGD << "Destroy video encoder."; 1003 ALOGD << "Destroy video encoder.";
1004 delete encoder; 1004 delete encoder;
1005 } 1005 }
1006 1006
1007 } // namespace webrtc_jni 1007 } // namespace webrtc_jni
1008 1008
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698