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

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 2613623002: media: Continue aborting FFMpegDemuxerStream::Read() calls until Seek(). (Closed)
Patch Set: Created 3 years, 11 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 | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/ffmpeg_demuxer.h" 5 #include "media/filters/ffmpeg_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 audio_config_(audio_config.release()), 268 audio_config_(audio_config.release()),
269 video_config_(video_config.release()), 269 video_config_(video_config.release()),
270 type_(UNKNOWN), 270 type_(UNKNOWN),
271 liveness_(LIVENESS_UNKNOWN), 271 liveness_(LIVENESS_UNKNOWN),
272 end_of_stream_(false), 272 end_of_stream_(false),
273 last_packet_timestamp_(kNoTimestamp), 273 last_packet_timestamp_(kNoTimestamp),
274 last_packet_duration_(kNoTimestamp), 274 last_packet_duration_(kNoTimestamp),
275 video_rotation_(VIDEO_ROTATION_0), 275 video_rotation_(VIDEO_ROTATION_0),
276 is_enabled_(true), 276 is_enabled_(true),
277 waiting_for_keyframe_(false), 277 waiting_for_keyframe_(false),
278 aborted_(false),
278 fixup_negative_timestamps_(false) { 279 fixup_negative_timestamps_(false) {
279 DCHECK(demuxer_); 280 DCHECK(demuxer_);
280 281
281 bool is_encrypted = false; 282 bool is_encrypted = false;
282 int rotation = 0; 283 int rotation = 0;
283 AVDictionaryEntry* rotation_entry = NULL; 284 AVDictionaryEntry* rotation_entry = NULL;
284 285
285 // Determine our media format. 286 // Determine our media format.
286 switch (stream->codecpar->codec_type) { 287 switch (stream->codecpar->codec_type) {
287 case AVMEDIA_TYPE_AUDIO: 288 case AVMEDIA_TYPE_AUDIO:
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 585
585 // H264 and AAC require that we resend the header after flush. 586 // H264 and AAC require that we resend the header after flush.
586 // Reset bitstream for converter to do so. 587 // Reset bitstream for converter to do so.
587 // This is related to chromium issue 140371 (http://crbug.com/140371). 588 // This is related to chromium issue 140371 (http://crbug.com/140371).
588 ResetBitstreamConverter(); 589 ResetBitstreamConverter();
589 590
590 buffer_queue_.Clear(); 591 buffer_queue_.Clear();
591 end_of_stream_ = false; 592 end_of_stream_ = false;
592 last_packet_timestamp_ = kNoTimestamp; 593 last_packet_timestamp_ = kNoTimestamp;
593 last_packet_duration_ = kNoTimestamp; 594 last_packet_duration_ = kNoTimestamp;
595 aborted_ = false;
594 } 596 }
595 597
596 void FFmpegDemuxerStream::Abort() { 598 void FFmpegDemuxerStream::Abort() {
599 aborted_ = true;
597 if (!read_cb_.is_null()) 600 if (!read_cb_.is_null())
598 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr); 601 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr);
599 } 602 }
600 603
601 void FFmpegDemuxerStream::Stop() { 604 void FFmpegDemuxerStream::Stop() {
602 DCHECK(task_runner_->BelongsToCurrentThread()); 605 DCHECK(task_runner_->BelongsToCurrentThread());
603 buffer_queue_.Clear(); 606 buffer_queue_.Clear();
604 if (!read_cb_.is_null()) { 607 if (!read_cb_.is_null()) {
605 base::ResetAndReturn(&read_cb_).Run( 608 base::ResetAndReturn(&read_cb_).Run(
606 DemuxerStream::kOk, DecoderBuffer::CreateEOSBuffer()); 609 DemuxerStream::kOk, DecoderBuffer::CreateEOSBuffer());
(...skipping 27 matching lines...) Expand all
634 DemuxerStream::kOk, DecoderBuffer::CreateEOSBuffer()); 637 DemuxerStream::kOk, DecoderBuffer::CreateEOSBuffer());
635 return; 638 return;
636 } 639 }
637 640
638 if (!is_enabled_) { 641 if (!is_enabled_) {
639 DVLOG(1) << "Read from disabled stream, returning EOS"; 642 DVLOG(1) << "Read from disabled stream, returning EOS";
640 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); 643 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer());
641 return; 644 return;
642 } 645 }
643 646
647 if (aborted_) {
648 base::ResetAndReturn(&read_cb_).Run(kAborted, nullptr);
649 return;
650 }
651
644 SatisfyPendingRead(); 652 SatisfyPendingRead();
645 } 653 }
646 654
647 void FFmpegDemuxerStream::EnableBitstreamConverter() { 655 void FFmpegDemuxerStream::EnableBitstreamConverter() {
648 DCHECK(task_runner_->BelongsToCurrentThread()); 656 DCHECK(task_runner_->BelongsToCurrentThread());
649 657
650 #if defined(USE_PROPRIETARY_CODECS) 658 #if defined(USE_PROPRIETARY_CODECS)
651 InitBitstreamConverter(); 659 InitBitstreamConverter();
652 #else 660 #else
653 NOTREACHED() << "Proprietary codecs not enabled."; 661 NOTREACHED() << "Proprietary codecs not enabled.";
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 1791
1784 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1792 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1785 DCHECK(task_runner_->BelongsToCurrentThread()); 1793 DCHECK(task_runner_->BelongsToCurrentThread());
1786 for (const auto& stream : streams_) { 1794 for (const auto& stream : streams_) {
1787 if (stream) 1795 if (stream)
1788 stream->SetLiveness(liveness); 1796 stream->SetLiveness(liveness);
1789 } 1797 }
1790 } 1798 }
1791 1799
1792 } // namespace media 1800 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698