New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 715191 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Crash due to AudioRendererImpl::audio_clock_ being nullptr

Project Member Reported by servolk@chromium.org, Apr 25 2017

Issue description

I've noticed that media/avtrack/track-switching.html LayoutTest is crashing when run locally.
After a little debugging I believe I understand the root cause of the crash. The problem is that AudioRendererImpl::Initialize resets the audio_clock_ (i.e. sets it to nullptr) at https://cs.chromium.org/chromium/src/media/renderers/audio_renderer_impl.cc?rcl=96c9b34ea924ed4300f90839cab36adf4f8eaecc&l=347. The clock is later recreated at https://cs.chromium.org/chromium/src/media/renderers/audio_renderer_impl.cc?rcl=96c9b34ea924ed4300f90839cab36adf4f8eaecc&l=457, so strictly speaking we wouldn't need to reset it if we didn't have a (temporary) DCHECK_EQ(audio_clock_, nullptr) at https://cs.chromium.org/chromium/src/media/renderers/audio_renderer_impl.cc?rcl=96c9b34ea924ed4300f90839cab36adf4f8eaecc&l=353.

The crash happens when some audio output device code happens to call AudioRenderer::GetCurrentTime during that brief period while the renderer is reinitialized and the audio_clock_ is nullptr.
 
Cc: chcunningham@chromium.org xhw...@chromium.org dalecur...@chromium.org
Labels: -Pri-2 OS-All Pri-3
Owner: servolk@chromium.org
Status: Assigned (was: Untriaged)
Oh, and also, now that AudioRendererImpl::Initialize may be called more than once (e.g. in order to reinit the renderer for a different media track), we probably need to add a lock in there.

Do you have a crash stack?
I can repro this consistenly on my workstation when running a debug version of media/avtrack/track-switching.html test.
I got it slightly wrong in comment #1. The GetCurrentTime is actually called from blink code, not audio output device. It's the media thread that waits on the audio output device.

The call stack of the crashing (main) thread is:

(gdb) bt
#0  0x00007ff822b86c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ff822b8a028 in __GI_abort () at abort.c:89
#2  0x00007ff82d4be6ff in std::__replacement_assert (__file=0x7ff82dd36d2a "../../build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h", __line=228, __function=0x7ff82dd4bdae "std::unique_ptr::pointer std::unique_ptr<media::AudioClock, std::default_delete<media::AudioClock> >::operator->() const [_Tp = media::AudioClock, _Dp = std::default_delete<media::AudioClock>]", __condition=0x7ff82dd36e92 "get() != pointer()") at ../../build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/bits/c++config.h:373
#3  0x00007ff82d64c816 in std::unique_ptr<media::AudioClock, std::default_delete<media::AudioClock> >::operator-> (this=0x818e3353320) at ../../build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:228
#4  0x00007ff82d64476f in media::AudioRendererImpl::CurrentMediaTime (this=0x818e33531e0) at ../../media/renderers/audio_renderer_impl.cc:187
#5  0x00007ff82d6448a9 in non-virtual thunk to media::AudioRendererImpl::CurrentMediaTime() () at ../../build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:735
#6  0x00007ff82d659c4a in media::RendererImpl::GetMediaTime (this=0x818e34eec60) at ../../media/renderers/renderer_impl.cc:267
#7  0x00007ff82d858ea9 in media::PipelineImpl::RendererWrapper::GetMediaTime (this=0x818e34c27a0) at ../../media/base/pipeline_impl.cc:450
#8  0x00007ff82d861d4e in media::PipelineImpl::GetMediaTime (this=0x818e33b4d40) at ../../media/base/pipeline_impl.cc:1166
#9  0x00007ff82d5ab5c6 in media::PipelineController::GetMediaTime (this=0x818e328a888) at ../../media/filters/pipeline_controller.cc:280
#10 0x00007ff821c250a4 in media::WebMediaPlayerImpl::CurrentTime (this=0x818e328a820) at ../../media/blink/webmediaplayer_impl.cc:774
#11 0x00007ff8292e1926 in blink::HTMLMediaElement::CurrentPlaybackPosition (this=0x3f0b973840d8) at ../../third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:1977
#12 0x00007ff8292db361 in blink::HTMLMediaElement::ScheduleTimeupdateEvent (this=0x3f0b973840d8, periodic_event=true) at ../../third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:2513
#13 0x00007ff8292d68b8 in blink::HTMLMediaElement::PlaybackProgressTimerFired (this=0x3f0b973840d8) at ../../third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:2503
#14 0x00007ff8288262e1 in blink::TaskRunnerTimer<blink::ScriptPromiseResolver>::Fired (this=0x3f0b973842b8) at ../../third_party/WebKit/Source/platform/Timer.h:144
#15 0x00007ff82700826d in blink::TimerBase::RunInternal (this=0x3f0b973842b8) at ../../third_party/WebKit/Source/platform/Timer.cpp:175
#16 0x00007ff827009127 in base::internal::FunctorTraits<void (blink::TimerBase::*)(), void>::Invoke<base::WeakPtr<blink::TimerBase> const&> ( method=(void (blink::TimerBase::*)(blink::TimerBase * const)) 0x7ff827007f20 <blink::TimerBase::RunInternal()>, receiver_ptr=...) at ../../base/bind_internal.h:214
#17 0x00007ff82700901a in base::internal::InvokeHelper<true, void>::MakeItSo<void (blink::TimerBase::* const&)(), base::WeakPtr<blink::TimerBase> const&> ( functor=@0x818e40dfac8: (void (blink::TimerBase::*)(blink::TimerBase * const)) 0x7ff827007f20 <blink::TimerBase::RunInternal()>, weak_ptr=...) at ../../base/bind_internal.h:305
#18 0x00007ff827008fa2 in base::internal::Invoker<base::internal::BindState<void (blink::TimerBase::*)(), base::WeakPtr<blink::TimerBase> >, void ()>::RunImpl<void (blink::TimerBase::* const&)(), std::tuple<base::WeakPtr<blink::TimerBase> > const&, 0ul>(void (blink::TimerBase::* const&)(), std::tuple<base::WeakPtr<blink::TimerBase> > const&, base::IndexSequence<0ul>) ( functor=@0x818e40dfac8: (void (blink::TimerBase::*)(blink::TimerBase * const)) 0x7ff827007f20 <blink::TimerBase::RunInternal()>, bound=empty std::tuple) at ../../base/bind_internal.h:361
#19 0x00007ff827008ebc in base::internal::Invoker<base::internal::BindState<void (blink::TimerBase::*)(), base::WeakPtr<blink::TimerBase> >, void ()>::Run(base::internal::BindStateBase*) (base=0x818e40dfaa0) at ../../base/bind_internal.h:339
#20 0x00007ff831512e3e in base::Callback<void (), (base::internal::CopyMode)0, (base::internal::RepeatMode)0>::Run() && (this=0x7ffd6031a958) at ../../base/callback.h:91
#21 0x00007ff83151257e in base::debug::TaskAnnotator::RunTask (this=0x818e3205148, queue_function=0x7ff827b00305 "TaskQueueManager::PostTask", pending_task=0x7ffd6031a940) at ../../base/debug/task_annotator.cc:59
#22 0x00007ff827457dc5 in blink::scheduler::TaskQueueManager::ProcessTaskFromWorkQueue (this=0x818e3205020, work_queue=0x818e4259ad0, is_nested=false, time_before_task=..., time_after_task=0x7ffd6031acf0) at ../../third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc:539
#23 0x00007ff827454d0d in blink::scheduler::TaskQueueManager::DoWork (this=0x818e3205020, delayed=true) at ../../third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc:337
#24 0x00007ff8274600b4 in base::internal::FunctorTraits<void (blink::scheduler::TaskQueueManager::*)(bool), void>::Invoke<base::WeakPtr<blink::scheduler::TaskQueueManager> const&, bool const&> (method= (void (blink::scheduler::TaskQueueManager::*)(blink::scheduler::TaskQueueManager * const, bool)) 0x7ff827454720 <blink::scheduler::TaskQueueManager::DoWork(bool)>, receiver_ptr=..., args=@0x818e31b0688: true) at ../../base/bind_internal.h:214
#25 0x00007ff82745ffbf in base::internal::InvokeHelper<true, void>::MakeItSo<void (blink::scheduler::TaskQueueManager::* const&)(bool), base::WeakPtr<blink::scheduler::TaskQueueManager> const&, bool const&> (functor=@0x818e31b0678: (void (blink::scheduler::TaskQueueManager::*)(blink::scheduler::TaskQueueManager * const, bool)) 0x7ff827454720 <blink::scheduler::TaskQueueManager::DoWork(bool)>, weak_ptr=..., args=@0x818e31b0688: true) at ../../base/bind_internal.h:305
#26 0x00007ff82745ff33 in base::internal::Invoker<base::internal::BindState<void (blink::scheduler::TaskQueueManager::*)(bool), base::WeakPtr<blink::scheduler::TaskQueueManager>, bool>, void ()>::RunImpl<void (blink::scheduler::TaskQueueManager::* const&)(bool), std::tuple<base::WeakPtr<blink::scheduler::TaskQueueManager>, bool> const&, 0ul, 1ul>(void (blink::scheduler::TaskQueueManager::* const&)(bool), std::tuple<base::WeakPtr<blink::scheduler::TaskQueueManager>, bool> const&, base::IndexSequence<0ul, 1ul>) (functor= @0x818e31b0678: (void (blink::scheduler::TaskQueueManager::*)(blink::scheduler::TaskQueueManager * const, bool)) 0x7ff827454720 <blink::scheduler::TaskQueueManager::DoWork(bool)>, bound=empty std::tuple) at ../../base/bind_internal.h:361
#27 0x00007ff82745fe4c in base::internal::Invoker<base::internal::BindState<void (blink::scheduler::TaskQueueManager::*)(bool), base::WeakPtr<blink::scheduler::TaskQueueManager>, bool>, void ()>::Run(base::internal::BindStateBase*) (base=0x818e31b0650) at ../../base/bind_internal.h:339
#28 0x00007ff82701027d in base::Callback<void (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1>::Run() const & (this=0x818e3205320) at ../../base/callback.h:80
#29 0x00007ff82743f849 in base::CancelableCallback<void ()>::Forward() const (this=0x818e3205318) at ../../base/cancelable_callback.h:110
#30 0x00007ff827009127 in base::internal::FunctorTraits<void (blink::TimerBase::*)(), void>::Invoke<base::WeakPtr<blink::TimerBase> const&> ( method=(void (blink::TimerBase::*)(blink::TimerBase * const)) 0x7ff82743f830 <base::CancelableCallback<void ()>::Forward() const>, receiver_ptr=...) at ../../base/bind_internal.h:214
#31 0x00007ff82743fa7a in base::internal::InvokeHelper<true, void>::MakeItSo<void (base::CancelableCallback<void ()>::* const&)() const, base::WeakPtr<base::CancelableCallback<void ()> > const&>(void (base::CancelableCallback<void ()>::* const&)() const, base::WeakPtr<base::CancelableCallback<void ()> > const&) ( functor=@0x818e43b2648: (void (base::CancelableCallback<void ()>::*)(const base::CancelableCallback<void ()> * const)) 0x7ff82743f830 <base::CancelableCallback<void ()>::Forward() const>, weak_ptr=...) at ../../base/bind_internal.h:305
#32 0x00007ff82743fa02 in base::internal::Invoker<base::internal::BindState<void (base::CancelableCallback<void ()>::*)() const, base::WeakPtr<base::CancelableCallback<void ()> > >, void ()>::RunImpl<void (base::CancelableCallback<void ()>::* const&)() const, std::tuple<base::WeakPtr<base::CancelableCallback<void ()> > > const&, 0ul>(void (base::CancelableCallback<void ()>::* const&)() const, std::tuple<base::WeakPtr<base::CancelableCallback<void ()> > > const&, base::IndexSequence<0ul>) ( functor=@0x818e43b2648: (void (base::CancelableCallback<void ()>::*)(const base::CancelableCallback<void ()> * const)) 0x7ff82743f830 <base::CancelableCallback<void ()>::Forward() const>, bound=empty std::tuple) at ../../base/bind_internal.h:361
#33 0x00007ff82743f94c in base::internal::Invoker<base::internal::BindState<void (base::CancelableCallback<void ()>::*)() const, base::WeakPtr<base::CancelableCallback<void ()> > >, void ()>::Run(base::internal::BindStateBase*) (base=0x818e43b2620) at ../../base/bind_internal.h:339
#34 0x00007ff831512e3e in base::Callback<void (), (base::internal::CopyMode)0, (base::internal::RepeatMode)0>::Run() && (this=0x7ffd6031be48) at ../../base/callback.h:91
#35 0x00007ff83151257e in base::debug::TaskAnnotator::RunTask (this=0x818e31ef580, queue_function=0x7ff83183cebc "MessageLoop::PostTask", pending_task=0x7ffd6031be30) at ../../base/debug/task_annotator.cc:59
#36 0x00007ff8315a520d in base::MessageLoop::RunTask (this=0x818e31ef360, pending_task=0x7ffd6031be30) at ../../base/message_loop/message_loop.cc:423
#37 0x00007ff8315a5494 in base::MessageLoop::DeferOrRunPendingTask (this=0x818e31ef360, pending_task=...) at ../../base/message_loop/message_loop.cc:434
#38 0x00007ff8315a5a1c in base::MessageLoop::DoDelayedWork (this=0x818e31ef360, next_delayed_work_time=0x818e32e8258) at ../../base/message_loop/message_loop.cc:566
#39 0x00007ff8315bcfb7 in base::MessagePumpDefault::Run (this=0x818e32e8200, delegate=0x818e31ef360) at ../../base/message_loop/message_pump_default.cc:37
#40 0x00007ff8315a4da7 in base::MessageLoop::RunHandler (this=0x818e31ef360) at ../../base/message_loop/message_loop.cc:387
#41 0x00007ff83164cd6a in base::RunLoop::Run (this=0x7ffd6031c940) at ../../base/run_loop.cc:37
#42 0x00007ff8346f40fd in content::RendererMain (parameters=...) at ../../content/renderer/renderer_main.cc:200
#43 0x00007ff834b28d6d in content::RunZygote (main_function_params=..., delegate=0x7ffd6031d658) at ../../content/app/content_main_runner.cc:367
#44 0x00007ff834b29120 in content::RunNamedProcessTypeMain (process_type="zygote", main_function_params=..., delegate=0x7ffd6031d658) at ../../content/app/content_main_runner.cc:446
#45 0x00007ff834b2b3fd in content::ContentMainRunnerImpl::Run (this=0x818e31b0890) at ../../content/app/content_main_runner.cc:740
#46 0x00007ff834b2848a in content::ContentServiceManagerMainDelegate::Run (this=0x7ffd6031d5f0) at ../../content/app/content_service_manager_main_delegate.cc:36
#47 0x00007ff822242b88 in service_manager::Main (params=...) at ../../services/service_manager/embedder/main.cc:179
#48 0x00007ff834b28aef in content::ContentMain (params=...) at ../../content/app/content_main.cc:19
#49 0x00000000004ab0c1 in main (argc=9, argv=0x7ffd6031d7a8) at ../../content/shell/app/shell_main.cc:48

And here is the media thread, re-initializing the media renderer
Thread 3 (Thread 0x7ff80f6ba700 (LWP 56230)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ff8316883b5 in base::ConditionVariable::Wait (this=0x7ff80f6b5a78) at ../../base/synchronization/condition_variable_posix.cc:69
#2  0x00007ff83168a531 in base::WaitableEvent::TimedWaitUntil (this=0x818e45a8150, end_time=...) at ../../base/synchronization/waitable_event_posix.cc:225
#3  0x00007ff83168a1cc in base::WaitableEvent::Wait (this=0x818e45a8150) at ../../base/synchronization/waitable_event_posix.cc:157
#4  0x00007ff82d78b221 in media::AudioOutputDevice::GetOutputDeviceInfo (this=0x818e45a8020) at ../../media/audio/audio_output_device.cc:150
#5  0x00007ff83454e968 in content::(anonymous namespace)::SinkIsHealthy (sink=0x818e45a8020) at ../../content/renderer/media/audio_renderer_sink_cache_impl.cc:41
#6  0x00007ff83454e3e6 in content::AudioRendererSinkCacheImpl::CacheUnusedSinkIfHealthy (this=0x818e3edd100, source_render_frame_id=2, device_id="", security_origin=..., sink=...) at ../../content/renderer/media/audio_renderer_sink_cache_impl.cc:257
#7  0x00007ff83454e23d in content::AudioRendererSinkCacheImpl::GetSinkInfo (this=0x818e3edd100, source_render_frame_id=2, session_id=0, device_id="", security_origin=...) at ../../content/renderer/media/audio_renderer_sink_cache_impl.cc:122
#8  0x00007ff8345486de in content::AudioRendererMixerManager::GetOutputDeviceInfo (this=0x818e3fc6020, source_render_frame_id=2, session_id=0, device_id="", security_origin=...) at ../../content/renderer/media/audio_renderer_mixer_manager.cc:238
#9  0x00007ff82d802a33 in media::AudioRendererMixerInput::GetOutputDeviceInfo (this=0x818e332f2e0) at ../../media/base/audio_renderer_mixer_input.cc:114
#10 0x00007ff821c0216a in media::WebAudioSourceProviderImpl::GetOutputDeviceInfo (this=0x818e3edd480) at ../../media/blink/webaudiosourceprovider_impl.cc:257
#11 0x00007ff821c021b0 in non-virtual thunk to media::WebAudioSourceProviderImpl::GetOutputDeviceInfo() () at ../../build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:646
#12 0x00007ff82d646ff4 in media::AudioRendererImpl::Initialize(media::DemuxerStream*, media::CdmContext*, media::RendererClient*, base::Callback<void (media::PipelineStatus), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) (this=0x818e33531e0, stream=0x818e34c5c20, cdm_context=0x0, client=0x818e331a160, init_cb=...) at ../../media/renderers/audio_renderer_impl.cc:368
#13 0x00007ff82d65e4ec in media::RendererImpl::ReinitializeAudioRenderer (this=0x818e34eec60, stream=0x818e34c5c20, time=...) at ../../media/renderers/renderer_impl.cc:606
#14 0x00007ff82d6664cf in base::internal::FunctorTraits<void (media::RendererImpl::*)(media::DemuxerStream*, base::TimeDelta), void>::Invoke<base::WeakPtr<media::RendererImpl> const&, media::DemuxerStream* const&, base::TimeDelta const&> (method= (void (media::RendererImpl::*)(media::RendererImpl * const, media::DemuxerStream *, base::TimeDelta)) 0x7ff82d65e170 <media::RendererImpl::ReinitializeAudioRenderer(media::DemuxerStream*, base::TimeDelta)>, receiver_ptr=..., args=..., args=...) at ../../base/bind_internal.h:214
#15 0x00007ff82d6663c4 in base::internal::InvokeHelper<true, void>::MakeItSo<void (media::RendererImpl::* const&)(media::DemuxerStream*, base::TimeDelta), base::WeakPtr<media::RendererImpl> const&, media::DemuxerStream* const&, base::TimeDelta const&> (functor= @0x818e3602798: (void (media::RendererImpl::*)(media::RendererImpl * const, media::DemuxerStream *, base::TimeDelta)) 0x7ff82d65e170 <media::RendererImpl::ReinitializeAudioRenderer(media::DemuxerStream*, base::TimeDelta)>, weak_ptr=..., args=..., args=...) at ../../base/bind_internal.h:305
#16 0x00007ff82d666324 in base::internal::Invoker<base::internal::BindState<void (media::RendererImpl::*)(media::DemuxerStream*, base::TimeDelta), base::WeakPtr<media::RendererImpl>, media::DemuxerStream*, base::TimeDelta>, void ()>::RunImpl<void (media::RendererImpl::* const&)(media::DemuxerStream*, base::TimeDelta), std::tuple<base::WeakPtr<media::RendererImpl>, media::DemuxerStream*, base::TimeDelta> const&, 0ul, 1ul, 2ul>(void (media::RendererImpl::* const&)(media::DemuxerStream*, base::TimeDelta), std::tuple<base::WeakPtr<media::RendererImpl>, media::DemuxerStream*, base::TimeDelta> const&, base::IndexSequence<0ul, 1ul, 2ul>) (functor= @0x818e3602798: (void (media::RendererImpl::*)(media::RendererImpl * const, media::DemuxerStream *, base::TimeDelta)) 0x7ff82d65e170 <media::RendererImpl::ReinitializeAudioRenderer(media::DemuxerStream*, base::TimeDelta)>, bound=empty std::tuple) at ../../base/bind_internal.h:361
#17 0x00007ff82d6661fc in base::internal::Invoker<base::internal::BindState<void (media::RendererImpl::*)(media::DemuxerStream*, base::TimeDelta), base::WeakPtr<media::RendererImpl>, media::DemuxerStream*, base::TimeDelta>, void ()>::Run(base::internal::BindStateBase*) (base=0x818e3602770) at ../../base/bind_internal.h:339
#18 0x00007ff831512e3e in base::Callback<void (), (base::internal::CopyMode)0, (base::internal::RepeatMode)0>::Run() && (this=0x7ff80f6b83d0) at ../../base/callback.h:91
#19 0x00007ff83151257e in base::debug::TaskAnnotator::RunTask (this=0x818e34d8580, queue_function=0x7ff83183cebc "MessageLoop::PostTask", pending_task=0x7ff80f6b83b8) at ../../base/debug/task_annotator.cc:59
#20 0x00007ff8315a520d in base::MessageLoop::RunTask (this=0x818e34d8360, pending_task=0x7ff80f6b83b8) at ../../base/message_loop/message_loop.cc:423
#21 0x00007ff8315a5494 in base::MessageLoop::DeferOrRunPendingTask (this=0x818e34d8360, pending_task=...) at ../../base/message_loop/message_loop.cc:434
#22 0x00007ff8315a5784 in base::MessageLoop::DoWork (this=0x818e34d8360) at ../../base/message_loop/message_loop.cc:527
#23 0x00007ff8315bcf78 in base::MessagePumpDefault::Run (this=0x818e407a660, delegate=0x818e34d8360) at ../../base/message_loop/message_pump_default.cc:33
#24 0x00007ff8315a4da7 in base::MessageLoop::RunHandler (this=0x818e34d8360) at ../../base/message_loop/message_loop.cc:387
#25 0x00007ff83164cd6a in base::RunLoop::Run (this=0x7ff80f6b9200) at ../../base/run_loop.cc:37
#26 0x00007ff8316f2744 in base::Thread::Run (this=0x818e32594a0, run_loop=0x7ff80f6b9200) at ../../base/threading/thread.cc:250
#27 0x00007ff8316f2faa in base::Thread::ThreadMain (this=0x818e32594a0) at ../../base/threading/thread.cc:333
#28 0x00007ff8316d9cda in base::(anonymous namespace)::ThreadFunc (params=0x818e334f9d0) at ../../base/threading/platform_thread_posix.cc:71
#29 0x00007ff836cdd184 in start_thread (arg=0x7ff80f6ba700) at pthread_create.c:312
#30 0x00007ff822c4dbed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Note that the frame #12 above indicates that media thread is at ../../media/renderers/audio_renderer_impl.cc:368, which means audio_clock_ is nullptr, because of being reset on line 347.

Ah, that should probably just return last known media time if clock is null.
When you said some audio output device thing, I thought it might be a different caller.
I was wondering if the right fix would be something like this:
https://codereview.chromium.org/2837303003

But, I guess, if we just did that, then the audio_clock_->front_timestamp() might get called before the audio_clock_ is fully initialized (via SetMediaTime). So I'm still contemplating if there's a better way to fix this.
The clock should be destroyed between runs; when destroyed it should save the last known timestamp and just report that. Possibly RendererImpl should block calls into ARI during the transition. It already intercepts the calls anyways.
Project Member

Comment 8 by bugdroid1@chromium.org, May 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9dd6cc8ed582ed45422be5c4a0dad00464d2639a

commit 9dd6cc8ed582ed45422be5c4a0dad00464d2639a
Author: servolk <servolk@chromium.org>
Date: Wed May 24 05:39:02 2017

Freeze the reported media time while audio is restarted

Audio renderer clock is used as a time source for the RendererImpl when
we have an audio stream. But audio renderer clock gets recreated when
switching audio streams, so we must avoid calling ARI::CurrentMediaTime
while an audio renderer is being restarted. This fixes a crash in the
media/avtrack/track-switching.html layout test.

BUG= 715191 

Review-Url: https://codereview.chromium.org/2890603004
Cr-Commit-Position: refs/heads/master@{#474175}

[modify] https://crrev.com/9dd6cc8ed582ed45422be5c4a0dad00464d2639a/media/renderers/renderer_impl.cc
[modify] https://crrev.com/9dd6cc8ed582ed45422be5c4a0dad00464d2639a/media/renderers/renderer_impl.h

Status: Fixed (was: Assigned)

Sign in to add a comment