~diwic/pulseaudio/audio-mixer-touch

« back to all changes in this revision

Viewing changes to test-voice-call/test-voice-call.c

  • Committer: David Henningsson
  • Date: 2013-08-12 15:19:12 UTC
  • Revision ID: david.henningsson@canonical.com-20130812151912-jgxo0phe8jbgdl0u
Add some more robust shutdown code to test-voice-call (fixes segfault on N4)

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        else
66
66
                fprintf(stderr, "no stream or set_parameters for output stream\n", err);
67
67
 
 
68
        /* Not sure about this one */
 
69
        idevice |= AUDIO_DEVICE_IN_VOICE_CALL;
68
70
 
69
71
        if (!device->open_input_stream)
70
72
                fprintf(stderr, "no open_input_stream\n");
96
98
        fprintf(stderr, "Press Enter when you have finished your call.\n");
97
99
        getchar();
98
100
 
99
 
        if (ostream && device && device->close_output_stream)
 
101
        if (ostream && device && device->close_output_stream) {
 
102
                fprintf(stderr, "Closing output stream\n");
100
103
                device->close_output_stream(device, ostream);
 
104
                fprintf(stderr, "Closed output stream\n");
 
105
        }
101
106
 
102
 
        if (istream && device && device->close_input_stream)
 
107
        if (istream && device && device->close_input_stream) {
 
108
                fprintf(stderr, "Closing input stream\n");
103
109
                device->close_input_stream(device, istream);
104
 
 
105
 
        if (device->set_mode) 
 
110
                fprintf(stderr, "Closed input stream\n");
 
111
        }
 
112
 
 
113
        if (device->set_parameters) {
 
114
                fprintf(stderr, "Setting mode to normal through set_parameters (N4 workaround)\n");
 
115
                err = device->set_parameters(device, "CALL_KEY=0;");
 
116
                fprintf(stderr, "set_parameters returned %d\n", err);
 
117
        }
 
118
 
 
119
        if (device->set_mode) {
 
120
                fprintf(stderr, "Setting mode to normal\n");
106
121
                device->set_mode(device, AUDIO_MODE_NORMAL);
 
122
        }
 
123
 
107
124
fail:
108
 
        if (device)
 
125
        if (device) {
 
126
                fprintf(stderr, "Closing audio HAL device\n");
109
127
                audio_hw_device_close(device);
 
128
                fprintf(stderr, "Audio HAL device closed.\n");
 
129
        }
 
130
 
 
131
        return 0;
110
132
}